Line 0
Link Here
|
|
|
1 |
--- mysys_ssl/my_crypt.cc.orig 2016-08-29 16:38:54.000000000 +0200 |
2 |
+++ mysys_ssl/my_crypt.cc 2016-10-17 19:14:45.146531847 +0200 |
3 |
@@ -275,10 +275,14 @@ |
4 |
return MY_AES_OK; |
5 |
} |
6 |
#else |
7 |
+#include <openssl/opensslv.h> |
8 |
#include <openssl/rand.h> |
9 |
|
10 |
int my_random_bytes(uchar *buf, int num) |
11 |
{ |
12 |
+#if defined(LIBRESSL_VERSION_NUMBER) |
13 |
+ arc4random_buf(buf, num); |
14 |
+#else |
15 |
/* |
16 |
Unfortunately RAND_bytes manual page does not provide any guarantees |
17 |
in relation to blocking behavior. Here we explicitly use SSLeay random |
18 |
@@ -288,6 +292,7 @@ |
19 |
RAND_METHOD *rand = RAND_SSLeay(); |
20 |
if (rand == NULL || rand->bytes(buf, num) != 1) |
21 |
return MY_AES_OPENSSL_ERROR; |
22 |
+#endif |
23 |
return MY_AES_OK; |
24 |
} |
25 |
#endif |