File tree Expand file tree Collapse file tree 2 files changed +3
-21
lines changed Expand file tree Collapse file tree 2 files changed +3
-21
lines changed Original file line number Diff line number Diff line change 26
26
#include < openssl/evp.h>
27
27
#include < openssl/aes.h>
28
28
#include < openssl/err.h>
29
+ #include < openssl/rand.h>
29
30
30
31
#ifdef HAVE_ERR_remove_thread_state
31
32
#define ERR_remove_state (X ) ERR_remove_thread_state(NULL )
@@ -292,31 +293,11 @@ unsigned int my_aes_ctx_size(enum my_aes_mode)
292
293
return MY_AES_CTX_SIZE;
293
294
}
294
295
295
- #ifdef HAVE_YASSL
296
- #include < random.hpp>
297
- int my_random_bytes (uchar* buf, int num)
298
- {
299
- TaoCrypt::RandomNumberGenerator rand;
300
- rand.GenerateBlock ((TaoCrypt::byte*) buf, num);
301
- return MY_AES_OK;
302
- }
303
- #else
304
- #include < openssl/rand.h>
305
-
306
296
int my_random_bytes (uchar *buf, int num)
307
297
{
308
- /*
309
- Unfortunately RAND_bytes manual page does not provide any guarantees
310
- in relation to blocking behavior. Here we explicitly use SSLeay random
311
- instead of whatever random engine is currently set in OpenSSL. That way
312
- we are guaranteed to have a non-blocking random.
313
- */
314
- RAND_METHOD *rand = RAND_SSLeay ();
315
- if (rand == NULL || rand->bytes (buf, num) != 1 )
298
+ if (RAND_bytes (buf, num) != 1 )
316
299
return MY_AES_OPENSSL_ERROR;
317
300
return MY_AES_OK;
318
301
}
319
- #endif
320
302
321
303
}
322
-
Original file line number Diff line number Diff line change 26
26
#include " aes.hpp"
27
27
28
28
using yaSSL::yaERR_remove_state;
29
+ using yaSSL::yaRAND_bytes;
29
30
30
31
#define EVP_CIPH_ECB_MODE 0x1
31
32
#define EVP_CIPH_CBC_MODE 0x2
You can’t perform that action at this time.
0 commit comments