From: Eugene Syromiatnikov Date: Fri, 11 Jul 2025 12:49:22 +0000 (+0200) Subject: Document OPENSSL_MALLOC_SEED environment variable X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f531a742df6c0808d2310d15e78579916f118d1;p=thirdparty%2Fopenssl.git Document OPENSSL_MALLOC_SEED environment variable Add its mention to doc/man3/OPENSSL_malloc.pod, doc/man7/openssl-env.pod, and util/other.syms. Also, reorder the variable order in doc/man7/openssl-env.pod to a lexicographical one. Complements: 3df5736cf303 "Improve Malloc Failure Test" Signed-off-by: Eugene Syromiatnikov Reviewed-by: Neil Horman Reviewed-by: Tomas Mraz Reviewed-by: Dmitry Belyavskiy (Merged from https://github.com/openssl/openssl/pull/28025) --- diff --git a/doc/man3/OPENSSL_malloc.pod b/doc/man3/OPENSSL_malloc.pod index ec6556b765c..fd97b9aa962 100644 --- a/doc/man3/OPENSSL_malloc.pod +++ b/doc/man3/OPENSSL_malloc.pod @@ -18,7 +18,8 @@ CRYPTO_get_alloc_counts, CRYPTO_set_mem_debug, CRYPTO_mem_ctrl, CRYPTO_mem_leaks, CRYPTO_mem_leaks_fp, CRYPTO_mem_leaks_cb, OPENSSL_MALLOC_FAILURES, -OPENSSL_MALLOC_FD +OPENSSL_MALLOC_FD, +OPENSSL_MALLOC_SEED - Memory allocation functions =head1 SYNOPSIS @@ -69,6 +70,7 @@ OPENSSL_MALLOC_FD env OPENSSL_MALLOC_FAILURES=... env OPENSSL_MALLOC_FD=... + env OPENSSL_MALLOC_SEED=... The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining B with a suitable version value, @@ -155,9 +157,9 @@ with CRYPTO_set_mem_functions(), it's recommended to swap them all out at once. If the library is built with the C option, then one -function, CRYPTO_get_alloc_counts(), and two additional environment -variables, B and B, -are available. +function, CRYPTO_get_alloc_counts(), and three additional environment +variables, B, B, +and B, are available. The function CRYPTO_get_alloc_counts() fills in the number of times each of CRYPTO_malloc(), CRYPTO_realloc(), and CRYPTO_free() have been @@ -172,8 +174,9 @@ as a floating point number that is rounded up to two decimal digits of precision, defaulting to 100). If the count is zero, then it lasts forever. For example, C<100;@0.258> or C<100@0;0@0.258> means the first 100 allocations pass, then all other allocations (until the program exits or crashes) have -a 0.26% chance of failing. The length of the value of B -must be 256 or fewer characters. +a 0.26% chance of failing, with random(3) used as a source of randomness. +The length of the value of B must be 256 or fewer +characters. If the variable B is parsed as a positive integer, then it is taken as an open file descriptor. This is used in conjunction with @@ -189,6 +192,10 @@ work on all platforms): export OPENSSL_MALLOC_FD ...app invocation... 3>/tmp/log$$ +If the environment variable B is set, its value +is interpreted as an integer using atoi(3) and supplied to the srandom(3) +call for the random number generator initialisation. + =head1 RETURN VALUES OPENSSL_malloc_init(), OPENSSL_free(), OPENSSL_clear_free() diff --git a/doc/man7/openssl-env.pod b/doc/man7/openssl-env.pod index 9251f31020b..2f4ea5f61c7 100644 --- a/doc/man7/openssl-env.pod +++ b/doc/man7/openssl-env.pod @@ -46,7 +46,7 @@ See L. Specifies the directory from which dynamic engines are loaded. See L. -=item B, B +=item B, B, B If built with debugging, this allows memory allocation to fail. See L. diff --git a/util/other.syms b/util/other.syms index bc4d6576f30..e74cd099c75 100644 --- a/util/other.syms +++ b/util/other.syms @@ -10,6 +10,7 @@ OPENSSL_s390xcap environment OPENSSL_sparcv9cap environment OPENSSL_MALLOC_FD environment OPENSSL_MALLOC_FAILURES environment +OPENSSL_MALLOC_SEED environment OPENSSL_instrument_bus assembler OPENSSL_instrument_bus2 assembler #