From 65754014c7ac58cba252fd5070d147f3c76477bf Mon Sep 17 00:00:00 2001 From: Torben Hansen <50673096+torben-hansen@users.noreply.github.com> Date: Fri, 8 Nov 2024 14:37:26 -0800 Subject: [PATCH] Add personalization string callback to match description --- crypto/fipsmodule/rand/entropy/entropy_sources.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crypto/fipsmodule/rand/entropy/entropy_sources.c b/crypto/fipsmodule/rand/entropy/entropy_sources.c index 651adcfac5..a97bd6b581 100644 --- a/crypto/fipsmodule/rand/entropy/entropy_sources.c +++ b/crypto/fipsmodule/rand/entropy/entropy_sources.c @@ -20,6 +20,13 @@ static int entropy_get_prediction_resistance( return 1; } +static int entropy_get_personalization_string( + const struct entropy_source_t *entropy_source, + uint8_t personalization_string[CTR_DRBG_ENTROPY_LEN]) { + CRYPTO_sysrand(personalization_string, CTR_DRBG_ENTROPY_LEN); + return 1; +} + // - Tree DRBG with Jitter Entropy as root for seeding. // - OS as personalization string source. // - If run-time is on an Intel CPU and it supports rdrand, use it as a source @@ -29,7 +36,7 @@ DEFINE_LOCAL_DATA(struct entropy_source_methods, tree_jitter_entropy_source_meth out->zeroize_thread = tree_jitter_zeroize_thread_drbg; out->free_thread = tree_jitter_free_thread_drbg; out->get_seed = tree_jitter_get_seed; - out->get_personalization_string = NULL; + out->get_personalization_string = entropy_get_personalization_string; if (have_fast_rdrand() == 1) { out->get_prediction_resistance = entropy_get_prediction_resistance; } else {