aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Solignac <gsoligna@cisco.com>2022-04-13 15:52:05 +0200
committerBeno�t Ganne <bganne@cisco.com>2022-04-13 16:50:03 +0000
commite1fd3903efe38880a45687299a414b1516994955 (patch)
treea9ec32e77a465576bb8042ac730b18240ee2f526
parent6da774015491418918f74ad20ffba12c5152ec06 (diff)
crypto-openssl: use getrandom syscall
The sys/random.h header, which provides the getrandom syscall wrapper, was only added in glibc2.25. To make it compatible with older version, we can directly call the syscall. Type: improvement Signed-off-by: Guillaume Solignac <gsoligna@cisco.com> Change-Id: I93c5f8a49c0323511a4e34273f0b3c0e24663bfd
-rw-r--r--src/plugins/crypto_openssl/main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/crypto_openssl/main.c b/src/plugins/crypto_openssl/main.c
index 6843880eed0..c0f7ee206e1 100644
--- a/src/plugins/crypto_openssl/main.c
+++ b/src/plugins/crypto_openssl/main.c
@@ -15,7 +15,7 @@
*------------------------------------------------------------------
*/
-#include <sys/random.h>
+#include <sys/syscall.h>
#include <openssl/evp.h>
#include <openssl/hmac.h>
@@ -478,7 +478,7 @@ crypto_openssl_init (vlib_main_t * vm)
openssl_per_thread_data_t *ptd;
u8 seed[32];
- if (getrandom (&seed, sizeof (seed), 0) != sizeof (seed))
+ if (syscall (SYS_getrandom, &seed, sizeof (seed), 0) != sizeof (seed))
return clib_error_return_unix (0, "getrandom() failed");
RAND_seed (seed, sizeof (seed));