Troll23 improvements
authorTomas Mudrunka <tomas@mudrunka.cz>
Tue, 11 Feb 2014 03:34:54 +0000 (04:34 +0100)
committerTomas Mudrunka <tomas@mudrunka.cz>
Tue, 11 Feb 2014 03:34:54 +0000 (04:34 +0100)
c/troll23/troll23.c

index f1822e0e21f4f3815045293663a924faac89771c..6d004d4a7854840af25c46af65ece4eb0aede9fd 100644 (file)
@@ -4,15 +4,32 @@
 #include <sys/types.h>
 #include <sys/syscall.h>
 #include <dlfcn.h>
+#include <unistd.h>
 #include <stdarg.h>
 #include <time.h>
+#include <string.h>
+
+#define i { srand(23); printf("%s();\n",__func__); }
 
 //Catch rand() calls etc...
-time_t time(time_t *tloc) { srand(23); return (time_t)0; }
-int rand(void) {       srand(23); return 23; }
-long int random(void) {        srand(23); return 23; }
-int rand_r(unsigned int *seedp) { srand(23); return 23; }
-int random_r(struct random_data *buf, int32_t *result) { srand(23); return 23; }
+int rand(void) { i; return 23; }
+long int random(void) { i; return 23; }
+int rand_r(unsigned int *seedp) { i; return 23; }
+int random_r(struct random_data *buf, int32_t *result) { i; return 23; }
+//Time
+time_t time(time_t *tloc) { i; return (time_t)0; }
+int clock_gettime(clockid_t clk_id, struct timespec *tp) { i; tp->tv_nsec=0; tp->tv_sec=0; return (time_t)0; }
+//OpenSSL (not working i guess...)
+int RAND_bytes(unsigned char *buf, int num) { i; memset(buf, 23, (size_t) num); return 23; }
+int RAND_pseudo_bytes(unsigned char *buf, int num) { i; memset(buf, 23, (size_t) num); return 23; }
+int FIPS_rand_bytes(unsigned char *buf, int num) { i; memset(buf, 23, (size_t) num); return 23; }
+int FIPS_rand_pseudo_bytes(unsigned char *buf, int num) { i; memset(buf, 23, (size_t) num); return 23; }
+//IDs
+pid_t getpid(void) { i; return (pid_t)0; }
+uid_t getuid(void) { i; return (uid_t)0; }
+gid_t getgid(void) { i; return (gid_t)0; }
+uid_t geteuid(void) { i; return (uid_t)0; }
+gid_t getegid(void) { i; return (gid_t)0; }
 
 //Catch open() calls (while redirecting filename):
 static const char *redirect_name(const char *name)
This page took 0.196595 seconds and 4 git commands to generate.