From: Tomas Mudrunka Date: Tue, 11 Feb 2014 03:34:54 +0000 (+0100) Subject: Troll23 improvements X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=b9a41889280efffe1d21fb094e175f0f204ea039;p=mirrors%2FPrograms.git Troll23 improvements --- diff --git a/c/troll23/troll23.c b/c/troll23/troll23.c index f1822e0..6d004d4 100644 --- a/c/troll23/troll23.c +++ b/c/troll23/troll23.c @@ -4,15 +4,32 @@ #include #include #include +#include #include #include +#include + +#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)