]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Document OPENSSL_MALLOC_SEED environment variable
authorEugene Syromiatnikov <esyr@openssl.org>
Fri, 11 Jul 2025 12:49:22 +0000 (14:49 +0200)
committerNeil Horman <nhorman@openssl.org>
Tue, 29 Jul 2025 17:12:10 +0000 (13:12 -0400)
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 <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28025)

doc/man3/OPENSSL_malloc.pod
doc/man7/openssl-env.pod
util/other.syms

index ec6556b765c864e049ab79afd2b0f442b2761ece..fd97b9aa962864f0532f2e67a5ab276a5dcd926e 100644 (file)
@@ -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=... <application>
  env OPENSSL_MALLOC_FD=... <application>
+ env OPENSSL_MALLOC_SEED=... <application>
 
 The following functions have been deprecated since OpenSSL 3.0, and can be
 hidden entirely by defining B<OPENSSL_API_COMPAT> 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<crypto-mdebug> option, then one
-function, CRYPTO_get_alloc_counts(), and two additional environment
-variables, B<OPENSSL_MALLOC_FAILURES> and B<OPENSSL_MALLOC_FD>,
-are available.
+function, CRYPTO_get_alloc_counts(), and three additional environment
+variables, B<OPENSSL_MALLOC_FAILURES>, B<OPENSSL_MALLOC_FD>,
+and B<OPENSSL_MALLOC_SEED>, 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<OPENSSL_MALLOC_FAILURES>
-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<OPENSSL_MALLOC_FAILURES> must be 256 or fewer
+characters.
 
 If the variable B<OPENSSL_MALLOC_FD> 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<OPENSSL_MALLOC_SEED> 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()
index 9251f31020b1843917c6775ffdd8e9f520e25057..2f4ea5f61c7ade5fadef291d90485f51f4d299da 100644 (file)
@@ -46,7 +46,7 @@ See L<CA.pl(1)>.
 Specifies the directory from which dynamic engines are loaded.
 See L<openssl-engine(1)>.
 
-=item B<OPENSSL_MALLOC_FD>, B<OPENSSL_MALLOC_FAILURES>
+=item B<OPENSSL_MALLOC_FAILURES>, B<OPENSSL_MALLOC_FD>, B<OPENSSL_MALLOC_SEED>
 
 If built with debugging, this allows memory allocation to fail.
 See L<OPENSSL_malloc(3)>.
index bc4d6576f3056e5057c7a5f214897e3843f1b70b..e74cd099c754a38f1e6ef52fc70c6a52eb291a28 100644 (file)
@@ -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
 #