OLD | NEW |
1 /* crypto/rand/rand_nw.c */ | 1 /* crypto/rand/rand_nw.c */ |
2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * This package is an SSL implementation written | 5 * This package is an SSL implementation written |
6 * by Eric Young (eay@cryptsoft.com). | 6 * by Eric Young (eay@cryptsoft.com). |
7 * The implementation was written so as to conform with Netscapes SSL. | 7 * The implementation was written so as to conform with Netscapes SSL. |
8 * | 8 * |
9 * This library is free for commercial and non-commercial use as long as | 9 * This library is free for commercial and non-commercial use as long as |
10 * the following conditions are aheared to. The following conditions | 10 * the following conditions are aheared to. The following conditions |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 RAND_add(&l,sizeof(l),1); | 153 RAND_add(&l,sizeof(l),1); |
154 | 154 |
155 for( i=2; i<ENTROPY_NEEDED; i++) | 155 for( i=2; i<ENTROPY_NEEDED; i++) |
156 { | 156 { |
157 #ifdef __MWERKS__ | 157 #ifdef __MWERKS__ |
158 asm | 158 asm |
159 { | 159 { |
160 rdtsc | 160 rdtsc |
161 mov tsc, eax | 161 mov tsc, eax |
162 } | 162 } |
163 #else | 163 #elif defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(O
PENSSL_NO_INLINE_ASM) |
164 asm volatile("rdtsc":"=A" (tsc)); | 164 asm volatile("rdtsc":"=a"(tsc)::"edx"); |
165 #endif | 165 #endif |
166 | 166 |
167 RAND_add(&tsc, sizeof(tsc), 1); | 167 RAND_add(&tsc, sizeof(tsc), 1); |
168 | 168 |
169 l = GetSuperHighResolutionTimer(); | 169 l = GetSuperHighResolutionTimer(); |
170 RAND_add(&l, sizeof(l), 0); | 170 RAND_add(&l, sizeof(l), 0); |
171 | 171 |
172 # if defined(NETWARE_LIBC) | 172 # if defined(NETWARE_LIBC) |
173 NXThreadYield(); | 173 NXThreadYield(); |
174 # else /* NETWARE_CLIB */ | 174 # else /* NETWARE_CLIB */ |
175 ThreadSwitchWithDelay(); | 175 ThreadSwitchWithDelay(); |
176 # endif | 176 # endif |
177 } | 177 } |
178 | 178 |
179 return 1; | 179 return 1; |
180 } | 180 } |
181 | 181 |
182 #endif | 182 #endif |
183 | 183 |
OLD | NEW |