From: Teshan Kannangara <90088670+TeshanK@users.noreply.github.com> Date: Sat, 8 Nov 2025 14:13:09 +0000 (+0530) Subject: rand_lib.c: Use ERR_LIB_RAND with RAND_R errors X-Git-Tag: 3.6-PRE-CLANG-FORMAT-WEBKIT~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5df6ed158edefa30d377aade838e58e9387f47e6;p=thirdparty%2Fopenssl.git rand_lib.c: Use ERR_LIB_RAND with RAND_R errors Use ERR_LIB_RAND when reporting RAND_R_ALREADY_INSTANTIATED from RAND_set_DRBG_type() and RAND_set_seed_source_type() so the error message references the RAND subsystem instead of CRYPTO. Fixes #29039 CLA: trivial Reviewed-by: Eugene Syromiatnikov Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/29109) (cherry picked from commit e7251fa1a92bcb1fda1dad7f7e2e3ed2c0056e27) --- diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c index c0f5c9effd1..0c62109de96 100644 --- a/crypto/rand/rand_lib.c +++ b/crypto/rand/rand_lib.c @@ -1058,7 +1058,7 @@ int RAND_set_DRBG_type(OSSL_LIB_CTX *ctx, const char *drbg, const char *propq, if (dgbl == NULL) return 0; if (dgbl->primary != NULL) { - ERR_raise(ERR_LIB_CRYPTO, RAND_R_ALREADY_INSTANTIATED); + ERR_raise(ERR_LIB_RAND, RAND_R_ALREADY_INSTANTIATED); return 0; } return random_set_string(&dgbl->rng_name, drbg) @@ -1075,7 +1075,7 @@ int RAND_set_seed_source_type(OSSL_LIB_CTX *ctx, const char *seed, if (dgbl == NULL) return 0; if (dgbl->seed != NULL) { - ERR_raise(ERR_LIB_CRYPTO, RAND_R_ALREADY_INSTANTIATED); + ERR_raise(ERR_LIB_RAND, RAND_R_ALREADY_INSTANTIATED); return 0; } return random_set_string(&dgbl->seed_name, seed)