aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2023-12-22 14:04:29 +0100
committerFlorin Coras <florin.coras@gmail.com>2023-12-22 16:49:57 +0000
commit7e452ba15cade36feb864b8570401f14fa8503e3 (patch)
treee7c4ca69439e6ed429f627a0bf7660c1ac4ee440 /src
parentb1454f89b595f480ee0ae23174ae9ab9a78100ef (diff)
quic: seed random generator during init
Quic does not seed random value, so if the plugin is loaded separately RAND_bytes will fail. Type: fix Change-Id: If600cbde1fef30afb6316fc1a355261b008c3191 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/quic/quic.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index a728d2a86f9..88e3277a160 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -14,6 +14,9 @@
*/
#include <sys/socket.h>
+#include <sys/syscall.h>
+
+#include <openssl/rand.h>
#include <vnet/session/application.h>
#include <vnet/session/transport.h>
@@ -2507,6 +2510,11 @@ quic_init (vlib_main_t * vm)
u64 options[APP_OPTIONS_N_OPTIONS];
quic_main_t *qm = &quic_main;
u32 num_threads, i;
+ u8 seed[32];
+
+ if (syscall (SYS_getrandom, &seed, sizeof (seed), 0) != sizeof (seed))
+ return clib_error_return_unix (0, "getrandom() failed");
+ RAND_seed (seed, sizeof (seed));
num_threads = 1 /* main thread */ + vtm->n_threads;