X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Frand%2Frand_nw.c;h=8d5b8d2e3217f438a4030308528112c872a7403c;hb=32cf5baeae21774db04af2ad2d74567a617c6fec;hp=0ff884783e103aec091f747f9c50b3459d28dfee;hpb=4d8743f490a5f96fa26d41985ee12cb6b9815a4c;p=oweals%2Fopenssl.git diff --git a/crypto/rand/rand_nw.c b/crypto/rand/rand_nw.c index 0ff884783e..8d5b8d2e32 100644 --- a/crypto/rand/rand_nw.c +++ b/crypto/rand/rand_nw.c @@ -1,4 +1,4 @@ -/* crypto/rand/rand_win.c */ +/* crypto/rand/rand_nw.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -116,10 +116,16 @@ #if defined (OPENSSL_SYS_NETWARE) #if defined(NETWARE_LIBC) -#include +#include +#else +#include #endif -extern long RunningProcess; +extern int GetProcessSwitchCount(void); +#if !defined(NETWARE_LIBC) || (CURRENT_NDK_THRESHOLD < 509220000) +extern void *RunningProcess; /* declare here same as found in newer NDKs */ +extern unsigned long GetSuperHighResolutionTimer(void); +#endif /* the FAQ indicates we need to provide at least 20 bytes (160 bits) of seed */ @@ -142,23 +148,29 @@ int RAND_poll(void) l = GetProcessSwitchCount(); RAND_add(&l,sizeof(l),1); - l=RunningProcess; + /* need to cast the void* to unsigned long here */ + l = (unsigned long)RunningProcess; RAND_add(&l,sizeof(l),1); for( i=2; i=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) + asm volatile("rdtsc":"=a"(tsc)::"edx"); +#endif + RAND_add(&tsc, sizeof(tsc), 1); l = GetSuperHighResolutionTimer(); RAND_add(&l, sizeof(l), 0); # if defined(NETWARE_LIBC) - NXThreadYield(); + NXThreadYield(); # else /* NETWARE_CLIB */ ThreadSwitchWithDelay(); # endif