aboutsummaryrefslogtreecommitdiff
path: root/aes.c
diff options
context:
space:
mode:
Diffstat (limited to 'aes.c')
-rw-r--r--aes.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/aes.c b/aes.c
index c10589e..4eec962 100644
--- a/aes.c
+++ b/aes.c
@@ -94,16 +94,23 @@ char* aes_crypt_s(aes_ctx_t* ctx, char* input, size_t siz, size_t* newsiz, bool
return output;
}
-static uint64_t __rdtsc(void)
+#ifdef __i386__
+static uint64_t __rnd(void)
{
unsigned int lo, hi;
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
return ((uint64_t)hi << 32) | lo;
}
+#else
+static uint64_t __rnd(void)
+{
+ return 0;
+}
+#endif
static void __pseudoRandom(unsigned char* buf, size_t siz)
{
- time_t seed = time(NULL) + __rdtsc();
+ time_t seed = time(NULL) + __rnd();
for (size_t i = 0; i < siz; ++i) {
buf[i] = (unsigned char)((seed * time(NULL)) % 256);