mem functions cleanup
authorRich Salz <rsalz@openssl.org>
Thu, 7 Jan 2016 20:06:38 +0000 (15:06 -0500)
committerRich Salz <rsalz@openssl.org>
Thu, 7 Jan 2016 20:14:18 +0000 (15:14 -0500)
Only two macros CRYPTO_MDEBUG and CRYPTO_MDEBUG_ABORT to control this.
If CRYPTO_MDEBUG is not set, #ifdef out the whole debug machinery.
        (Thanks to Jakob Bohm for the suggestion!)
Make the "change wrapper functions" be the only paradigm.
Wrote documentation!
Format the 'set func' functions so their paramlists are legible.
Format some multi-line comments.
Remove ability to get/set the "memory debug" functions at runtme.
Remove MemCheck_* and CRYPTO_malloc_debug_init macros.
Add CRYPTO_mem_debug(int flag) function.
Add test/memleaktest.
Rename CRYPTO_malloc_init to OPENSSL_malloc_init; remove needless calls.

Reviewed-by: Richard Levitte <levitte@openssl.org>
49 files changed:
CHANGES
Configurations/10-main.conf
Configure
apps/openssl.c
crypto/cms/Makefile
crypto/ct/Makefile
crypto/dh/Makefile
crypto/dsa/Makefile
crypto/ec/Makefile
crypto/engine/eng_dyn.c
crypto/mem.c
crypto/mem_dbg.c
crypto/mem_sec.c
crypto/objects/Makefile
crypto/objects/o_names.c
crypto/rsa/Makefile
crypto/x509/Makefile
demos/selfsign.c
doc/apps/dhparam.pod
doc/crypto/OPENSSL_malloc.pod [new file with mode: 0644]
doc/crypto/OPENSSL_secure_malloc.pod
doc/ssl/ssl.pod
engines/ccgost/Makefile
include/openssl/crypto.h
include/openssl/engine.h
ssl/Makefile
ssl/ssl_ciph.c
ssl/ssl_err.c
test/Makefile
test/Makefile.orig [new file with mode: 0644]
test/asynctest.c
test/clienthellotest.c
test/danetest.c
test/dhtest.c
test/dsatest.c
test/ecdhtest.c
test/ecdsatest.c
test/ectest.c
test/enginetest.c
test/evp_extra_test.c
test/jpaketest.c
test/memleaktest.c [new file with mode: 0644]
test/p5_crpt2_test.c
test/recipes/90-test_memleak.t [new file with mode: 0644]
test/rsa_test.c
test/srptest.c
test/ssltest.c
test/verify_extra_test.c
util/libeay.num

diff --git a/CHANGES b/CHANGES
index b4cc2d4c93e1c8db7cacda042d07b7d9f7f3adcd..31fe88a9ab51664ccd9f39dfd9d92191adcce684 100644 (file)
--- a/CHANGES
+++ b/CHANGES
 
      [Richard Levitte]
 
+  *) Revamped memory debug; only -DCRYPTO_MDEBUG and -DCRYPTO_MDEBUG_ABORT
+     are used; the latter aborts on memory leaks (usually checked on exit).
+     Some undocumented "set malloc, etc., hooks" functions were removed
+     and others were changed.  All are now documented.
+     [Rich Salz]
+
   *) In DSA_generate_parameters_ex, if the provided seed is too short,
      return an error
      [Rich Salz and Ismo Puustinen <ismo.puustinen@intel.com>]
index a82b95db6406d5630a0149014f97e89bafed7fa4..4bd4366514fd2c15640f29d67536793896b3a433 100644 (file)
         # -mcpu=ultrasparc
         inherit_from     => [ "solaris-sparcv7-gcc", asm("sparcv9_asm") ],
         cflags           => sub { join(" ","-m32 -mcpu=ultrasparc",@_); },
-        debug_cflags     => "-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -DPEDANTIC -O -g -pedantic -ansi -Wshadow -Wno-long-long -D__EXTENSIONS__",
+        debug_cflags     => "-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -O -g -pedantic -ansi -Wshadow -Wno-long-long -D__EXTENSIONS__",
     },
     "solaris64-sparcv9-gcc" => {
         inherit_from     => [ "solaris-sparcv9-gcc" ],
         inherit_from     => [ "solaris-common" ],
         cc               => "cc",
         cflags           => sub { join(" ","-xstrconst -Xa -DB_ENDIAN -DBN_DIV2W",@_) },
-        debug_cflags     => "-g -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL",
+        debug_cflags     => "-g -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG",
         release_cflags   => "-xO5 -xdepend",
         thread_cflag     => "-D_REENTRANT",
         lflags           => sub { join(" ",@_,"-mt -lpthread") },
index ee8987ebcab7861a61e696b3da6d6adfb4df3106..07bb98be0a8f34712865ebb8239c7a069589dc17 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -97,7 +97,7 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimenta
 # Minimum warning options... any contributions to OpenSSL should at least get
 # past these.
 
-my $gcc_devteam_warn = "-Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Wtype-limits -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DDEBUG_UNUSED";
+my $gcc_devteam_warn = "-Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Wtype-limits -Werror -DCRYPTO_MDEBUG -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DDEBUG_UNUSED";
 
 # These are used in addition to $gcc_devteam_warn when the compiler is clang.
 # TODO(openssl-team): fix problems and investigate if (at least) the
index f2c7ccf0c481d636083d0efc9a50fc86ea3e0311..d21988e77fd1ff1cdcb084adc3c1ca5f5583574b 100644 (file)
@@ -171,7 +171,6 @@ static int apps_startup()
 #ifdef SIGPIPE
     signal(SIGPIPE, SIG_IGN);
 #endif
-    CRYPTO_malloc_init();
     ERR_load_crypto_strings();
     ERR_load_SSL_strings();
 
@@ -311,15 +310,8 @@ int main(int argc, char *argv[])
 #endif
 
     p = getenv("OPENSSL_DEBUG_MEMORY");
-    if (p == NULL)
-        /* if not set, use compiled-in default */
-        ;
-    else if (strcmp(p, "off") != 0) {
-        CRYPTO_malloc_debug_init();
-        CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
-    } else {
-        CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0);
-    }
+    if (p != NULL && strcmp(p, "on") == 0)
+        CRYPTO_set_mem_debug(1);
     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
     CRYPTO_set_locking_callback(lock_dbg_cb);
 
@@ -437,7 +429,9 @@ int main(int argc, char *argv[])
     BIO_free(bio_in);
     BIO_free_all(bio_out);
     apps_shutdown();
+#ifdef CRYPTO_MDEBUG
     CRYPTO_mem_leaks(bio_err);
+#endif
     BIO_free(bio_err);
     return (ret);
 }
index 832c73111479852147465c0c484b7efb2afcd910..e18e9ad07a6f5ba81730ef66ebaf645967278a1e 100644 (file)
@@ -160,15 +160,16 @@ cms_env.o: ../include/internal/asn1_int.h ../include/internal/cryptlib.h
 cms_env.o: cms_env.c cms_lcl.h
 cms_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
 cms_err.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
-cms_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
-cms_err.o: ../../include/openssl/ec.h ../../include/openssl/err.h
-cms_err.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
-cms_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-cms_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
-cms_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-cms_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-cms_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-cms_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+cms_err.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+cms_err.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+cms_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+cms_err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+cms_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+cms_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+cms_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+cms_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+cms_err.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+cms_err.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
 cms_err.o: cms_err.c
 cms_ess.o: ../../e_os.h ../../include/openssl/asn1.h
 cms_ess.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
@@ -188,17 +189,18 @@ cms_ess.o: ../../include/openssl/x509v3.h ../include/internal/cryptlib.h
 cms_ess.o: cms_ess.c cms_lcl.h
 cms_io.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
 cms_io.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-cms_io.o: ../../include/openssl/cms.h ../../include/openssl/crypto.h
-cms_io.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-cms_io.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-cms_io.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-cms_io.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
-cms_io.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-cms_io.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
-cms_io.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
-cms_io.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-cms_io.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-cms_io.o: ../../include/openssl/x509_vfy.h cms_io.c cms_lcl.h
+cms_io.o: ../../include/openssl/cms.h ../../include/openssl/conf.h
+cms_io.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+cms_io.o: ../../include/openssl/ec.h ../../include/openssl/err.h
+cms_io.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+cms_io.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+cms_io.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
+cms_io.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
+cms_io.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
+cms_io.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+cms_io.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+cms_io.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+cms_io.o: ../../include/openssl/x509v3.h cms_io.c cms_lcl.h
 cms_kari.o: ../../e_os.h ../../include/openssl/aes.h
 cms_kari.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
 cms_kari.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
index 49771d9681ed627aad8a575424dbcc0c523b66d2..e4fb65b77c4f672ca749830153ed053f0bd0b05d 100644 (file)
@@ -70,7 +70,8 @@ ct_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 ct_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 ct_err.o: ../../include/openssl/symhacks.h ../include/internal/ct_int.h
 ct_err.o: ct_err.c
-ct_lib.o: ../../e_os.h ../../include/openssl/asn1.h
+ct_lib.o: ../../e_os.h ../../include/internal/dane.h
+ct_lib.o: ../../include/internal/numbers.h ../../include/openssl/asn1.h
 ct_lib.o: ../../include/openssl/async.h ../../include/openssl/bio.h
 ct_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 ct_lib.o: ../../include/openssl/comp.h ../../include/openssl/crypto.h
index 757ccf01fe0adc4588ce1e320196c6dc951e8501..86e3c2c6b186c1d0b69fd15523f5e61388c04d18 100644 (file)
@@ -65,17 +65,19 @@ clean:
 dh_ameth.o: ../../e_os.h ../../include/openssl/asn1.h
 dh_ameth.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
 dh_ameth.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
-dh_ameth.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
-dh_ameth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-dh_ameth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-dh_ameth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-dh_ameth.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+dh_ameth.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+dh_ameth.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
+dh_ameth.o: ../../include/openssl/ec.h ../../include/openssl/err.h
+dh_ameth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+dh_ameth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+dh_ameth.o: ../../include/openssl/opensslconf.h
 dh_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 dh_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 dh_ameth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 dh_ameth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-dh_ameth.o: ../../include/openssl/x509_vfy.h ../include/internal/asn1_int.h
-dh_ameth.o: ../include/internal/cryptlib.h dh_ameth.c
+dh_ameth.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+dh_ameth.o: ../include/internal/asn1_int.h ../include/internal/cryptlib.h
+dh_ameth.o: dh_ameth.c
 dh_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
 dh_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 dh_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
@@ -121,15 +123,16 @@ dh_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 dh_gen.o: ../include/internal/cryptlib.h dh_gen.c
 dh_kdf.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 dh_kdf.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
-dh_kdf.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
-dh_kdf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-dh_kdf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
-dh_kdf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-dh_kdf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
-dh_kdf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-dh_kdf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-dh_kdf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-dh_kdf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+dh_kdf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+dh_kdf.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
+dh_kdf.o: ../../include/openssl/ec.h ../../include/openssl/evp.h
+dh_kdf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+dh_kdf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+dh_kdf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+dh_kdf.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+dh_kdf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+dh_kdf.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+dh_kdf.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
 dh_kdf.o: dh_kdf.c
 dh_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
 dh_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
index 5f4fb520e184a9f4bdf364c16e331ce502c2c2e5..796d8a3fdc016edbbc0d56d10d647ed876d9bde7 100644 (file)
@@ -65,18 +65,19 @@ clean:
 dsa_ameth.o: ../../e_os.h ../../include/openssl/asn1.h
 dsa_ameth.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
 dsa_ameth.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
-dsa_ameth.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
-dsa_ameth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-dsa_ameth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-dsa_ameth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-dsa_ameth.o: ../../include/openssl/objects.h
+dsa_ameth.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+dsa_ameth.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+dsa_ameth.o: ../../include/openssl/ec.h ../../include/openssl/err.h
+dsa_ameth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+dsa_ameth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 dsa_ameth.o: ../../include/openssl/opensslconf.h
 dsa_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 dsa_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 dsa_ameth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 dsa_ameth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-dsa_ameth.o: ../../include/openssl/x509_vfy.h ../include/internal/asn1_int.h
-dsa_ameth.o: ../include/internal/cryptlib.h dsa_ameth.c
+dsa_ameth.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+dsa_ameth.o: ../include/internal/asn1_int.h ../include/internal/cryptlib.h
+dsa_ameth.o: dsa_ameth.c
 dsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
 dsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 dsa_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
index 79338985629337ced5213e2e85736f303db6367c..5abe95819749002ec85c387d91d4df058cf2e5c0 100644 (file)
@@ -118,17 +118,19 @@ ec2_smpl.o: ec2_smpl.c ec_lcl.h
 ec_ameth.o: ../../e_os.h ../../include/openssl/asn1.h
 ec_ameth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 ec_ameth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-ec_ameth.o: ../../include/openssl/cms.h ../../include/openssl/crypto.h
-ec_ameth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-ec_ameth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-ec_ameth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-ec_ameth.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+ec_ameth.o: ../../include/openssl/cms.h ../../include/openssl/conf.h
+ec_ameth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+ec_ameth.o: ../../include/openssl/ec.h ../../include/openssl/err.h
+ec_ameth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+ec_ameth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+ec_ameth.o: ../../include/openssl/opensslconf.h
 ec_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 ec_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 ec_ameth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 ec_ameth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-ec_ameth.o: ../../include/openssl/x509_vfy.h ../include/internal/asn1_int.h
-ec_ameth.o: ../include/internal/cryptlib.h ec_ameth.c
+ec_ameth.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+ec_ameth.o: ../include/internal/asn1_int.h ../include/internal/cryptlib.h
+ec_ameth.o: ec_ameth.c
 ec_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
 ec_asn1.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
 ec_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
index 23f01cfc35c6574cf475c16e0c70c69bd62f2337..d19cab2ecf84d442bd2b8f6515d81ef2f00c315b 100644 (file)
@@ -506,8 +506,6 @@ static int dynamic_load(ENGINE *e, dynamic_data_ctx *ctx)
      * would also increase opaqueness.
      */
     fns.static_state = ENGINE_get_static_state();
-    CRYPTO_get_mem_functions(&fns.mem_fns.malloc_cb,
-                             &fns.mem_fns.realloc_cb, &fns.mem_fns.free_cb);
     fns.lock_fns.lock_locking_cb = CRYPTO_get_locking_callback();
     fns.lock_fns.lock_add_lock_cb = CRYPTO_get_add_lock_callback();
     fns.lock_fns.dynlock_create_cb = CRYPTO_get_dynlock_create_callback();
index 939ad69775ec73f0c51967492f40300b6531eeeb..ec9efea7160ee3a564b373343b45893fa8cac5af 100644 (file)
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <limits.h>
 #include <openssl/crypto.h>
 #include "internal/cryptlib.h"
 
-static int allow_customize = 1; /* we provide flexible functions for */
-static int allow_customize_debug = 1; /* exchanging memory-related functions
-                                       * at run-time, but this must be done
-                                       * before any blocks are actually
-                                       * allocated; or we'll run into huge
-                                       * problems when malloc/free pairs
-                                       * don't match etc. */
-
 /*
  * the following pointers may be changed as long as 'allow_customize' is set
  */
+static int allow_customize = 1;
 
-static void *(*malloc_func) (size_t) = malloc;
-static void *default_malloc_ex(size_t num, const char *file, int line)
-{
-    return malloc_func(num);
-}
-
-static void *(*malloc_ex_func) (size_t, const char *file, int line)
-    = default_malloc_ex;
-
-static void *(*realloc_func) (void *, size_t) = realloc;
-static void *default_realloc_ex(void *str, size_t num,
-                                const char *file, int line)
-{
-    return realloc_func(str, num);
-}
-
-static void *(*realloc_ex_func) (void *, size_t, const char *file, int line)
-    = default_realloc_ex;
-
-static void (*free_func) (void *) = free;
-
-static void *(*malloc_secure_func)(size_t) = malloc;
-static void *default_malloc_secure_ex(size_t num, const char *file, int line)
-{
-    return malloc_secure_func(num);
-}
-static void *(*malloc_secure_ex_func)(size_t, const char *file, int line)
-    = default_malloc_secure_ex;
-static void (*free_secure_func)(void *) = free;
+static void *(*malloc_wrapper)(size_t, const char *, int)
+    = CRYPTO_malloc;
+static void *(*realloc_wrapper)(void *, size_t, const char *, int)
+    = CRYPTO_realloc;
+static void (*free_wrapper)(void *)
+    = CRYPTO_free;
 
-/* may be changed as long as 'allow_customize_debug' is set */
-/* XXX use correct function pointer types */
 #ifdef CRYPTO_MDEBUG
-/* use default functions from mem_dbg.c */
-static void (*malloc_debug_func) (void *, size_t, const char *, int, int)
-    = CRYPTO_dbg_malloc;
-static void (*realloc_debug_func) (void *, void *, size_t, const char *, int,
-                                   int)
-    = CRYPTO_dbg_realloc;
-static void (*free_debug_func) (void *, int) = CRYPTO_dbg_free;
-static void (*set_debug_options_func) (long) = CRYPTO_dbg_set_options;
-static long (*get_debug_options_func) (void) = CRYPTO_dbg_get_options;
+static int call_malloc_debug = 1;
 #else
-/*
- * applications can use CRYPTO_malloc_debug_init() to select above case at
- * run-time
- */
-static void (*malloc_debug_func) (void *, size_t, const char *, int, int) = NULL;
-static void (*realloc_debug_func) (void *, void *, size_t, const char *, int,
-                                   int)
-    = NULL;
-static void (*free_debug_func) (void *, int) = NULL;
-static void (*set_debug_options_func) (long) = NULL;
-static long (*get_debug_options_func) (void) = NULL;
+static int call_malloc_debug = 0;
 #endif
 
-int CRYPTO_set_mem_functions(void *(*m) (size_t), void *(*r) (void *, size_t),
-                             void (*f) (void *))
-{
-    /* Dummy call just to ensure OPENSSL_init() gets linked in */
-    OPENSSL_init();
-    if (!allow_customize)
-        return 0;
-    if ((m == 0) || (r == 0) || (f == 0))
-        return 0;
-    malloc_func = m;
-    malloc_ex_func = default_malloc_ex;
-    realloc_func = r;
-    realloc_ex_func = default_realloc_ex;
-    free_func = f;
-    /* If user wants to intercept the secure or locked functions, do it
-     * after the basic functions. */
-    malloc_secure_func = m;
-    malloc_secure_ex_func = default_malloc_secure_ex;
-    free_secure_func = f;
-    return 1;
-}
-
-int CRYPTO_set_mem_ex_functions(void *(*m) (size_t, const char *, int),
-                                void *(*r) (void *, size_t, const char *,
-                                            int), void (*f) (void *))
-{
-    if (!allow_customize)
-        return 0;
-    if ((m == 0) || (r == 0) || (f == 0))
-        return 0;
-    malloc_func = 0;
-    malloc_ex_func = m;
-    realloc_func = 0;
-    realloc_ex_func = r;
-    free_func = f;
-    malloc_secure_func = 0;
-    malloc_secure_ex_func = m;
-    free_secure_func = f;
-    return 1;
-}
-
-int CRYPTO_set_secure_mem_functions(void *(*m)(size_t), void (*f)(void *))
+int CRYPTO_set_mem_functions(
+        void *(*m)(size_t, const char *, int),
+        void *(*r)(void *, size_t, const char *, int),
+        void (*f)(void *))
 {
-    /* Dummy call just to ensure OPENSSL_init() gets linked in */
-    OPENSSL_init();
     if (!allow_customize)
         return 0;
-    if ((m == 0) || (f == 0))
-        return 0;
-    malloc_secure_func = m;
-    malloc_secure_ex_func = default_malloc_secure_ex;
-    free_secure_func = f;
+    if (m)
+        malloc_wrapper = m;
+    if (r)
+        realloc_wrapper = r;
+    if (f)
+        free_wrapper = f;
     return 1;
 }
 
-int CRYPTO_set_secure_mem_ex_functions(void *(*m)(size_t, const char *, int),
-                                       void (*f)(void *))
+int CRYPTO_set_mem_debug(int flag)
 {
     if (!allow_customize)
         return 0;
-    if ((m == NULL) || (f == NULL))
-        return 0;
-    malloc_secure_func = 0;
-    malloc_secure_ex_func = m;
-    free_secure_func = f;
-    return 1;
-}
-
-int CRYPTO_set_mem_debug_functions(void (*m) (void *, size_t,
-                                              const char *, int, int),
-                                   void (*r) (void *, void *, size_t,
-                                              const char *, int, int),
-                                   void (*f) (void *, int), void (*so) (long),
-                                   long (*go) (void))
-{
-    if (!allow_customize_debug)
-        return 0;
-    malloc_debug_func = m;
-    realloc_debug_func = r;
-    free_debug_func = f;
-    set_debug_options_func = so;
-    get_debug_options_func = go;
+    call_malloc_debug = flag;
     return 1;
 }
 
-void CRYPTO_get_mem_functions(void *(**m) (size_t),
-                              void *(**r) (void *, size_t),
-                              void (**f) (void *))
+void CRYPTO_get_mem_functions(
+        void *(**m)(size_t, const char *, int),
+        void *(**r)(void *, size_t, const char *, int),
+        void (**f)(void *))
 {
     if (m != NULL)
-        *m = (malloc_ex_func == default_malloc_ex) ? malloc_func : 0;
+        *m = malloc_wrapper;
     if (r != NULL)
-        *r = (realloc_ex_func == default_realloc_ex) ? realloc_func : 0;
-    if (f != NULL)
-        *f = free_func;
-}
-
-void CRYPTO_get_mem_ex_functions(void *(**m) (size_t, const char *, int),
-                                 void *(**r) (void *, size_t, const char *,
-                                              int), void (**f) (void *))
-{
-    if (m != NULL)
-        *m = (malloc_ex_func != default_malloc_ex) ? malloc_ex_func : 0;
-    if (r != NULL)
-        *r = (realloc_ex_func != default_realloc_ex) ? realloc_ex_func : 0;
-    if (f != NULL)
-        *f = free_func;
-}
-
-void CRYPTO_get_secure_mem_functions(void *(**m)(size_t), void (**f)(void *))
-{
-    if (m != NULL)
-        *m = (malloc_secure_ex_func == default_malloc_secure_ex) ?
-            malloc_secure_func : 0;
+        *r = realloc_wrapper;
     if (f != NULL)
-        *f=free_secure_func;
-}
-
-void CRYPTO_get_secure_mem_ex_functions(void *(**m)(size_t,const char *,int),
-                                        void (**f)(void *))
-{
-    if (m != NULL)
-        *m = (malloc_secure_ex_func != default_malloc_secure_ex) ?
-            malloc_secure_ex_func : 0;
-    if (f != NULL)
-        *f=free_secure_func;
-}
-
-void CRYPTO_get_mem_debug_functions(void (**m) (void *, size_t,
-                                                const char *, int, int),
-                                    void (**r) (void *, void *, size_t,
-                                                const char *, int, int),
-                                    void (**f) (void *, int),
-                                    void (**so) (long), long (**go) (void))
-{
-    if (m != NULL)
-        *m = malloc_debug_func;
-    if (r != NULL)
-        *r = realloc_debug_func;
-    if (f != NULL)
-        *f = free_debug_func;
-    if (so != NULL)
-        *so = set_debug_options_func;
-    if (go != NULL)
-        *go = get_debug_options_func;
+        *f = free_wrapper;
 }
 
 void *CRYPTO_malloc(size_t num, const char *file, int line)
@@ -283,16 +124,20 @@ void *CRYPTO_malloc(size_t num, const char *file, int line)
     if (num <= 0)
         return NULL;
 
-    if (allow_customize)
-        allow_customize = 0;
-    if (malloc_debug_func != NULL) {
-        if (allow_customize_debug)
-            allow_customize_debug = 0;
-        malloc_debug_func(NULL, num, file, line, 0);
+    allow_customize = 0;
+#ifdef CRYPTO_MDEBUG
+    if (call_malloc_debug) {
+        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);
+        ret = malloc(num);
+        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);
+    } else {
+        ret = malloc(num);
     }
-    ret = malloc_ex_func(num, file, line);
-    if (malloc_debug_func != NULL)
-        malloc_debug_func(ret, num, file, line, 1);
+#else
+    (void)file;
+    (void)line;
+    ret = malloc(num);
+#endif
 
 #ifndef OPENSSL_CPUID_OBJ
     /*
@@ -320,21 +165,29 @@ void *CRYPTO_zalloc(size_t num, const char *file, int line)
 
 void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
 {
-    void *ret = NULL;
-
     if (str == NULL)
         return CRYPTO_malloc(num, file, line);
 
-    if (num <= 0)
+    if (num == 0) {
+        CRYPTO_free(str);
         return NULL;
+    }
 
-    if (realloc_debug_func != NULL)
-        realloc_debug_func(str, NULL, num, file, line, 0);
-    ret = realloc_ex_func(str, num, file, line);
-    if (realloc_debug_func != NULL)
-        realloc_debug_func(str, ret, num, file, line, 1);
+    allow_customize = 0;
+#ifdef CRYPTO_MDEBUG
+    if (call_malloc_debug) {
+        void *ret;
+        CRYPTO_mem_debug_realloc(str, NULL, num, 0, file, line);
+        ret = realloc(str, num);
+        CRYPTO_mem_debug_realloc(str, ret, num, 1, file, line);
+        return ret;
+    }
+#else
+    (void)file;
+    (void)line;
+#endif
+    return realloc(str, num);
 
-    return ret;
 }
 
 void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,
@@ -345,56 +198,59 @@ void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,
     if (str == NULL)
         return CRYPTO_malloc(num, file, line);
 
-    if (num <= 0)
+    if (num == 0) {
+        CRYPTO_clear_free(str, old_len);
         return NULL;
+    }
 
-    /*
-     * We don't support shrinking the buffer. Note the memcpy that copies
-     * |old_len| bytes to the new buffer, below.
-     */
-    if (num < old_len)
-        return NULL;
+    /* Can't shrink the buffer since memcpy below copies |old_len| bytes. */
+    if (num < old_len) {
+        memset((char*)str + num, 0, old_len - num);
+        return str;
+    }
 
-    if (realloc_debug_func != NULL)
-        realloc_debug_func(str, NULL, num, file, line, 0);
-    ret = malloc_ex_func(num, file, line);
-    if (ret) {
-        memcpy(ret, str, old_len);
-        OPENSSL_clear_free(str, old_len);
+    /* Allocate new memory.  Call malloc and do a copy, so that we can
+     * cleanse the old buffer. */
+#ifdef CRYPTO_MDEBUG
+    if (call_malloc_debug) {
+        CRYPTO_mem_debug_realloc(str, NULL, num, 0, file, line);
+        ret = malloc(num);
+        CRYPTO_mem_debug_realloc(str, ret, num, 1, file, line);
+    } else {
+        ret = malloc(num);
     }
-    if (realloc_debug_func != NULL)
-        realloc_debug_func(str, ret, num, file, line, 1);
+#else
+    (void)file;
+    (void)line;
+    ret = malloc(num);
+#endif
 
+    if (ret)
+        memcpy(ret, str, old_len);
+    CRYPTO_clear_free(str, old_len);
     return ret;
 }
 
 void CRYPTO_free(void *str)
 {
-    if (free_debug_func != NULL)
-        free_debug_func(str, 0);
-    free_func(str);
-    if (free_debug_func != NULL)
-        free_debug_func(NULL, 1);
+#ifdef CRYPTO_MDEBUG
+    if (call_malloc_debug) {
+        CRYPTO_mem_debug_free(str, 0);
+        free(str);
+        CRYPTO_mem_debug_free(str, 1);
+    } else {
+        free(str);
+    }
+#else
+    free(str);
+#endif
 }
 
 void CRYPTO_clear_free(void *str, size_t num)
 {
-    if (!str)
+    if (str == NULL)
         return;
     if (num)
         OPENSSL_cleanse(str, num);
     CRYPTO_free(str);
 }
-
-void CRYPTO_set_mem_debug_options(long bits)
-{
-    if (set_debug_options_func != NULL)
-        set_debug_options_func(bits);
-}
-
-long CRYPTO_get_mem_debug_options(void)
-{
-    if (get_debug_options_func != NULL)
-        return get_debug_options_func();
-    return 0;
-}
index 924652a6cb02d078b5e698ee55756af4af3b4b7e..2132b7da5c336080c9910e7ae81252be8a49a017 100644 (file)
 # include <execinfo.h>
 #endif
 
-static int mh_mode = CRYPTO_MEM_CHECK_OFF;
 /*
  * The state changes to CRYPTO_MEM_CHECK_ON | CRYPTO_MEM_CHECK_ENABLE when
  * the application asks for it (usually after library initialisation for
@@ -133,14 +132,15 @@ static int mh_mode = CRYPTO_MEM_CHECK_OFF;
  * checking temporarily. State CRYPTO_MEM_CHECK_ENABLE without ..._ON makes
  * no sense whatsoever.
  */
+static int mh_mode = CRYPTO_MEM_CHECK_OFF;
 
+#ifdef CRYPTO_MDEBUG
 static unsigned long order = 0; /* number of memory requests */
 
 DECLARE_LHASH_OF(MEM);
 static LHASH_OF(MEM) *mh = NULL; /* hash-table of memory requests (address as
                                   * key); access requires MALLOC2 lock */
 
-typedef struct app_mem_info_st
 /*-
  * For application-defined information (static C-string `info')
  * to be displayed in memory leak list.
@@ -148,7 +148,7 @@ typedef struct app_mem_info_st
  *   OPENSSL_mem_debug_push("...")     to push an entry,
  *   OPENSSL_mem_debug_pop()     to pop an entry,
  */
-{
+typedef struct app_mem_info_st {
     CRYPTO_THREADID threadid;
     const char *file;
     int line;
@@ -157,18 +157,16 @@ typedef struct app_mem_info_st
     int references;
 } APP_INFO;
 
-static void app_info_free(APP_INFO *);
-
+/*
+ * hash-table with those app_mem_info_st's that are at the
+ * top of their thread's stack (with `thread' as key); access requires
+ * MALLOC2 lock
+ */
 DECLARE_LHASH_OF(APP_INFO);
-static LHASH_OF(APP_INFO) *amih = NULL; /* hash-table with those
-                                         * app_mem_info_st's that are at the
-                                         * top of their thread's stack (with
-                                         * `thread' as key); access requires
-                                         * MALLOC2 lock */
+static LHASH_OF(APP_INFO) *amih = NULL;
 
-typedef struct mem_st
 /* memory-block description */
-{
+typedef struct mem_st {
     void *addr;
     int num;
     const char *file;
@@ -183,17 +181,8 @@ typedef struct mem_st
 #endif
 } MEM;
 
-static long options =           /* extra information to be recorded */
-#if defined(CRYPTO_MDEBUG_TIME) || defined(CRYPTO_MDEBUG_ALL)
-    V_CRYPTO_MDEBUG_TIME |
-#endif
-#if defined(CRYPTO_MDEBUG_THREAD) || defined(CRYPTO_MDEBUG_ALL)
-    V_CRYPTO_MDEBUG_THREAD |
-#endif
-    0;
-
-static unsigned int num_disable = 0; /* num_disable > 0 iff mh_mode ==
-                                      * CRYPTO_MEM_CHECK_ON (w/o ..._ENABLE) */
+/* num_disable > 0 iff mh_mode == CRYPTO_MEM_CHECK_ON (w/o ..._ENABLE) */
+static unsigned int num_disable = 0;
 
 /*
  * Valid iff num_disable > 0.  CRYPTO_LOCK_MALLOC2 is locked exactly in this
@@ -210,29 +199,32 @@ static void app_info_free(APP_INFO *inf)
         OPENSSL_free(inf);
     }
 }
+#endif
 
 int CRYPTO_mem_ctrl(int mode)
 {
+#ifndef CRYPTO_MDEBUG
+    return mode - mode;
+#else
     int ret = mh_mode;
 
     CRYPTO_w_lock(CRYPTO_LOCK_MALLOC);
     switch (mode) {
-        /*
-         * for applications (not to be called while multiple threads use the
-         * library):
-         */
-    case CRYPTO_MEM_CHECK_ON:  /* aka MemCheck_start() */
+    default:
+        break;
+
+    case CRYPTO_MEM_CHECK_ON:
         mh_mode = CRYPTO_MEM_CHECK_ON | CRYPTO_MEM_CHECK_ENABLE;
         num_disable = 0;
         break;
-    case CRYPTO_MEM_CHECK_OFF: /* aka MemCheck_stop() */
+
+    case CRYPTO_MEM_CHECK_OFF:
         mh_mode = 0;
-        num_disable = 0;        /* should be true *before* MemCheck_stop is
-                                 * used, or there'll be a lot of confusion */
+        num_disable = 0;
         break;
 
-        /* switch off temporarily (for library-internal use): */
-    case CRYPTO_MEM_CHECK_DISABLE: /* aka MemCheck_off() */
+    /* switch off temporarily (for library-internal use): */
+    case CRYPTO_MEM_CHECK_DISABLE:
         if (mh_mode & CRYPTO_MEM_CHECK_ON) {
             CRYPTO_THREADID cur;
             CRYPTO_THREADID_current(&cur);
@@ -262,7 +254,8 @@ int CRYPTO_mem_ctrl(int mode)
             num_disable++;
         }
         break;
-    case CRYPTO_MEM_CHECK_ENABLE: /* aka MemCheck_on() */
+
+    case CRYPTO_MEM_CHECK_ENABLE:
         if (mh_mode & CRYPTO_MEM_CHECK_ON) {
             if (num_disable) {  /* always true, or something is going wrong */
                 num_disable--;
@@ -273,15 +266,15 @@ int CRYPTO_mem_ctrl(int mode)
             }
         }
         break;
-
-    default:
-        break;
     }
     CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC);
     return (ret);
+#endif
 }
 
-int CRYPTO_is_mem_check_on(void)
+#ifdef CRYPTO_MDEBUG
+
+static int mem_check_on(void)
 {
     int ret = 0;
 
@@ -298,16 +291,6 @@ int CRYPTO_is_mem_check_on(void)
     return (ret);
 }
 
-void CRYPTO_dbg_set_options(long bits)
-{
-    options = bits;
-}
-
-long CRYPTO_dbg_get_options(void)
-{
-    return options;
-}
-
 static int mem_cmp(const MEM *a, const MEM *b)
 {
 #ifdef _WIN64
@@ -388,17 +371,14 @@ int CRYPTO_mem_debug_push(const char *info, const char *file, int line)
     APP_INFO *ami, *amim;
     int ret = 0;
 
-    if (is_MemCheck_on()) {
-        MemCheck_off();         /* obtain MALLOC2 lock */
+    if (mem_check_on()) {
+        CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
 
-        if ((ami = OPENSSL_malloc(sizeof(*ami))) == NULL) {
-            ret = 0;
+        if ((ami = OPENSSL_malloc(sizeof(*ami))) == NULL)
             goto err;
-        }
         if (amih == NULL) {
             if ((amih = lh_APP_INFO_new()) == NULL) {
                 OPENSSL_free(ami);
-                ret = 0;
                 goto err;
             }
         }
@@ -412,8 +392,9 @@ int CRYPTO_mem_debug_push(const char *info, const char *file, int line)
 
         if ((amim = lh_APP_INFO_insert(amih, ami)) != NULL)
             ami->next = amim;
+        ret = 1;
  err:
-        MemCheck_on();          /* release MALLOC2 lock */
+        CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
     }
 
     return (ret);
@@ -423,20 +404,18 @@ int CRYPTO_mem_debug_pop(void)
 {
     int ret = 0;
 
-    if (is_MemCheck_on()) {     /* _must_ be true, or something went severely
-                                 * wrong */
-        MemCheck_off();         /* obtain MALLOC2 lock */
-
+    if (mem_check_on()) {
+        CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
         ret = (pop_info() != NULL);
-
-        MemCheck_on();          /* release MALLOC2 lock */
+        CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
     }
     return (ret);
 }
 
 static unsigned long break_order_num = 0;
-void CRYPTO_dbg_malloc(void *addr, size_t num, const char *file, int line,
-                       int before_p)
+
+void CRYPTO_mem_debug_malloc(void *addr, size_t num, int before_p,
+                             const char *file, int line)
 {
     MEM *m, *mm;
     APP_INFO tmp, *amim;
@@ -448,12 +427,11 @@ void CRYPTO_dbg_malloc(void *addr, size_t num, const char *file, int line,
         if (addr == NULL)
             break;
 
-        if (is_MemCheck_on()) {
-            MemCheck_off();     /* make sure we hold MALLOC2 lock */
+        if (mem_check_on()) {
+            CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
             if ((m = OPENSSL_malloc(sizeof(*m))) == NULL) {
                 OPENSSL_free(addr);
-                MemCheck_on();  /* release MALLOC2 lock if num_disabled drops
-                                 * to 0 */
+                CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
                 return;
             }
             if (mh == NULL) {
@@ -469,23 +447,17 @@ void CRYPTO_dbg_malloc(void *addr, size_t num, const char *file, int line,
             m->file = file;
             m->line = line;
             m->num = num;
-            if (options & V_CRYPTO_MDEBUG_THREAD)
-                CRYPTO_THREADID_current(&m->threadid);
-            else
-                memset(&m->threadid, 0, sizeof(m->threadid));
+            CRYPTO_THREADID_current(&m->threadid);
 
             if (order == break_order_num) {
                 /* BREAK HERE */
                 m->order = order;
             }
             m->order = order++;
-            if (options & V_CRYPTO_MDEBUG_TIME)
-                m->time = time(NULL);
-            else
-                m->time = 0;
-#if defined(CRYPTO_MDEBUG_BACKTRACE) && defined(__GNUC__)
+# if defined(CRYPTO_MDEBUG_BACKTRACE) && defined(__GNUC__)
             m->array_siz = backtrace(m->array, OSSL_NELEM(m->array));
-#endif
+# endif
+            m->time = time(NULL);
 
             CRYPTO_THREADID_current(&tmp.threadid);
             m->app_info = NULL;
@@ -503,15 +475,14 @@ void CRYPTO_dbg_malloc(void *addr, size_t num, const char *file, int line,
                 OPENSSL_free(mm);
             }
  err:
-            MemCheck_on();      /* release MALLOC2 lock if num_disabled drops
-                                 * to 0 */
+            CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
         }
         break;
     }
     return;
 }
 
-void CRYPTO_dbg_free(void *addr, int before_p)
+void CRYPTO_mem_debug_free(void *addr, int before_p)
 {
     MEM m, *mp;
 
@@ -520,8 +491,8 @@ void CRYPTO_dbg_free(void *addr, int before_p)
         if (addr == NULL)
             break;
 
-        if (is_MemCheck_on() && (mh != NULL)) {
-            MemCheck_off();     /* make sure we hold MALLOC2 lock */
+        if (mem_check_on() && (mh != NULL)) {
+            CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
 
             m.addr = addr;
             mp = lh_MEM_delete(mh, &m);
@@ -530,8 +501,7 @@ void CRYPTO_dbg_free(void *addr, int before_p)
                 OPENSSL_free(mp);
             }
 
-            MemCheck_on();      /* release MALLOC2 lock if num_disabled drops
-                                 * to 0 */
+            CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
         }
         break;
     case 1:
@@ -539,8 +509,8 @@ void CRYPTO_dbg_free(void *addr, int before_p)
     }
 }
 
-void CRYPTO_dbg_realloc(void *addr1, void *addr2, size_t num,
-                        const char *file, int line, int before_p)
+void CRYPTO_mem_debug_realloc(void *addr1, void *addr2, size_t num,
+                              int before_p, const char *file, int line)
 {
     MEM m, *mp;
 
@@ -552,12 +522,12 @@ void CRYPTO_dbg_realloc(void *addr1, void *addr2, size_t num,
             break;
 
         if (addr1 == NULL) {
-            CRYPTO_dbg_malloc(addr2, num, file, line, 128 | before_p);
+            CRYPTO_mem_debug_malloc(addr2, num, 128 | before_p, file, line);
             break;
         }
 
-        if (is_MemCheck_on()) {
-            MemCheck_off();     /* make sure we hold MALLOC2 lock */
+        if (mem_check_on()) {
+            CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
 
             m.addr = addr1;
             mp = lh_MEM_delete(mh, &m);
@@ -570,8 +540,7 @@ void CRYPTO_dbg_realloc(void *addr1, void *addr2, size_t num,
                 (void)lh_MEM_insert(mh, mp);
             }
 
-            MemCheck_on();      /* release MALLOC2 lock if num_disabled drops
-                                 * to 0 */
+            CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
         }
         break;
     }
@@ -602,23 +571,18 @@ static void print_leak_doall_arg(const MEM *m, MEM_LEAK *l)
         return;
     }
 
-    if (options & V_CRYPTO_MDEBUG_TIME) {
-        lcl = localtime(&m->time);
-
-        BIO_snprintf(bufp, BUF_REMAIN, "[%02d:%02d:%02d] ",
-                     lcl->tm_hour, lcl->tm_min, lcl->tm_sec);
-        bufp += strlen(bufp);
-    }
+    lcl = localtime(&m->time);
+    BIO_snprintf(bufp, BUF_REMAIN, "[%02d:%02d:%02d] ",
+                 lcl->tm_hour, lcl->tm_min, lcl->tm_sec);
+    bufp += strlen(bufp);
 
     BIO_snprintf(bufp, BUF_REMAIN, "%5lu file=%s, line=%d, ",
                  m->order, m->file, m->line);
     bufp += strlen(bufp);
 
-    if (options & V_CRYPTO_MDEBUG_THREAD) {
-        BIO_snprintf(bufp, BUF_REMAIN, "thread=%lu, ",
-                     CRYPTO_THREADID_hash(&m->threadid));
-        bufp += strlen(bufp);
-    }
+    BIO_snprintf(bufp, BUF_REMAIN, "thread=%lu, ",
+                 CRYPTO_THREADID_hash(&m->threadid));
+    bufp += strlen(bufp);
 
     BIO_snprintf(bufp, BUF_REMAIN, "number=%d, address=%p\n",
                  m->num, m->addr);
@@ -631,6 +595,7 @@ static void print_leak_doall_arg(const MEM *m, MEM_LEAK *l)
 
     amip = m->app_info;
     ami_cnt = 0;
+
     if (amip) {
         CRYPTO_THREADID_cpy(&ti, &amip->threadid);
 
@@ -666,9 +631,9 @@ static void print_leak_doall_arg(const MEM *m, MEM_LEAK *l)
     {
         size_t i;
         char **strings = backtrace_symbols(m->array, m->array_siz);
+
         for (i = 0; i < m->array_siz; i++)
             fprintf(stderr, "##> %s\n", strings[i]);
-
         free(strings);
     }
 #endif
@@ -683,7 +648,7 @@ void CRYPTO_mem_leaks(BIO *b)
     if (mh == NULL && amih == NULL)
         return;
 
-    MemCheck_off();             /* obtain MALLOC2 lock */
+    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
 
     ml.bio = b;
     ml.bytes = 0;
@@ -698,29 +663,23 @@ void CRYPTO_mem_leaks(BIO *b)
     }
     if (ml.chunks != 0) {
         BIO_printf(b, "%ld bytes leaked in %d chunks\n", ml.bytes, ml.chunks);
-#ifdef CRYPTO_MDEBUG_ABORT
+# ifdef CRYPTO_MDEBUG_ABORT
         abort();
-#endif
+# endif
     } else {
         /*
          * Make sure that, if we found no leaks, memory-leak debugging itself
          * does not introduce memory leaks (which might irritate external
          * debugging tools). (When someone enables leak checking, but does not
-         * call this function, we declare it to be their fault.) XXX This
-         * should be in CRYPTO_mem_leaks_cb, and CRYPTO_mem_leaks should be
-         * implemented by using CRYPTO_mem_leaks_cb. (Also there should be a
-         * variant of lh_doall_arg that takes a function pointer instead of a
-         * void *; this would obviate the ugly and illegal void_fn_to_char
-         * kludge in CRYPTO_mem_leaks_cb. Otherwise the code police will come
-         * and get us.)
+         * call this function, we declare it to be their fault.)
          */
         int old_mh_mode;
 
         CRYPTO_w_lock(CRYPTO_LOCK_MALLOC);
 
         /*
-         * avoid deadlock when lh_free() uses CRYPTO_dbg_free(), which uses
-         * CRYPTO_is_mem_check_on
+         * avoid deadlock when lh_free() uses CRYPTO_mem_debug_free(), which uses
+         * mem_check_on
          */
         old_mh_mode = mh_mode;
         mh_mode = CRYPTO_MEM_CHECK_OFF;
@@ -737,10 +696,10 @@ void CRYPTO_mem_leaks(BIO *b)
         mh_mode = old_mh_mode;
         CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC);
     }
-    MemCheck_on();              /* release MALLOC2 lock */
+    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
 }
 
-#ifndef OPENSSL_NO_STDIO
+# ifndef OPENSSL_NO_STDIO
 void CRYPTO_mem_leaks_fp(FILE *fp)
 {
     BIO *b;
@@ -752,49 +711,15 @@ void CRYPTO_mem_leaks_fp(FILE *fp)
      * we're creating them at a time when we're trying to check we've not
      * left anything un-free()'d!!
      */
-    MemCheck_off();
+    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
     b = BIO_new(BIO_s_file());
-    MemCheck_on();
+    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
     if (b == NULL)
         return;
     BIO_set_fp(b, fp, BIO_NOCLOSE);
     CRYPTO_mem_leaks(b);
     BIO_free(b);
 }
-#endif
-
-/*
- * FIXME: We really don't allow much to the callback.  For example, it has no
- * chance of reaching the info stack for the item it processes.  Should it
- * really be this way? -- Richard Levitte
- */
-/*
- * NB: The prototypes have been typedef'd to CRYPTO_MEM_LEAK_CB inside
- * crypto.h If this code is restructured, remove the callback type if it is
- * no longer needed. -- Geoff Thorpe
- */
-
-/*
- * Can't pass CRYPTO_MEM_LEAK_CB directly to lh_MEM_doall_arg because it is a
- * function pointer and conversion to void * is prohibited. Instead pass its
- * address
- */
-
-typedef CRYPTO_MEM_LEAK_CB *PCRYPTO_MEM_LEAK_CB;
-
-static void cb_leak_doall_arg(const MEM *m, PCRYPTO_MEM_LEAK_CB *cb)
-{
-    (*cb) (m->order, m->file, m->line, m->num, m->addr);
-}
+# endif
 
-static IMPLEMENT_LHASH_DOALL_ARG_FN(cb_leak, const MEM, PCRYPTO_MEM_LEAK_CB)
-
-void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb)
-{
-    if (mh == NULL)
-        return;
-    CRYPTO_w_lock(CRYPTO_LOCK_MALLOC2);
-    lh_MEM_doall_arg(mh, LHASH_DOALL_ARG_FN(cb_leak), PCRYPTO_MEM_LEAK_CB,
-                     &cb);
-    CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC2);
-}
+#endif
index 4ef8300e942579431c62f23c26796b0ce5b82ff6..5f4f733fd06f3f11f5871be37a7c25e39d5cd224 100644 (file)
@@ -148,6 +148,15 @@ int CRYPTO_secure_allocated(const void *ptr)
 #endif /* IMPLEMENTED */
 }
 
+size_t CRYPTO_secure_used()
+{
+#ifdef IMPLEMENTED
+    return secure_mem_used;
+#else
+    return 0;
+#endif /* IMPLEMENTED */
+}
+
 /* END OF PAGE ...
 
    ... START OF PAGE */
index d6ccb8a23537edff46435131c23563adfc978a7b..f413b0f47219ce909cda31c18c8b1f3c88c5f254 100644 (file)
@@ -80,7 +80,7 @@ o_names.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 o_names.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 o_names.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
 o_names.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-o_names.o: o_names.c
+o_names.o: o_names.c o_names.h
 obj_dat.o: ../../e_os.h ../../include/openssl/asn1.h
 obj_dat.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
 obj_dat.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
index aa9b400ef8c0836de5ad63404ae3d33f14d87ff4..476c3770f8f1947c5efc8385b470b8afbe1356ad 100644 (file)
@@ -55,9 +55,9 @@ int OBJ_NAME_init(void)
 {
     if (names_lh != NULL)
         return (1);
-    MemCheck_off();
+    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
     names_lh = lh_OBJ_NAME_new();
-    MemCheck_on();
+    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
     return (names_lh != NULL);
 }
 
@@ -70,9 +70,9 @@ int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *),
     NAME_FUNCS *name_funcs;
 
     if (name_funcs_stack == NULL) {
-        MemCheck_off();
+        CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
         name_funcs_stack = sk_NAME_FUNCS_new_null();
-        MemCheck_on();
+        CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
     }
     if (name_funcs_stack == NULL) {
         /* ERROR */
@@ -81,18 +81,18 @@ int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *),
     ret = names_type_num;
     names_type_num++;
     for (i = sk_NAME_FUNCS_num(name_funcs_stack); i < names_type_num; i++) {
-        MemCheck_off();
+        CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
         name_funcs = OPENSSL_zalloc(sizeof(*name_funcs));
-        MemCheck_on();
+        CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
         if (name_funcs == NULL) {
             OBJerr(OBJ_F_OBJ_NAME_NEW_INDEX, ERR_R_MALLOC_FAILURE);
             return (0);
         }
         name_funcs->hash_func = lh_strhash;
         name_funcs->cmp_func = OPENSSL_strcmp;
-        MemCheck_off();
+        CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
         sk_NAME_FUNCS_push(name_funcs_stack, name_funcs);
-        MemCheck_on();
+        CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
     }
     name_funcs = sk_NAME_FUNCS_value(name_funcs_stack, ret);
     if (hash_func != NULL)
index d5a4c96c720ea242cc8104bc447fd2a01268ef6b..9c36b86d2074ab5c98a7bb740c4cd91de1fef0d6 100644 (file)
@@ -69,19 +69,19 @@ clean:
 rsa_ameth.o: ../../e_os.h ../../include/openssl/asn1.h
 rsa_ameth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 rsa_ameth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-rsa_ameth.o: ../../include/openssl/cms.h ../../include/openssl/crypto.h
-rsa_ameth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-rsa_ameth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-rsa_ameth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-rsa_ameth.o: ../../include/openssl/objects.h
+rsa_ameth.o: ../../include/openssl/cms.h ../../include/openssl/conf.h
+rsa_ameth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+rsa_ameth.o: ../../include/openssl/ec.h ../../include/openssl/err.h
+rsa_ameth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+rsa_ameth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 rsa_ameth.o: ../../include/openssl/opensslconf.h
 rsa_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 rsa_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
 rsa_ameth.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 rsa_ameth.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 rsa_ameth.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-rsa_ameth.o: ../include/internal/asn1_int.h ../include/internal/cryptlib.h
-rsa_ameth.o: rsa_ameth.c
+rsa_ameth.o: ../../include/openssl/x509v3.h ../include/internal/asn1_int.h
+rsa_ameth.o: ../include/internal/cryptlib.h rsa_ameth.c
 rsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
 rsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 rsa_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
index 766c72ae2be5957486630d7f77b0b7c02af33107..402112b6d61959bcfa49c19572fd3ca128c42ed3 100644 (file)
@@ -85,7 +85,7 @@ by_dir.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 by_dir.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 by_dir.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 by_dir.o: ../../include/openssl/x509_vfy.h ../include/internal/cryptlib.h
-by_dir.o: ../include/internal/x509_int.h by_dir.c
+by_dir.o: ../include/internal/x509_int.h by_dir.c x509_lcl.h
 by_file.o: ../../e_os.h ../../include/openssl/asn1.h
 by_file.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 by_file.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
@@ -325,13 +325,14 @@ x509_v3.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 x509_v3.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 x509_v3.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
 x509_v3.o: ../include/internal/cryptlib.h x509_lcl.h x509_v3.c
-x509_vfy.o: ../../e_os.h ../../include/openssl/asn1.h
-x509_vfy.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-x509_vfy.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
-x509_vfy.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-x509_vfy.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x509_vfy.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-x509_vfy.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+x509_vfy.o: ../../e_os.h ../../include/internal/dane.h
+x509_vfy.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
+x509_vfy.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
+x509_vfy.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+x509_vfy.o: ../../include/openssl/ec.h ../../include/openssl/err.h
+x509_vfy.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+x509_vfy.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+x509_vfy.o: ../../include/openssl/opensslconf.h
 x509_vfy.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 x509_vfy.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 x509_vfy.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
@@ -482,7 +483,7 @@ x_name.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 x_name.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 x_name.o: ../../include/openssl/x509_vfy.h ../include/internal/asn1_int.h
 x_name.o: ../include/internal/cryptlib.h ../include/internal/x509_int.h
-x_name.o: x_name.c
+x_name.o: x509_lcl.h x_name.c
 x_req.o: ../../e_os.h ../../include/openssl/asn1.h
 x_req.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 x_req.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
index 0cc265c5978528a863e99db15d91e28c15ffec2c..f0adba526785ab47bd73bbc96a3c50cde2b85332 100644 (file)
@@ -16,6 +16,7 @@ int main()
     X509 *x509 = NULL;
     EVP_PKEY *pkey = NULL;
 
+    CRYPTO_set_mem_debug(1);
     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 
     bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
index 59199358d405f42abdd55c6c5ac24a1b42b9b48d..71c61eaf6c8b6344c4c1fcefd47fc496c136bf8e 100644 (file)
@@ -103,7 +103,7 @@ this option prints out the DH parameters in human readable form.
 =item B<-C>
 
 this option converts the parameters into C code. The parameters can then
-be loaded by calling the B<get_dh>I<numbits>B<()> function.
+be loaded by calling the get_dhNNNN() function.
 
 =item B<-engine id>
 
diff --git a/doc/crypto/OPENSSL_malloc.pod b/doc/crypto/OPENSSL_malloc.pod
new file mode 100644 (file)
index 0000000..bf7c3ab
--- /dev/null
@@ -0,0 +1,162 @@
+=pod
+
+=head1 NAME
+
+OPENSSL_malloc_init,
+OPENSSL_malloc, OPENSSL_zalloc, OPENSSL_realloc, OPENSSL_free,
+OPENSSL_clear_realloc, OPENSSL_clear_free,
+CRYPTO_malloc, CRYPTO_zalloc, CRYPTO_realloc, CRYPTO_free,
+OPENSSL_strdup, OPENSSL_strndup,
+OPENSSL_memdup, OPENSSL_strlcpy, OPENSSL_strlcat,
+CRYPTO_clear_realloc, CRYPTO_clear_free,
+CRYPTO_get_mem_functions, CRYPTO_set_mem_functions,
+CRYPTO_set_mem_debug, CRYPTO_mem_ctrl,
+OPENSSL_mem_debug_push, OPENSSL_mem_debug_pop,
+CRYPTO_mem_debug_push, CRYPTO_mem_debug_pop,
+CRYPTO_mem_leaks, CRYPTO_mem_leaks_fp - Memory allocation functions
+
+=head1 SYNOPSIS
+
+ #include <openssl/crypto.h>
+
+ int OPENSSL_malloc_init(void)
+
+ void *OPENSSL_malloc(size_t num)
+ void *OPENSSL_zalloc(size_t num)
+ void *OPENSSL_realloc(void *addr, size_t num)
+ void OPENSSL_free(void *addr)
+ char *OPENSSL_strdup(const char *str)
+ char *OPENSSL_strndup(const char *str, size_t s)
+ void *OPENSSL_clear_realloc(void *p, size_t old_len, size_t num)
+ void OPENSSL_clear_free(void *str, size_t num)
+ void OPENSSL_cleanse(void *ptr, size_t len);
+
+ void *CRYPTO_malloc(size_t num, const char *file, int line)
+ void *CRYPTO_zalloc(size_t num, const char *file, int line)
+ void *CRYPTO_realloc(void *p, size_t num, const char *file, int line)
+ void CRYPTO_free(void *str)
+ char *CRYPTO_strdup(const char *p, const char *file, int line)
+ char *CRYPTO_strndup(const char *p, size_t num, const char *file, int line)
+ void *CRYPTO_clear_realloc(void *p, size_t old_len, size_t num, const char *file, int line)
+ void CRYPTO_clear_free(void *str, size_t num)
+
+ void CRYPTO_get_mem_functions(
+         void *(**m)(size_t, const char *, int),
+         void *(**r)(void *, size_t, const char *, int),
+         void (**f)(void *))
+ int CRYPTO_set_mem_functions(
+         void *(*m)(size_t, const char *, int),
+         void *(*r)(void *, size_t, const char *, int),
+         void (*f)(void *))
+
+ int CRYPTO_set_mem_debug(int onoff)
+
+ #define CRYPTO_MEM_CHECK_OFF
+ #define CRYPTO_MEM_CHECK_ON
+ #define CRYPTO_MEM_CHECK_DISABLE
+ #define CRYPTO_MEM_CHECK_ENABLE
+
+ int CRYPTO_mem_ctrl(int flags);
+
+ int OPENSSL_mem_debug_push(const char *info)
+ int OPENSLS_mem_debug_pop)(void)
+
+ int CRYPTO_mem_debug_push(const char *info, const char *file, int line);
+
+ void CRYPTO_mem_leaks(BIO *b);
+ void CRYPTO_mem_leaks(FILE *fp);
+
+=head1 DESCRIPTION
+
+OpenSSL memory allocation is handled by the B<OPENSSL_xxx> API. These are
+generally macro's that add the standard C B<__FILE__> and B<__LINE__>
+parameters and call a lower-level B<CRYPTO_xxx> API.
+Some functions do not add those parameters, but exist for consistency.
+
+OPENSSL_malloc_init() sets the lower-level memory allocation functions
+to their default implementation.
+It is generally not necessary to call this, except perhaps in certain
+shared-library situations.
+
+OPENSSL_malloc(), OPENSSL_realloc(), and OPENSSL_free() are like the
+C malloc(), realloc(), and free() functions.
+OPENSSL_zalloc() calls memset() to zero the memory before returning.
+
+OPENSSL_clear_realloc() and OPENSSL_clear_free() should be used
+when the buffer at B<addr> holds sensitive information.
+The old buffer is filled with arbitrary data by calling OPENSSL_cleanse()
+before ultimately calling OPENSSL_free().
+
+OPENSSL_strdup(), OPENSSL_strndup() and OPENSSL_memdup() are like the
+equivalent C functions, except that memory is allocated by calling the
+OPENSSL_malloc() and should be releaed by calling OPENSSL_free().
+
+OPENSSL_strlcpy(),
+OPENSSL_strlcat() and OPENSSL_strnlen() are equivalents of the common C
+library functions and are provided for portability.
+
+If no allocations have been done, it is possible to "swap out" the default
+implementations and replace them with alternate versions, or wrappers that
+do some additional housekeeping and then defer to the OpenSSL implementation.
+The CRYPTO_get_mem_functions() function fills in the function pointers for
+with the current functions (normally, and by default,
+CRYPTO_malloc(), CRYPTO_realloc(), and CRYPTO_free()).
+The CRYPTO_set_mem_functions() specifies a different set of functions.
+If any of B<m>, B<r>, or B<f> are NULL, then the function is not changed.
+
+The default implementation can include some debugging capability (if enabled
+at build-time).
+This adds some overhead by keeping a list of all memory allocations, and
+removes items from the list when they are free'd.
+This is most useful for identifying memory leaks.
+CRYPTO_set_mem_debug() turns this tracking on and off.  It is normally
+called at startup, but can be called at any time.
+
+Finer-grain control of the tracking can be done with CRYPTO_mem_ctrl().
+The most common case is to enable tracking, which is done by using
+the B<CRYPTO_MEM_CHECK_ON> constant; it can be turned off by using
+the B<CRYPTO_MEM_CHECK_OFF> value.  The disable and enable values are
+most commonly used within OpenSSL to termporarily suspend and restore
+tracking of library internals.
+
+While checking memory, it can be useful to store additional context
+about what is being done.
+For example, identifying the field names when parsing a complicated
+data structure.
+OPENSSL_mem_debug_push() (which calls CRYPTO_mem_debug_push())
+attachs an identifying string to the allocation stack.
+This must be a global or other static string; it is not copied.
+OPENSSL_mem_debug_pop() removes identifying state from the stack.
+
+At the end of the program, calling CRYPTO_mem_leaks() or
+CRYPTO_mem_leaks_fp() will
+report all "leaked" memory, writing it to the specified BIO B<b>
+or FILE B<fp>.
+Depending on how OpenSSL is built, it may then abort if there
+are any unfree'd allocations, for debugging.
+
+=head1 RETURN VALUES
+
+OPENSSL_malloc_init(), OPENSSL_free(), OPENSSL_clear_free()
+CRYPTO_free(), CRYPTO_clear_free(),
+CRYPTO_get_mem_functions(), and
+CRYPTO_mem_leaks()
+return no value.
+
+OPENSSL_malloc(), OPENSSL_zalloc(), OPENSSL_realloc(),
+OPENSSL_clear_realloc(),
+CRYPTO_malloc(), CRYPTO_zalloc(), CRYPTO_realloc(),
+CRYPTO_clear_realloc(),
+OPENSSL_strdup(), and OPENSSL_strndup()
+return a pointer to allocated memory or NULL on error.
+
+CRYPTO_set_mem_functions() and CRYPTO_set_mem_debug()
+return 1 on success or 0 on failure (almost
+always because allocations have already happened).
+
+CRYPTO_mem_ctrl() return the previous value of the flag.
+
+OPENSSL_mem_debug_push() and OPENSSL_mem_debug_pop()
+return 1 on success or 0 on failure.
+
+=cut
index 588c4b15f9a665861c9478904d25683e8af95a40..5e221e90b4a0afaebedbd4950d2bb7d2543f3c16 100644 (file)
@@ -2,7 +2,8 @@
 
 =head1 NAME
 
-CRYPTO_secure_malloc_init, CRYPTO_secure_malloc_done, OPENSSL_secure_malloc, OPENSSL_secure_free, OPENSSL_secure_allocated - use secure heap storage
+CRYPTO_secure_malloc_init, CRYPTO_secure_malloc_done, OPENSSL_secure_malloc,
+OPENSSL_secure_free, OPENSSL_secure_allocated - secure heap storage
 
 =head1 SYNOPSIS
 
@@ -15,10 +16,15 @@ CRYPTO_secure_malloc_init, CRYPTO_secure_malloc_done, OPENSSL_secure_malloc, OPE
  void CRYPTO_secure_malloc_done();
 
  void *OPENSSL_secure_malloc(int num);
+ void *CRYPTO_secure_malloc(int num, const char *file, int line);
 
  void OPENSSL_secure_free(void* ptr);
+ void CRYPTO_secure_free(void *ptr);
 
- int OPENSSL_secure_allocated(const void* ptr);
+ size_t OPENSSL_secure_actual_size(const void *ptr);
+ int OPENSSL_secure_allocated(const void *ptr);
+
+ size_t CYRPTO_secure_malloc_used();
 
 =head1 DESCRIPTION
 
@@ -49,15 +55,25 @@ to the process. It can take noticeably long to complete.
 B<OPENSSL_secure_malloc> allocates C<num> bytes from the heap.
 If B<CRYPTO_secure_malloc_init> is not called, this is equivalent to
 calling B<OPENSSL_malloc>.
+It is a macro that expands to
+B<CRYPTO_secure_malloc> and adds the B<__FILE__> and B<__LINE__> parameters.
 
 B<OPENSSL_secure_free> releases the memory at C<ptr> back to the heap.
 It must be called with a value previously obtained from
 B<OPENSSL_secure_malloc>.
 If B<CRYPTO_secure_malloc_init> is not called, this is equivalent to
 calling B<OPENSSL_free>.
+It exists for consistency with B<OPENSSL_secure_malloc> , and
+is a macro that expands to B<CRYPTO_secure_free>.
 
 B<OPENSSL_secure_allocated> tells whether or not a pointer is within
 the secure heap.
+B<OPENSSL_secure_actual_size> tells the actual size allocated to the
+pointer; implementations may allocate more space than initially
+requested, in order to "round up" and reduce secure heap fragmentation.
+
+B<CRYPTO_secure_malloc_used> returns the number of bytes allocated in the
+secure heap.
 
 =head1 RETURN VALUES
 
@@ -78,9 +94,15 @@ the secure heap, or 0 if not.
 B<CRYPTO_secure_malloc_done> and B<OPENSSL_secure_free>
 return no values.
 
+=head1 BUGS
+
+The size parameters should be B<size_t> not B<int> and will be changed
+in a future release.
+
 =head1 SEE ALSO
 
+L<OPENSSL_malloc(3)>,
 L<BN_new(3)>,
-L<bn_internal(3)>
+L<bn_internal(3)>.
 
 =cut
index bb3bc94809bc41fe29526999c51470a9d24a5ea7..0d29b54bddd36b7b3f136d647bcda9503047ee36 100644 (file)
@@ -679,6 +679,7 @@ Returns the current handshake state.
 =head1 SEE ALSO
 
 L<openssl(1)>, L<crypto(3)>,
+L<CRYPTO_get_ex_new_index(3)>,
 L<SSL_accept(3)>, L<SSL_clear(3)>,
 L<SSL_connect(3)>,
 L<SSL_CIPHER_get_name(3)>,
@@ -687,7 +688,6 @@ L<SSL_CTX_add_extra_chain_cert(3)>,
 L<SSL_CTX_add_session(3)>,
 L<SSL_CTX_ctrl(3)>,
 L<SSL_CTX_flush_sessions(3)>,
-L<SSL_CTX_get_ex_new_index(3)>,
 L<SSL_CTX_get_verify_mode(3)>,
 L<SSL_CTX_load_verify_locations(3)>
 L<SSL_CTX_new(3)>,
@@ -724,7 +724,6 @@ L<SSL_get_client_CA_list(3)>,
 L<SSL_get_default_timeout(3)>,
 L<SSL_get_error(3)>,
 L<SSL_get_ex_data_X509_STORE_CTX_idx(3)>,
-L<SSL_get_ex_new_index(3)>,
 L<SSL_get_fd(3)>,
 L<SSL_get_peer_cert_chain(3)>,
 L<SSL_get_rbio(3)>,
@@ -748,7 +747,6 @@ L<SSL_state_string(3)>,
 L<SSL_want(3)>,
 L<SSL_write(3)>,
 L<SSL_SESSION_free(3)>,
-L<SSL_SESSION_get_ex_new_index(3)>,
 L<SSL_SESSION_get_time(3)>,
 L<d2i_SSL_SESSION(3)>,
 L<SSL_CTX_set_psk_client_callback(3)>,
index eec407a6ac5c552c1f69146b4a70fa1b3a9d1eb7..a0904cdc83869793487e5ae5144df4e0b54d6762 100644 (file)
@@ -120,18 +120,19 @@ gost89.o: gost89.c gost89.h
 gost_ameth.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
 gost_ameth.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
 gost_ameth.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
-gost_ameth.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
-gost_ameth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
-gost_ameth.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-gost_ameth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
-gost_ameth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+gost_ameth.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+gost_ameth.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+gost_ameth.o: ../../include/openssl/ec.h ../../include/openssl/engine.h
+gost_ameth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+gost_ameth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+gost_ameth.o: ../../include/openssl/objects.h
 gost_ameth.o: ../../include/openssl/opensslconf.h
 gost_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 gost_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 gost_ameth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 gost_ameth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-gost_ameth.o: ../../include/openssl/x509_vfy.h e_gost_err.h gost89.h
-gost_ameth.o: gost_ameth.c gost_lcl.h gosthash.h
+gost_ameth.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+gost_ameth.o: e_gost_err.h gost89.h gost_ameth.c gost_lcl.h gosthash.h
 gost_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
 gost_asn1.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
 gost_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
index a5e5b1749b35acd4c4fe5b23c9170345e087fd95..dccb4ffca64e79a784f1010d2b988ab934b16c90 100644 (file)
@@ -222,34 +222,21 @@ extern "C" {
  * Some applications as well as some parts of OpenSSL need to allocate and
  * deallocate locks in a dynamic fashion.  The following typedef makes this
  * possible in a type-safe manner.
+ * struct CRYPTO_dynlock_value has to be defined by the application.
  */
-/* struct CRYPTO_dynlock_value has to be defined by the application. */
 typedef struct {
     int references;
     struct CRYPTO_dynlock_value *data;
 } CRYPTO_dynlock;
 
 /*
- * The following can be used to detect memory leaks in the OpenSSL library. It
+ * The following can be used to detect memory leaks in the library. If
  * used, it turns on malloc checking
  */
-
-# define CRYPTO_MEM_CHECK_OFF    0x0/* an enume */
-# define CRYPTO_MEM_CHECK_ON     0x1/* a bit */
-# define CRYPTO_MEM_CHECK_ENABLE 0x2/* a bit */
-# define CRYPTO_MEM_CHECK_DISABLE 0x3/* an enume */
-
-/*
- * The following are bit values to turn on or off options connected to the
- * malloc checking functionality
- */
-
-/* Adds time to the memory checking information */
-# define V_CRYPTO_MDEBUG_TIME    0x1/* a bit */
-/* Adds thread number to the memory checking information */
-# define V_CRYPTO_MDEBUG_THREAD  0x2/* a bit */
-
-# define V_CRYPTO_MDEBUG_ALL (V_CRYPTO_MDEBUG_TIME | V_CRYPTO_MDEBUG_THREAD)
+# define CRYPTO_MEM_CHECK_OFF     0x0
+# define CRYPTO_MEM_CHECK_ON      0x1
+# define CRYPTO_MEM_CHECK_ENABLE  0x2
+# define CRYPTO_MEM_CHECK_DISABLE 0x3
 
 /* predec of the BIO type */
 typedef struct bio_st BIO_dummy;
@@ -285,51 +272,69 @@ DEFINE_STACK_OF(void)
  * needed in Win32 where the application malloc and the library malloc may
  * not be the same.
  */
-# define CRYPTO_malloc_init()    CRYPTO_set_mem_functions(\
-        malloc, realloc, free)
-
-# if defined CRYPTO_MDEBUG_ALL || defined CRYPTO_MDEBUG_TIME || defined CRYPTO_MDEBUG_THREAD
-#  ifndef CRYPTO_MDEBUG         /* avoid duplicate #define */
-#   define CRYPTO_MDEBUG
-#  endif
-# endif
+#define OPENSSL_malloc_init() \
+    CRYPTO_set_mem_functions(CRYPTO_malloc, CRYPTO_realloc, CRYPTO_free)
 
 /*
  * Set standard debugging functions (not done by default unless CRYPTO_MDEBUG
  * is defined)
  */
-# define CRYPTO_malloc_debug_init()      do {\
-        CRYPTO_set_mem_debug_functions(\
-                CRYPTO_dbg_malloc,\
-                CRYPTO_dbg_realloc,\
-                CRYPTO_dbg_free,\
-                CRYPTO_dbg_set_options,\
-                CRYPTO_dbg_get_options);\
-        } while(0)
+# if defined CRYPTO_MDEBUG_ABORT
+#  ifndef CRYPTO_MDEBUG
+#   define CRYPTO_MDEBUG
+#  endif
+# endif
 
 int CRYPTO_mem_ctrl(int mode);
-int CRYPTO_is_mem_check_on(void);
-
-/* for applications */
-# define MemCheck_start() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON)
-# define MemCheck_stop() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF)
-
-/* for library-internal use */
-# define MemCheck_on()   CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE)
-# define MemCheck_off()  CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)
-# define is_MemCheck_on() CRYPTO_is_mem_check_on()
-
-# define OPENSSL_malloc(num)     CRYPTO_malloc((int)num, __FILE__, __LINE__)
-# define OPENSSL_zalloc(num)     CRYPTO_zalloc((int)num, __FILE__, __LINE__)
-# define OPENSSL_memdup(str, s)  CRYPTO_memdup((str), s, __FILE__, __LINE__)
-# define OPENSSL_strdup(str)     CRYPTO_strdup((str), __FILE__, __LINE__)
-# define OPENSSL_strndup(str, s) CRYPTO_strndup((str), (s), __FILE__, __LINE__)
-# define OPENSSL_realloc(addr,num) \
-        CRYPTO_realloc((char *)addr, (int)num, __FILE__, __LINE__)
-# define OPENSSL_clear_realloc(addr, old_num, num) \
+
+# ifdef CRYPTO_MDEBUG
+#  define OPENSSL_malloc(num) \
+        CRYPTO_malloc(num, __FILE__, __LINE__)
+#  define OPENSSL_zalloc(num) \
+        CRYPTO_zalloc(num, __FILE__, __LINE__)
+#  define OPENSSL_realloc(addr, num) \
+        CRYPTO_realloc(addr, num, __FILE__, __LINE__)
+#  define OPENSSL_clear_realloc(addr, old_num, num) \
         CRYPTO_clear_realloc(addr, old_num, num, __FILE__, __LINE__)
-# define OPENSSL_clear_free(addr, num) CRYPTO_clear_free(addr, num)
-# define OPENSSL_free(addr)      CRYPTO_free(addr)
+#  define OPENSSL_clear_free(addr, num) \
+        CRYPTO_clear_free(addr, num)
+#  define OPENSSL_free(addr) \
+        CRYPTO_free(addr)
+#  define OPENSSL_memdup(str, s) \
+        CRYPTO_memdup((str), s, __FILE__, __LINE__)
+#  define OPENSSL_strdup(str) \
+        CRYPTO_strdup(str, __FILE__, __LINE__)
+#  define OPENSSL_strndup(str, n) \
+        CRYPTO_strndup(str, n, __FILE__, __LINE__)
+#  define OPENSSL_secure_malloc(num) \
+        CRYPTO_secure_malloc(num, __FILE__, __LINE__)
+#  define OPENSSL_secure_free(addr) \
+        CRYPTO_secure_free(addr)
+# else
+#  define OPENSSL_malloc(num) \
+        CRYPTO_malloc(num, NULL, 0)
+#  define OPENSSL_zalloc(num) \
+        CRYPTO_zalloc(num, NULL, 0)
+#  define OPENSSL_realloc(addr, num) \
+        CRYPTO_realloc(addr, num, NULL, 0)
+#  define OPENSSL_clear_realloc(addr, old_num, num) \
+        CRYPTO_clear_realloc(addr, old_num, num, NULL, 0)
+#  define OPENSSL_clear_free(addr, num) \
+        CRYPTO_clear_free(addr, num)
+#  define OPENSSL_free(addr) \
+        CRYPTO_free(addr)
+#  define OPENSSL_memdup(str) \
+        CRYPTO_memdup(str, NULL, 0)
+#  define OPENSSL_strdup(str) \
+        CRYPTO_strdup(str, NULL, 0)
+#  define OPENSSL_strndup(str, s) \
+        CRYPTO_strndup(str, s, NULL, 0)
+#  define OPENSSL_secure_malloc(num) \
+        CRYPTO_secure_malloc(num, NULL, 0)
+#  define OPENSSL_secure_free(addr) \
+        CRYPTO_secure_free(addr)
+
+# endif
 
 size_t OPENSSL_strlcpy(char *dst, const char *src, size_t siz);
 size_t OPENSSL_strlcat(char *dst, const char *src, size_t siz);
@@ -447,29 +452,15 @@ void (*CRYPTO_get_dynlock_destroy_callback(void)) (struct CRYPTO_dynlock_value
                                                    *l, const char *file,
                                                    int line);
 
-int CRYPTO_set_mem_functions(void *(*m) (size_t), void *(*r) (void *, size_t),
-                             void (*f) (void *));
-int CRYPTO_set_mem_ex_functions(void *(*m) (size_t, const char *, int),
-                                void *(*r) (void *, size_t, const char *,
-                                            int), void (*f) (void *));
-int CRYPTO_set_mem_debug_functions(void (*m) (void *, size_t,
-                                              const char *, int, int),
-                                   void (*r) (void *, void *, size_t,
-                                              const char *, int, int),
-                                   void (*f) (void *, int), void (*so) (long),
-                                   long (*go) (void));
-void CRYPTO_get_mem_functions(void *(**m) (size_t),
-                              void *(**r) (void *, size_t),
-                              void (**f) (void *));
-void CRYPTO_get_mem_ex_functions(void *(**m) (size_t, const char *, int),
-                                 void *(**r) (void *, size_t, const char *,
-                                              int), void (**f) (void *));
-void CRYPTO_get_mem_debug_functions(void (**m) (void *, size_t,
-                                                const char *, int, int),
-                                    void (**r) (void *, void *, size_t,
-                                                const char *, int, int),
-                                    void (**f) (void *, int),
-                                    void (**so) (long), long (**go) (void));
+int CRYPTO_set_mem_functions(
+        void *(*m) (size_t, const char *, int),
+        void *(*r) (void *, size_t, const char *, int),
+        void (*f) (void *));
+int CRYPTO_set_mem_debug(int flag);
+void CRYPTO_get_mem_functions(
+        void *(**m) (size_t, const char *, int),
+        void *(**r) (void *, size_t, const char *, int),
+        void (**f) (void *));
 
 void *CRYPTO_malloc(size_t num, const char *file, int line);
 void *CRYPTO_zalloc(size_t num, const char *file, int line);
@@ -482,30 +473,16 @@ void *CRYPTO_realloc(void *addr, size_t num, const char *file, int line);
 void *CRYPTO_clear_realloc(void *addr, size_t old_num, size_t num,
                            const char *file, int line);
 
-# define OPENSSL_secure_malloc(num) \
-        CRYPTO_secure_malloc((int)num,__FILE__,__LINE__)
-# define OPENSSL_secure_free(addr) \
-        CRYPTO_secure_free(addr)
-
 int CRYPTO_secure_malloc_init(size_t sz, int minsize);
 void CRYPTO_secure_malloc_done(void);
 void *CRYPTO_secure_malloc(size_t num, const char *file, int line);
 void CRYPTO_secure_free(void *ptr);
 int CRYPTO_secure_allocated(const void *ptr);
 int CRYPTO_secure_malloc_initialized(void);
-
-int CRYPTO_set_secure_mem_functions(void *(*m)(size_t), void (*f)(void *));
-int CRYPTO_set_secure_mem_ex_functions(void *(*m)(size_t,const char *,int),
-                                       void (*f)(void *));
-void CRYPTO_get_secure_mem_functions(void *(**m)(size_t), void (**f)(void *));
-void CRYPTO_get_secure_mem_ex_functions(void *(**m)(size_t,const char *,int),
-                                        void (**f)(void *));
+size_t CRYPTO_secure_used(void);
 
 void OPENSSL_cleanse(void *ptr, size_t len);
 
-void CRYPTO_set_mem_debug_options(long bits);
-long CRYPTO_get_mem_debug_options(void);
-
 # define OPENSSL_mem_debug_push(info) \
         CRYPTO_mem_debug_push(info, __FILE__, __LINE__)
 # define OPENSSL_mem_debug_pop() \
@@ -513,41 +490,22 @@ long CRYPTO_get_mem_debug_options(void);
 int CRYPTO_mem_debug_push(const char *info, const char *file, int line);
 int CRYPTO_mem_debug_pop(void);
 
-/*
- * Default debugging functions (enabled by CRYPTO_malloc_debug_init() macro;
- * used as default in CRYPTO_MDEBUG compilations):
- */
 /*-
- * The last argument has the following significance:
- *
- * 0:   called before the actual memory allocation has taken place
- * 1:   called after the actual memory allocation has taken place
- */
-void CRYPTO_dbg_malloc(void *addr, size_t num, const char *file, int line,
-                       int before_p);
-void CRYPTO_dbg_realloc(void *addr1, void *addr2, size_t num, const char *file,
-                        int line, int before_p);
-void CRYPTO_dbg_free(void *addr, int before_p);
-/*-
- * Tell the debugging code about options.  By default, the following values
- * apply:
- *
- * 0:                           Clear all options.
- * V_CRYPTO_MDEBUG_TIME (1):    Set the "Show Time" option.
- * V_CRYPTO_MDEBUG_THREAD (2):  Set the "Show Thread Number" option.
- * V_CRYPTO_MDEBUG_ALL (3):     1 + 2
+ * Debugging functions (enabled by CRYPTO_set_mem_debug_functions(1))
+ * The flag argument has the following significance:
+ *   0:   called before the actual memory allocation has taken place
+ *   1:   called after the actual memory allocation has taken place
  */
-void CRYPTO_dbg_set_options(long bits);
-long CRYPTO_dbg_get_options(void);
+void CRYPTO_mem_debug_malloc(void *addr, size_t num, int flag,
+        const char *file, int line);
+void CRYPTO_mem_debug_realloc(void *addr1, void *addr2, size_t num, int flag,
+        const char *file, int line);
+void CRYPTO_mem_debug_free(void *addr, int flag);
 
 # ifndef OPENSSL_NO_STDIO
 void CRYPTO_mem_leaks_fp(FILE *);
 # endif
 void CRYPTO_mem_leaks(struct bio_st *bio);
-/* unsigned long order, char *file, int line, size_t num_bytes, char *addr */
-typedef void *CRYPTO_MEM_LEAK_CB (unsigned long, const char *, int, size_t,
-                                  void *);
-void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
 
 /* die if we have to */
 void OpenSSLDie(const char *file, int line, const char *assertion);
@@ -601,6 +559,7 @@ void ERR_load_CRYPTO_strings(void);
 # define CRYPTO_F_INT_DUP_EX_DATA                         106
 # define CRYPTO_F_INT_FREE_EX_DATA                        107
 # define CRYPTO_F_INT_NEW_EX_DATA                         108
+# define CRYPTO_F_OPENSSL_MEMDUP                          114
 
 /* Reason codes. */
 # define CRYPTO_R_FIPS_MODE_NOT_SUPPORTED                 101
index ddc7e0f21214f6f43b72d11aa8ecf2910d0a9f4f..34d7fed52ed521ef916559297bb5f31030d1d376 100644 (file)
@@ -733,14 +733,6 @@ void ENGINE_add_conf_module(void);
  * same static data as the calling application (or library), and thus whether
  * these callbacks need to be set or not.
  */
-typedef void *(*dyn_MEM_malloc_cb) (size_t);
-typedef void *(*dyn_MEM_realloc_cb) (void *, size_t);
-typedef void (*dyn_MEM_free_cb) (void *);
-typedef struct st_dynamic_MEM_fns {
-    dyn_MEM_malloc_cb malloc_cb;
-    dyn_MEM_realloc_cb realloc_cb;
-    dyn_MEM_free_cb free_cb;
-} dynamic_MEM_fns;
 /*
  * FIXME: Perhaps the memory and locking code (crypto.h) should declare and
  * use these types so we (and any other dependant code) can simplify a bit??
@@ -763,7 +755,6 @@ typedef struct st_dynamic_LOCK_fns {
 /* The top-level structure */
 typedef struct st_dynamic_fns {
     void *static_state;
-    dynamic_MEM_fns mem_fns;
     dynamic_LOCK_fns lock_fns;
 } dynamic_fns;
 
@@ -812,9 +803,6 @@ typedef int (*dynamic_bind_engine) (ENGINE *e, const char *id,
         OPENSSL_EXPORT \
         int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \
                 if(ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \
-                if(!CRYPTO_set_mem_functions(fns->mem_fns.malloc_cb, \
-                        fns->mem_fns.realloc_cb, fns->mem_fns.free_cb)) \
-                        return 0; \
                 CRYPTO_set_locking_callback(fns->lock_fns.lock_locking_cb); \
                 CRYPTO_set_add_lock_callback(fns->lock_fns.lock_add_lock_cb); \
                 CRYPTO_set_dynlock_create_callback(fns->lock_fns.dynlock_create_cb); \
index f398c9af205d58a85525b866a65ffd05e994655e..bb618755101928c1eea845e5b77174433ca0e436 100644 (file)
@@ -98,7 +98,8 @@ clean:
        
 # DO NOT DELETE THIS LINE -- make depend depends on it.
 
-bio_ssl.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+bio_ssl.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+bio_ssl.o: ../include/openssl/asn1.h ../include/openssl/async.h
 bio_ssl.o: ../include/openssl/bio.h ../include/openssl/bn.h
 bio_ssl.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 bio_ssl.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
@@ -117,7 +118,8 @@ bio_ssl.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
 bio_ssl.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 bio_ssl.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h bio_ssl.c
 bio_ssl.o: packet_locl.h record/record.h ssl_locl.h statem/statem.h
-d1_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+d1_lib.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+d1_lib.o: ../include/openssl/asn1.h ../include/openssl/async.h
 d1_lib.o: ../include/openssl/bio.h ../include/openssl/bn.h
 d1_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 d1_lib.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
@@ -137,7 +139,8 @@ d1_lib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
 d1_lib.o: ../include/openssl/tls1.h ../include/openssl/x509.h
 d1_lib.o: ../include/openssl/x509_vfy.h d1_lib.c packet_locl.h record/record.h
 d1_lib.o: ssl_locl.h statem/statem.h
-d1_msg.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+d1_msg.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+d1_msg.o: ../include/openssl/asn1.h ../include/openssl/async.h
 d1_msg.o: ../include/openssl/bio.h ../include/openssl/bn.h
 d1_msg.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 d1_msg.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
@@ -156,7 +159,8 @@ d1_msg.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
 d1_msg.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 d1_msg.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h d1_msg.c
 d1_msg.o: packet_locl.h record/record.h ssl_locl.h statem/statem.h
-d1_srtp.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+d1_srtp.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+d1_srtp.o: ../include/openssl/asn1.h ../include/openssl/async.h
 d1_srtp.o: ../include/openssl/bio.h ../include/openssl/bn.h
 d1_srtp.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 d1_srtp.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
@@ -175,7 +179,8 @@ d1_srtp.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
 d1_srtp.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 d1_srtp.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h d1_srtp.c
 d1_srtp.o: packet_locl.h record/record.h ssl_locl.h statem/statem.h
-methods.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+methods.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+methods.o: ../include/openssl/asn1.h ../include/openssl/async.h
 methods.o: ../include/openssl/bio.h ../include/openssl/bn.h
 methods.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 methods.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
@@ -194,7 +199,8 @@ methods.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
 methods.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 methods.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h methods.c
 methods.o: packet_locl.h record/record.h ssl_locl.h statem/statem.h
-record/dtls1_bitmap.o: ../e_os.h ../include/openssl/asn1.h
+record/dtls1_bitmap.o: ../e_os.h ../include/internal/dane.h
+record/dtls1_bitmap.o: ../include/internal/numbers.h ../include/openssl/asn1.h
 record/dtls1_bitmap.o: ../include/openssl/async.h ../include/openssl/bio.h
 record/dtls1_bitmap.o: ../include/openssl/bn.h ../include/openssl/buffer.h
 record/dtls1_bitmap.o: ../include/openssl/comp.h ../include/openssl/crypto.h
@@ -218,7 +224,8 @@ record/dtls1_bitmap.o: ../include/openssl/x509_vfy.h record/../packet_locl.h
 record/dtls1_bitmap.o: record/../record/record.h record/../ssl_locl.h
 record/dtls1_bitmap.o: record/../statem/statem.h record/dtls1_bitmap.c
 record/dtls1_bitmap.o: record/record_locl.h
-record/rec_layer_d1.o: ../e_os.h ../include/openssl/asn1.h
+record/rec_layer_d1.o: ../e_os.h ../include/internal/dane.h
+record/rec_layer_d1.o: ../include/internal/numbers.h ../include/openssl/asn1.h
 record/rec_layer_d1.o: ../include/openssl/async.h ../include/openssl/bio.h
 record/rec_layer_d1.o: ../include/openssl/bn.h ../include/openssl/buffer.h
 record/rec_layer_d1.o: ../include/openssl/comp.h ../include/openssl/crypto.h
@@ -242,7 +249,8 @@ record/rec_layer_d1.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 record/rec_layer_d1.o: record/../packet_locl.h record/../record/record.h
 record/rec_layer_d1.o: record/../ssl_locl.h record/../statem/statem.h
 record/rec_layer_d1.o: record/rec_layer_d1.c record/record_locl.h
-record/rec_layer_s3.o: ../e_os.h ../include/openssl/asn1.h
+record/rec_layer_s3.o: ../e_os.h ../include/internal/dane.h
+record/rec_layer_s3.o: ../include/internal/numbers.h ../include/openssl/asn1.h
 record/rec_layer_s3.o: ../include/openssl/async.h ../include/openssl/bio.h
 record/rec_layer_s3.o: ../include/openssl/bn.h ../include/openssl/buffer.h
 record/rec_layer_s3.o: ../include/openssl/comp.h ../include/openssl/crypto.h
@@ -266,7 +274,8 @@ record/rec_layer_s3.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 record/rec_layer_s3.o: record/../packet_locl.h record/../record/record.h
 record/rec_layer_s3.o: record/../ssl_locl.h record/../statem/statem.h
 record/rec_layer_s3.o: record/rec_layer_s3.c record/record_locl.h
-record/ssl3_buffer.o: ../e_os.h ../include/openssl/asn1.h
+record/ssl3_buffer.o: ../e_os.h ../include/internal/dane.h
+record/ssl3_buffer.o: ../include/internal/numbers.h ../include/openssl/asn1.h
 record/ssl3_buffer.o: ../include/openssl/async.h ../include/openssl/bio.h
 record/ssl3_buffer.o: ../include/openssl/bn.h ../include/openssl/buffer.h
 record/ssl3_buffer.o: ../include/openssl/comp.h ../include/openssl/crypto.h
@@ -290,6 +299,7 @@ record/ssl3_buffer.o: record/../record/record.h record/../ssl_locl.h
 record/ssl3_buffer.o: record/../statem/statem.h record/record_locl.h
 record/ssl3_buffer.o: record/ssl3_buffer.c
 record/ssl3_record.o: ../e_os.h ../include/internal/constant_time_locl.h
+record/ssl3_record.o: ../include/internal/dane.h ../include/internal/numbers.h
 record/ssl3_record.o: ../include/openssl/asn1.h ../include/openssl/async.h
 record/ssl3_record.o: ../include/openssl/bio.h ../include/openssl/bn.h
 record/ssl3_record.o: ../include/openssl/buffer.h ../include/openssl/comp.h
@@ -314,6 +324,7 @@ record/ssl3_record.o: record/../packet_locl.h record/../record/record.h
 record/ssl3_record.o: record/../ssl_locl.h record/../statem/statem.h
 record/ssl3_record.o: record/record_locl.h record/ssl3_record.c
 s3_cbc.o: ../e_os.h ../include/internal/constant_time_locl.h
+s3_cbc.o: ../include/internal/dane.h ../include/internal/numbers.h
 s3_cbc.o: ../include/openssl/asn1.h ../include/openssl/async.h
 s3_cbc.o: ../include/openssl/bio.h ../include/openssl/bn.h
 s3_cbc.o: ../include/openssl/buffer.h ../include/openssl/comp.h
@@ -334,7 +345,8 @@ s3_cbc.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
 s3_cbc.o: ../include/openssl/tls1.h ../include/openssl/x509.h
 s3_cbc.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h s3_cbc.c
 s3_cbc.o: ssl_locl.h statem/statem.h
-s3_enc.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+s3_enc.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+s3_enc.o: ../include/openssl/asn1.h ../include/openssl/async.h
 s3_enc.o: ../include/openssl/bio.h ../include/openssl/bn.h
 s3_enc.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 s3_enc.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
@@ -354,7 +366,8 @@ s3_enc.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
 s3_enc.o: ../include/openssl/tls1.h ../include/openssl/x509.h
 s3_enc.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h s3_enc.c
 s3_enc.o: ssl_locl.h statem/statem.h
-s3_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+s3_lib.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+s3_lib.o: ../include/openssl/asn1.h ../include/openssl/async.h
 s3_lib.o: ../include/openssl/bio.h ../include/openssl/bn.h
 s3_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 s3_lib.o: ../include/openssl/crypto.h ../include/openssl/dh.h
@@ -375,7 +388,8 @@ s3_lib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
 s3_lib.o: ../include/openssl/tls1.h ../include/openssl/x509.h
 s3_lib.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h s3_lib.c
 s3_lib.o: ssl_locl.h statem/statem.h
-s3_msg.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+s3_msg.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+s3_msg.o: ../include/openssl/asn1.h ../include/openssl/async.h
 s3_msg.o: ../include/openssl/bio.h ../include/openssl/bn.h
 s3_msg.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 s3_msg.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
@@ -394,7 +408,8 @@ s3_msg.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
 s3_msg.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 s3_msg.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h packet_locl.h
 s3_msg.o: record/record.h s3_msg.c ssl_locl.h statem/statem.h
-ssl_algs.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssl_algs.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+ssl_algs.o: ../include/openssl/asn1.h ../include/openssl/async.h
 ssl_algs.o: ../include/openssl/bio.h ../include/openssl/bn.h
 ssl_algs.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 ssl_algs.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
@@ -413,7 +428,8 @@ ssl_algs.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
 ssl_algs.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 ssl_algs.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 ssl_algs.o: packet_locl.h record/record.h ssl_algs.c ssl_locl.h statem/statem.h
-ssl_asn1.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+ssl_asn1.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+ssl_asn1.o: ../include/openssl/asn1.h ../include/openssl/asn1t.h
 ssl_asn1.o: ../include/openssl/async.h ../include/openssl/bio.h
 ssl_asn1.o: ../include/openssl/bn.h ../include/openssl/buffer.h
 ssl_asn1.o: ../include/openssl/comp.h ../include/openssl/crypto.h
@@ -433,7 +449,8 @@ ssl_asn1.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
 ssl_asn1.o: ../include/openssl/tls1.h ../include/openssl/x509.h
 ssl_asn1.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h
 ssl_asn1.o: ssl_asn1.c ssl_locl.h statem/statem.h
-ssl_cert.o: ../e_os.h ../include/internal/o_dir.h ../include/openssl/asn1.h
+ssl_cert.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+ssl_cert.o: ../include/internal/o_dir.h ../include/openssl/asn1.h
 ssl_cert.o: ../include/openssl/async.h ../include/openssl/bio.h
 ssl_cert.o: ../include/openssl/bn.h ../include/openssl/buffer.h
 ssl_cert.o: ../include/openssl/comp.h ../include/openssl/conf.h
@@ -454,7 +471,8 @@ ssl_cert.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
 ssl_cert.o: ../include/openssl/tls1.h ../include/openssl/x509.h
 ssl_cert.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h
 ssl_cert.o: packet_locl.h record/record.h ssl_cert.c ssl_locl.h statem/statem.h
-ssl_ciph.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssl_ciph.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+ssl_ciph.o: ../include/openssl/asn1.h ../include/openssl/async.h
 ssl_ciph.o: ../include/openssl/bio.h ../include/openssl/bn.h
 ssl_ciph.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 ssl_ciph.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
@@ -474,7 +492,8 @@ ssl_ciph.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
 ssl_ciph.o: ../include/openssl/tls1.h ../include/openssl/x509.h
 ssl_ciph.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h
 ssl_ciph.o: ssl_ciph.c ssl_locl.h statem/statem.h
-ssl_conf.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssl_conf.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+ssl_conf.o: ../include/openssl/asn1.h ../include/openssl/async.h
 ssl_conf.o: ../include/openssl/bio.h ../include/openssl/bn.h
 ssl_conf.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 ssl_conf.o: ../include/openssl/conf.h ../include/openssl/crypto.h
@@ -526,7 +545,8 @@ ssl_err2.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
 ssl_err2.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
 ssl_err2.o: ../include/openssl/tls1.h ../include/openssl/x509.h
 ssl_err2.o: ../include/openssl/x509_vfy.h ssl_err2.c
-ssl_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssl_lib.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+ssl_lib.o: ../include/openssl/asn1.h ../include/openssl/async.h
 ssl_lib.o: ../include/openssl/bio.h ../include/openssl/bn.h
 ssl_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 ssl_lib.o: ../include/openssl/conf.h ../include/openssl/crypto.h
@@ -548,7 +568,8 @@ ssl_lib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
 ssl_lib.o: ../include/openssl/tls1.h ../include/openssl/x509.h
 ssl_lib.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h
 ssl_lib.o: packet_locl.h record/record.h ssl_lib.c ssl_locl.h statem/statem.h
-ssl_mcnf.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssl_mcnf.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+ssl_mcnf.o: ../include/openssl/asn1.h ../include/openssl/async.h
 ssl_mcnf.o: ../include/openssl/bio.h ../include/openssl/bn.h
 ssl_mcnf.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 ssl_mcnf.o: ../include/openssl/conf.h ../include/openssl/crypto.h
@@ -568,7 +589,8 @@ ssl_mcnf.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
 ssl_mcnf.o: ../include/openssl/tls1.h ../include/openssl/x509.h
 ssl_mcnf.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h
 ssl_mcnf.o: ssl_locl.h ssl_mcnf.c statem/statem.h
-ssl_rsa.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssl_rsa.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+ssl_rsa.o: ../include/openssl/asn1.h ../include/openssl/async.h
 ssl_rsa.o: ../include/openssl/bio.h ../include/openssl/bn.h
 ssl_rsa.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 ssl_rsa.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
@@ -587,7 +609,8 @@ ssl_rsa.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
 ssl_rsa.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 ssl_rsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 ssl_rsa.o: packet_locl.h record/record.h ssl_locl.h ssl_rsa.c statem/statem.h
-ssl_sess.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssl_sess.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+ssl_sess.o: ../include/openssl/asn1.h ../include/openssl/async.h
 ssl_sess.o: ../include/openssl/bio.h ../include/openssl/bn.h
 ssl_sess.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 ssl_sess.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
@@ -607,7 +630,8 @@ ssl_sess.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
 ssl_sess.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 ssl_sess.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 ssl_sess.o: packet_locl.h record/record.h ssl_locl.h ssl_sess.c statem/statem.h
-ssl_stat.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssl_stat.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+ssl_stat.o: ../include/openssl/asn1.h ../include/openssl/async.h
 ssl_stat.o: ../include/openssl/bio.h ../include/openssl/bn.h
 ssl_stat.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 ssl_stat.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
@@ -626,7 +650,8 @@ ssl_stat.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
 ssl_stat.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 ssl_stat.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 ssl_stat.o: packet_locl.h record/record.h ssl_locl.h ssl_stat.c statem/statem.h
-ssl_txt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssl_txt.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+ssl_txt.o: ../include/openssl/asn1.h ../include/openssl/async.h
 ssl_txt.o: ../include/openssl/bio.h ../include/openssl/bn.h
 ssl_txt.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 ssl_txt.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
@@ -645,7 +670,8 @@ ssl_txt.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
 ssl_txt.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 ssl_txt.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 ssl_txt.o: packet_locl.h record/record.h ssl_locl.h ssl_txt.c statem/statem.h
-ssl_utst.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssl_utst.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+ssl_utst.o: ../include/openssl/asn1.h ../include/openssl/async.h
 ssl_utst.o: ../include/openssl/bio.h ../include/openssl/bn.h
 ssl_utst.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 ssl_utst.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
@@ -664,28 +690,31 @@ ssl_utst.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
 ssl_utst.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 ssl_utst.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 ssl_utst.o: packet_locl.h record/record.h ssl_locl.h ssl_utst.c statem/statem.h
-statem/statem.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
-statem/statem.o: ../include/openssl/bio.h ../include/openssl/bn.h
-statem/statem.o: ../include/openssl/buffer.h ../include/openssl/comp.h
-statem/statem.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
-statem/statem.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-statem/statem.o: ../include/openssl/ec.h ../include/openssl/err.h
-statem/statem.o: ../include/openssl/evp.h ../include/openssl/hmac.h
-statem/statem.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-statem/statem.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-statem/statem.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-statem/statem.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-statem/statem.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
-statem/statem.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-statem/statem.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-statem/statem.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-statem/statem.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-statem/statem.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-statem/statem.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-statem/statem.o: ../include/openssl/x509_vfy.h statem/../packet_locl.h
-statem/statem.o: statem/../record/record.h statem/../ssl_locl.h
-statem/statem.o: statem/../statem/statem.h statem/statem.c statem/statem_locl.h
-statem/statem_clnt.o: ../e_os.h ../include/openssl/asn1.h
+statem/statem.o: ../e_os.h ../include/internal/dane.h
+statem/statem.o: ../include/internal/numbers.h ../include/openssl/asn1.h
+statem/statem.o: ../include/openssl/async.h ../include/openssl/bio.h
+statem/statem.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+statem/statem.o: ../include/openssl/comp.h ../include/openssl/crypto.h
+statem/statem.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
+statem/statem.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+statem/statem.o: ../include/openssl/err.h ../include/openssl/evp.h
+statem/statem.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+statem/statem.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+statem/statem.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+statem/statem.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+statem/statem.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+statem/statem.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+statem/statem.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+statem/statem.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+statem/statem.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+statem/statem.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+statem/statem.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+statem/statem.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+statem/statem.o: statem/../packet_locl.h statem/../record/record.h
+statem/statem.o: statem/../ssl_locl.h statem/../statem/statem.h statem/statem.c
+statem/statem.o: statem/statem_locl.h
+statem/statem_clnt.o: ../e_os.h ../include/internal/dane.h
+statem/statem_clnt.o: ../include/internal/numbers.h ../include/openssl/asn1.h
 statem/statem_clnt.o: ../include/openssl/async.h ../include/openssl/bio.h
 statem/statem_clnt.o: ../include/openssl/bn.h ../include/openssl/buffer.h
 statem/statem_clnt.o: ../include/openssl/comp.h ../include/openssl/crypto.h
@@ -710,7 +739,8 @@ statem/statem_clnt.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 statem/statem_clnt.o: statem/../packet_locl.h statem/../record/record.h
 statem/statem_clnt.o: statem/../ssl_locl.h statem/../statem/statem.h
 statem/statem_clnt.o: statem/statem_clnt.c statem/statem_locl.h
-statem/statem_dtls.o: ../e_os.h ../include/openssl/asn1.h
+statem/statem_dtls.o: ../e_os.h ../include/internal/dane.h
+statem/statem_dtls.o: ../include/internal/numbers.h ../include/openssl/asn1.h
 statem/statem_dtls.o: ../include/openssl/async.h ../include/openssl/bio.h
 statem/statem_dtls.o: ../include/openssl/bn.h ../include/openssl/buffer.h
 statem/statem_dtls.o: ../include/openssl/comp.h ../include/openssl/crypto.h
@@ -733,7 +763,8 @@ statem/statem_dtls.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 statem/statem_dtls.o: statem/../packet_locl.h statem/../record/record.h
 statem/statem_dtls.o: statem/../ssl_locl.h statem/../statem/statem.h
 statem/statem_dtls.o: statem/statem_dtls.c statem/statem_locl.h
-statem/statem_lib.o: ../e_os.h ../include/openssl/asn1.h
+statem/statem_lib.o: ../e_os.h ../include/internal/dane.h
+statem/statem_lib.o: ../include/internal/numbers.h ../include/openssl/asn1.h
 statem/statem_lib.o: ../include/openssl/async.h ../include/openssl/bio.h
 statem/statem_lib.o: ../include/openssl/bn.h ../include/openssl/buffer.h
 statem/statem_lib.o: ../include/openssl/comp.h ../include/openssl/crypto.h
@@ -757,6 +788,7 @@ statem/statem_lib.o: statem/../packet_locl.h statem/../record/record.h
 statem/statem_lib.o: statem/../ssl_locl.h statem/../statem/statem.h
 statem/statem_lib.o: statem/statem_lib.c statem/statem_locl.h
 statem/statem_srvr.o: ../e_os.h ../include/internal/constant_time_locl.h
+statem/statem_srvr.o: ../include/internal/dane.h ../include/internal/numbers.h
 statem/statem_srvr.o: ../include/openssl/asn1.h ../include/openssl/async.h
 statem/statem_srvr.o: ../include/openssl/bio.h ../include/openssl/bn.h
 statem/statem_srvr.o: ../include/openssl/buffer.h ../include/openssl/comp.h
@@ -781,7 +813,8 @@ statem/statem_srvr.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 statem/statem_srvr.o: statem/../packet_locl.h statem/../record/record.h
 statem/statem_srvr.o: statem/../ssl_locl.h statem/../statem/statem.h
 statem/statem_srvr.o: statem/statem_locl.h statem/statem_srvr.c
-t1_enc.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+t1_enc.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+t1_enc.o: ../include/openssl/asn1.h ../include/openssl/async.h
 t1_enc.o: ../include/openssl/bio.h ../include/openssl/bn.h
 t1_enc.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 t1_enc.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
@@ -801,7 +834,8 @@ t1_enc.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
 t1_enc.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 t1_enc.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h packet_locl.h
 t1_enc.o: record/record.h ssl_locl.h statem/statem.h t1_enc.c
-t1_ext.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+t1_ext.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+t1_ext.o: ../include/openssl/asn1.h ../include/openssl/async.h
 t1_ext.o: ../include/openssl/bio.h ../include/openssl/bn.h
 t1_ext.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 t1_ext.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
@@ -820,7 +854,8 @@ t1_ext.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
 t1_ext.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 t1_ext.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h packet_locl.h
 t1_ext.o: record/record.h ssl_locl.h statem/statem.h t1_ext.c
-t1_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+t1_lib.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+t1_lib.o: ../include/openssl/asn1.h ../include/openssl/async.h
 t1_lib.o: ../include/openssl/bio.h ../include/openssl/bn.h
 t1_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 t1_lib.o: ../include/openssl/conf.h ../include/openssl/crypto.h
@@ -842,7 +877,8 @@ t1_lib.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 t1_lib.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 t1_lib.o: ../include/openssl/x509v3.h packet_locl.h record/record.h ssl_locl.h
 t1_lib.o: statem/statem.h t1_lib.c
-t1_reneg.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+t1_reneg.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+t1_reneg.o: ../include/openssl/asn1.h ../include/openssl/async.h
 t1_reneg.o: ../include/openssl/bio.h ../include/openssl/bn.h
 t1_reneg.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 t1_reneg.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
@@ -861,7 +897,8 @@ t1_reneg.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
 t1_reneg.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 t1_reneg.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 t1_reneg.o: packet_locl.h record/record.h ssl_locl.h statem/statem.h t1_reneg.c
-t1_trce.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+t1_trce.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+t1_trce.o: ../include/openssl/asn1.h ../include/openssl/async.h
 t1_trce.o: ../include/openssl/bio.h ../include/openssl/bn.h
 t1_trce.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 t1_trce.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
@@ -880,7 +917,8 @@ t1_trce.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
 t1_trce.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 t1_trce.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 t1_trce.o: packet_locl.h record/record.h ssl_locl.h statem/statem.h t1_trce.c
-tls_srp.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+tls_srp.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+tls_srp.o: ../include/openssl/asn1.h ../include/openssl/async.h
 tls_srp.o: ../include/openssl/bio.h ../include/openssl/bn.h
 tls_srp.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 tls_srp.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
index a15248d41bdc19841203d5a3816469fd81801055..44d0e7fa0f7848036831d973d751a03f42cc7ab3 100644 (file)
@@ -567,7 +567,7 @@ static void load_builtin_compressions(void)
             SSL_COMP *comp = NULL;
             COMP_METHOD *method = COMP_zlib();
 
-            MemCheck_off();
+            CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
             ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
             if (COMP_get_type(method) != NID_undef
                 && ssl_comp_methods != NULL) {
@@ -580,7 +580,7 @@ static void load_builtin_compressions(void)
                     sk_SSL_COMP_sort(ssl_comp_methods);
                 }
             }
-            MemCheck_on();
+            CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
         }
     }
 
@@ -1902,10 +1902,10 @@ int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
         return 0;
     }
 
-    MemCheck_off();
+    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
     comp = OPENSSL_malloc(sizeof(*comp));
     if (comp == NULL) {
-        MemCheck_on();
+        CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
         SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, ERR_R_MALLOC_FAILURE);
         return (1);
     }
@@ -1915,20 +1915,20 @@ int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
     load_builtin_compressions();
     if (ssl_comp_methods && sk_SSL_COMP_find(ssl_comp_methods, comp) >= 0) {
         OPENSSL_free(comp);
-        MemCheck_on();
+        CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
         SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,
                SSL_R_DUPLICATE_COMPRESSION_ID);
         return (1);
-    } else if ((ssl_comp_methods == NULL)
+    }
+    if ((ssl_comp_methods == NULL)
                || !sk_SSL_COMP_push(ssl_comp_methods, comp)) {
         OPENSSL_free(comp);
-        MemCheck_on();
+        CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
         SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, ERR_R_MALLOC_FAILURE);
         return (1);
-    } else {
-        MemCheck_on();
-        return (0);
     }
+    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
+    return (0);
 }
 #endif
 
index cfa4179a40b5e4402dc23d810b59dc7477e07ae6..fe47fa67a60ceab85737ca6140c3003f560d0815 100644 (file)
@@ -86,8 +86,7 @@ static ERR_STRING_DATA SSL_str_functs[] = {
     {ERR_FUNC(SSL_F_DTLS1_ENC), "DTLS1_ENC"},
     {ERR_FUNC(SSL_F_DTLS1_GET_HELLO_VERIFY), "DTLS1_GET_HELLO_VERIFY"},
     {ERR_FUNC(SSL_F_DTLS1_GET_MESSAGE), "dtls1_get_message"},
-    {ERR_FUNC(SSL_F_DTLS1_GET_MESSAGE_FRAGMENT),
-     "DTLS1_GET_MESSAGE_FRAGMENT"},
+    {ERR_FUNC(SSL_F_DTLS1_GET_MESSAGE_FRAGMENT), "DTLS1_GET_MESSAGE_FRAGMENT"},
     {ERR_FUNC(SSL_F_DTLS1_GET_RECORD), "dtls1_get_record"},
     {ERR_FUNC(SSL_F_DTLS1_HANDLE_TIMEOUT), "dtls1_handle_timeout"},
     {ERR_FUNC(SSL_F_DTLS1_HEARTBEAT), "dtls1_heartbeat"},
@@ -115,8 +114,7 @@ static ERR_STRING_DATA SSL_str_functs[] = {
     {ERR_FUNC(SSL_F_DTLS1_SEND_SERVER_HELLO), "dtls1_send_server_hello"},
     {ERR_FUNC(SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE),
      "dtls1_send_server_key_exchange"},
-    {ERR_FUNC(SSL_F_DTLS1_WRITE_APP_DATA_BYTES),
-     "dtls1_write_app_data_bytes"},
+    {ERR_FUNC(SSL_F_DTLS1_WRITE_APP_DATA_BYTES), "dtls1_write_app_data_bytes"},
     {ERR_FUNC(SSL_F_DTLS_CONSTRUCT_CHANGE_CIPHER_SPEC),
      "dtls_construct_change_cipher_spec"},
     {ERR_FUNC(SSL_F_DTLS_CONSTRUCT_HELLO_VERIFY_REQUEST),
@@ -137,10 +135,8 @@ static ERR_STRING_DATA SSL_str_functs[] = {
     {ERR_FUNC(SSL_F_SSL3_CONNECT), "ssl3_connect"},
     {ERR_FUNC(SSL_F_SSL3_CTRL), "ssl3_ctrl"},
     {ERR_FUNC(SSL_F_SSL3_CTX_CTRL), "ssl3_ctx_ctrl"},
-    {ERR_FUNC(SSL_F_SSL3_DIGEST_CACHED_RECORDS),
-     "ssl3_digest_cached_records"},
-    {ERR_FUNC(SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC),
-     "ssl3_do_change_cipher_spec"},
+    {ERR_FUNC(SSL_F_SSL3_DIGEST_CACHED_RECORDS), "ssl3_digest_cached_records"},
+    {ERR_FUNC(SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC), "ssl3_do_change_cipher_spec"},
     {ERR_FUNC(SSL_F_SSL3_ENC), "ssl3_enc"},
     {ERR_FUNC(SSL_F_SSL3_FINAL_FINISH_MAC), "ssl3_final_finish_mac"},
     {ERR_FUNC(SSL_F_SSL3_GENERATE_KEY_BLOCK), "ssl3_generate_key_block"},
@@ -198,8 +194,7 @@ static ERR_STRING_DATA SSL_str_functs[] = {
     {ERR_FUNC(SSL_F_SSL_ADD_CERT_TO_BUF), "ssl_add_cert_to_buf"},
     {ERR_FUNC(SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT),
      "ssl_add_clienthello_renegotiate_ext"},
-    {ERR_FUNC(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT),
-     "ssl_add_clienthello_tlsext"},
+    {ERR_FUNC(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT), "ssl_add_clienthello_tlsext"},
     {ERR_FUNC(SSL_F_SSL_ADD_CLIENTHELLO_USE_SRTP_EXT),
      "ssl_add_clienthello_use_srtp_ext"},
     {ERR_FUNC(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK),
@@ -208,8 +203,7 @@ static ERR_STRING_DATA SSL_str_functs[] = {
      "SSL_add_file_cert_subjects_to_stack"},
     {ERR_FUNC(SSL_F_SSL_ADD_SERVERHELLO_RENEGOTIATE_EXT),
      "ssl_add_serverhello_renegotiate_ext"},
-    {ERR_FUNC(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT),
-     "ssl_add_serverhello_tlsext"},
+    {ERR_FUNC(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT), "ssl_add_serverhello_tlsext"},
     {ERR_FUNC(SSL_F_SSL_ADD_SERVERHELLO_USE_SRTP_EXT),
      "ssl_add_serverhello_use_srtp_ext"},
     {ERR_FUNC(SSL_F_SSL_BAD_METHOD), "ssl_bad_method"},
@@ -225,8 +219,7 @@ static ERR_STRING_DATA SSL_str_functs[] = {
      "ssl_check_serverhello_tlsext"},
     {ERR_FUNC(SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG),
      "ssl_check_srvr_ecc_cert_and_alg"},
-    {ERR_FUNC(SSL_F_SSL_CIPHER_PROCESS_RULESTR),
-     "ssl_cipher_process_rulestr"},
+    {ERR_FUNC(SSL_F_SSL_CIPHER_PROCESS_RULESTR), "ssl_cipher_process_rulestr"},
     {ERR_FUNC(SSL_F_SSL_CIPHER_STRENGTH_SORT), "ssl_cipher_strength_sort"},
     {ERR_FUNC(SSL_F_SSL_CLEAR), "SSL_clear"},
     {ERR_FUNC(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD),
@@ -313,10 +306,8 @@ static ERR_STRING_DATA SSL_str_functs[] = {
     {ERR_FUNC(SSL_F_SSL_SET_PURPOSE), "SSL_set_purpose"},
     {ERR_FUNC(SSL_F_SSL_SET_RFD), "SSL_set_rfd"},
     {ERR_FUNC(SSL_F_SSL_SET_SESSION), "SSL_set_session"},
-    {ERR_FUNC(SSL_F_SSL_SET_SESSION_ID_CONTEXT),
-     "SSL_set_session_id_context"},
-    {ERR_FUNC(SSL_F_SSL_SET_SESSION_TICKET_EXT),
-     "SSL_set_session_ticket_ext"},
+    {ERR_FUNC(SSL_F_SSL_SET_SESSION_ID_CONTEXT), "SSL_set_session_id_context"},
+    {ERR_FUNC(SSL_F_SSL_SET_SESSION_TICKET_EXT), "SSL_set_session_ticket_ext"},
     {ERR_FUNC(SSL_F_SSL_SET_TRUST), "SSL_set_trust"},
     {ERR_FUNC(SSL_F_SSL_SET_WFD), "SSL_set_wfd"},
     {ERR_FUNC(SSL_F_SSL_SHUTDOWN), "SSL_shutdown"},
@@ -335,10 +326,8 @@ static ERR_STRING_DATA SSL_str_functs[] = {
     {ERR_FUNC(SSL_F_SSL_USE_PRIVATEKEY_FILE), "SSL_use_PrivateKey_file"},
     {ERR_FUNC(SSL_F_SSL_USE_PSK_IDENTITY_HINT), "SSL_use_psk_identity_hint"},
     {ERR_FUNC(SSL_F_SSL_USE_RSAPRIVATEKEY), "SSL_use_RSAPrivateKey"},
-    {ERR_FUNC(SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1),
-     "SSL_use_RSAPrivateKey_ASN1"},
-    {ERR_FUNC(SSL_F_SSL_USE_RSAPRIVATEKEY_FILE),
-     "SSL_use_RSAPrivateKey_file"},
+    {ERR_FUNC(SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1), "SSL_use_RSAPrivateKey_ASN1"},
+    {ERR_FUNC(SSL_F_SSL_USE_RSAPRIVATEKEY_FILE), "SSL_use_RSAPrivateKey_file"},
     {ERR_FUNC(SSL_F_SSL_VERIFY_CERT_CHAIN), "ssl_verify_cert_chain"},
     {ERR_FUNC(SSL_F_SSL_WRITE), "SSL_write"},
     {ERR_FUNC(SSL_F_STATE_MACHINE), "STATE_MACHINE"},
@@ -366,8 +355,7 @@ static ERR_STRING_DATA SSL_str_functs[] = {
      "tls_construct_certificate_request"},
     {ERR_FUNC(SSL_F_TLS_CONSTRUCT_CLIENT_CERTIFICATE),
      "tls_construct_client_certificate"},
-    {ERR_FUNC(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO),
-     "tls_construct_client_hello"},
+    {ERR_FUNC(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO), "tls_construct_client_hello"},
     {ERR_FUNC(SSL_F_TLS_CONSTRUCT_CLIENT_KEY_EXCHANGE),
      "tls_construct_client_key_exchange"},
     {ERR_FUNC(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY),
@@ -378,11 +366,9 @@ static ERR_STRING_DATA SSL_str_functs[] = {
     {ERR_FUNC(SSL_F_TLS_CONSTRUCT_SERVER_CERTIFICATE),
      "tls_construct_server_certificate"},
     {ERR_FUNC(SSL_F_TLS_CONSTRUCT_SERVER_DONE), "tls_construct_server_done"},
-    {ERR_FUNC(SSL_F_TLS_CONSTRUCT_SERVER_HELLO),
-     "tls_construct_server_hello"},
+    {ERR_FUNC(SSL_F_TLS_CONSTRUCT_SERVER_HELLO), "tls_construct_server_hello"},
     {ERR_FUNC(SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE),
      "tls_construct_server_key_exchange"},
-    {ERR_FUNC(SSL_F_TLS_GET_MESSAGE_BODY), "tls_get_message_body"},
     {ERR_FUNC(SSL_F_TLS_GET_MESSAGE_HEADER), "tls_get_message_header"},
     {ERR_FUNC(SSL_F_TLS_POST_PROCESS_CLIENT_HELLO),
      "tls_post_process_client_hello"},
@@ -410,8 +396,7 @@ static ERR_STRING_DATA SSL_str_functs[] = {
      "tls_process_server_certificate"},
     {ERR_FUNC(SSL_F_TLS_PROCESS_SERVER_DONE), "tls_process_server_done"},
     {ERR_FUNC(SSL_F_TLS_PROCESS_SERVER_HELLO), "tls_process_server_hello"},
-    {ERR_FUNC(SSL_F_USE_CERTIFICATE_CHAIN_FILE),
-     "use_certificate_chain_file"},
+    {ERR_FUNC(SSL_F_USE_CERTIFICATE_CHAIN_FILE), "use_certificate_chain_file"},
     {0, NULL}
 };
 
@@ -470,16 +455,14 @@ static ERR_STRING_DATA SSL_str_reasons[] = {
     {ERR_REASON(SSL_R_BAD_VALUE), "bad value"},
     {ERR_REASON(SSL_R_BAD_WRITE_RETRY), "bad write retry"},
     {ERR_REASON(SSL_R_BIO_NOT_SET), "bio not set"},
-    {ERR_REASON(SSL_R_BLOCK_CIPHER_PAD_IS_WRONG),
-     "block cipher pad is wrong"},
+    {ERR_REASON(SSL_R_BLOCK_CIPHER_PAD_IS_WRONG), "block cipher pad is wrong"},
     {ERR_REASON(SSL_R_BN_LIB), "bn lib"},
     {ERR_REASON(SSL_R_CA_DN_LENGTH_MISMATCH), "ca dn length mismatch"},
     {ERR_REASON(SSL_R_CA_DN_TOO_LONG), "ca dn too long"},
     {ERR_REASON(SSL_R_CA_KEY_TOO_SMALL), "ca key too small"},
     {ERR_REASON(SSL_R_CA_MD_TOO_WEAK), "ca md too weak"},
     {ERR_REASON(SSL_R_CCS_RECEIVED_EARLY), "ccs received early"},
-    {ERR_REASON(SSL_R_CERTIFICATE_VERIFY_FAILED),
-     "certificate verify failed"},
+    {ERR_REASON(SSL_R_CERTIFICATE_VERIFY_FAILED), "certificate verify failed"},
     {ERR_REASON(SSL_R_CERT_CB_ERROR), "cert cb error"},
     {ERR_REASON(SSL_R_CERT_LENGTH_MISMATCH), "cert length mismatch"},
     {ERR_REASON(SSL_R_CIPHER_CODE_WRONG_LENGTH), "cipher code wrong length"},
@@ -492,8 +475,7 @@ static ERR_STRING_DATA SSL_str_reasons[] = {
     {ERR_REASON(SSL_R_COMPRESSION_FAILURE), "compression failure"},
     {ERR_REASON(SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE),
      "compression id not within private range"},
-    {ERR_REASON(SSL_R_COMPRESSION_LIBRARY_ERROR),
-     "compression library error"},
+    {ERR_REASON(SSL_R_COMPRESSION_LIBRARY_ERROR), "compression library error"},
     {ERR_REASON(SSL_R_CONNECTION_TYPE_NOT_SET), "connection type not set"},
     {ERR_REASON(SSL_R_CONTEXT_NOT_DANE_ENABLED), "context not dane enabled"},
     {ERR_REASON(SSL_R_COOKIE_GEN_CALLBACK_FAILURE),
@@ -540,8 +522,7 @@ static ERR_STRING_DATA SSL_str_reasons[] = {
     {ERR_REASON(SSL_R_EE_KEY_TOO_SMALL), "ee key too small"},
     {ERR_REASON(SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST),
      "empty srtp protection profile list"},
-    {ERR_REASON(SSL_R_ENCRYPTED_LENGTH_TOO_LONG),
-     "encrypted length too long"},
+    {ERR_REASON(SSL_R_ENCRYPTED_LENGTH_TOO_LONG), "encrypted length too long"},
     {ERR_REASON(SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST),
      "error in received cipher list"},
     {ERR_REASON(SSL_R_ERROR_SETTING_TLSA_BASE_DOMAIN),
@@ -620,14 +601,11 @@ static ERR_STRING_DATA SSL_str_reasons[] = {
      "no shared sigature algorithms"},
     {ERR_REASON(SSL_R_NO_SRTP_PROFILES), "no srtp profiles"},
     {ERR_REASON(SSL_R_NO_VERIFY_CALLBACK), "no verify callback"},
-    {ERR_REASON(SSL_R_NO_VERIFY_COOKIE_CALLBACK),
-     "no verify cookie callback"},
+    {ERR_REASON(SSL_R_NO_VERIFY_COOKIE_CALLBACK), "no verify cookie callback"},
     {ERR_REASON(SSL_R_NULL_SSL_CTX), "null ssl ctx"},
     {ERR_REASON(SSL_R_NULL_SSL_METHOD_PASSED), "null ssl method passed"},
     {ERR_REASON(SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED),
      "old session cipher not returned"},
-    {ERR_REASON(SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED),
-     "old session compression algorithm not returned"},
     {ERR_REASON(SSL_R_PACKET_LENGTH_TOO_LONG), "packet length too long"},
     {ERR_REASON(SSL_R_PARSE_TLSEXT), "parse tlsext"},
     {ERR_REASON(SSL_R_PATH_TOO_LONG), "path too long"},
@@ -675,8 +653,7 @@ static ERR_STRING_DATA SSL_str_reasons[] = {
     {ERR_REASON(SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE),
      "ssl3 ext invalid servername type"},
     {ERR_REASON(SSL_R_SSL3_SESSION_ID_TOO_LONG), "ssl3 session id too long"},
-    {ERR_REASON(SSL_R_SSL3_SESSION_ID_TOO_SHORT),
-     "ssl3 session id too short"},
+    {ERR_REASON(SSL_R_SSL3_SESSION_ID_TOO_SHORT), "ssl3 session id too short"},
     {ERR_REASON(SSL_R_SSLV3_ALERT_BAD_CERTIFICATE),
      "sslv3 alert bad certificate"},
     {ERR_REASON(SSL_R_SSLV3_ALERT_BAD_RECORD_MAC),
@@ -718,8 +695,7 @@ static ERR_STRING_DATA SSL_str_reasons[] = {
      "ssl session id context too long"},
     {ERR_REASON(SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH),
      "ssl session id has bad length"},
-    {ERR_REASON(SSL_R_TLSV1_ALERT_ACCESS_DENIED),
-     "tlsv1 alert access denied"},
+    {ERR_REASON(SSL_R_TLSV1_ALERT_ACCESS_DENIED), "tlsv1 alert access denied"},
     {ERR_REASON(SSL_R_TLSV1_ALERT_DECODE_ERROR), "tlsv1 alert decode error"},
     {ERR_REASON(SSL_R_TLSV1_ALERT_DECRYPTION_FAILED),
      "tlsv1 alert decryption failed"},
@@ -765,8 +741,7 @@ static ERR_STRING_DATA SSL_str_reasons[] = {
      "tls peer did not respond with certificate list"},
     {ERR_REASON(SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG),
      "tls rsa encrypted value length is wrong"},
-    {ERR_REASON(SSL_R_UNABLE_TO_DECODE_DH_CERTS),
-     "unable to decode dh certs"},
+    {ERR_REASON(SSL_R_UNABLE_TO_DECODE_DH_CERTS), "unable to decode dh certs"},
     {ERR_REASON(SSL_R_UNABLE_TO_DECODE_ECDH_CERTS),
      "unable to decode ecdh certs"},
     {ERR_REASON(SSL_R_UNABLE_TO_FIND_DH_PARAMETERS),
@@ -775,8 +750,7 @@ static ERR_STRING_DATA SSL_str_reasons[] = {
      "unable to find ecdh parameters"},
     {ERR_REASON(SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS),
      "unable to find public key parameters"},
-    {ERR_REASON(SSL_R_UNABLE_TO_FIND_SSL_METHOD),
-     "unable to find ssl method"},
+    {ERR_REASON(SSL_R_UNABLE_TO_FIND_SSL_METHOD), "unable to find ssl method"},
     {ERR_REASON(SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES),
      "unable to load ssl3 md5 routines"},
     {ERR_REASON(SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES),
@@ -791,12 +765,10 @@ static ERR_STRING_DATA SSL_str_reasons[] = {
     {ERR_REASON(SSL_R_UNKNOWN_CMD_NAME), "unknown cmd name"},
     {ERR_REASON(SSL_R_UNKNOWN_COMMAND), "unknown command"},
     {ERR_REASON(SSL_R_UNKNOWN_DIGEST), "unknown digest"},
-    {ERR_REASON(SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE),
-     "unknown key exchange type"},
+    {ERR_REASON(SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE), "unknown key exchange type"},
     {ERR_REASON(SSL_R_UNKNOWN_PKEY_TYPE), "unknown pkey type"},
     {ERR_REASON(SSL_R_UNKNOWN_PROTOCOL), "unknown protocol"},
-    {ERR_REASON(SSL_R_UNKNOWN_REMOTE_ERROR_TYPE),
-     "unknown remote error type"},
+    {ERR_REASON(SSL_R_UNKNOWN_REMOTE_ERROR_TYPE), "unknown remote error type"},
     {ERR_REASON(SSL_R_UNKNOWN_SSL_VERSION), "unknown ssl version"},
     {ERR_REASON(SSL_R_UNKNOWN_STATE), "unknown state"},
     {ERR_REASON(SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED),
index 81035584c50d940a8327c94747f6d900b54d80e6..885421237a3fd2e205de799dd33ea4c67558a63c 100644 (file)
@@ -30,6 +30,7 @@ LIBFIPS= -L.. -lfips
 START= @@@ START
 
 NPTEST=                nptest
+MEMLEAKTEST=    memleaktest
 BNTEST=                bntest
 ECTEST=                ectest
 ECDSATEST=     ecdsatest
@@ -83,7 +84,8 @@ ASYNCTEST=    asynctest
 
 TESTS=         alltests
 
-EXE=   $(NPTEST)$(EXE_EXT) $(BNTEST)$(EXE_EXT) $(ECTEST)$(EXE_EXT) \
+EXE=   $(NPTEST)$(EXE_EXT) $(MEMLEAKTEST)$(EXE_EXT) \
+       $(BNTEST)$(EXE_EXT) $(ECTEST)$(EXE_EXT) \
        $(ECDSATEST)$(EXE_EXT) $(ECDHTEST)$(EXE_EXT) $(GMDIFFTEST)$(EXE_EXT) \
        $(PBELUTEST)$(EXE_EXT) $(IDEATEST)$(EXE_EXT) \
        $(MD2TEST)$(EXE_EXT)  $(MD4TEST)$(EXE_EXT) $(MD5TEST)$(EXE_EXT) $(HMACTEST)$(EXE_EXT) $(WPTEST)$(EXE_EXT) \
@@ -103,7 +105,8 @@ EXE=        $(NPTEST)$(EXE_EXT) $(BNTEST)$(EXE_EXT) $(ECTEST)$(EXE_EXT) \
 
 # $(METHTEST)$(EXE_EXT)
 
-OBJ=   $(NPTEST).o $(BNTEST).o $(ECTEST).o \
+OBJ=   $(NPTEST).o $(MEMLEAKTEST).o \
+       $(BNTEST).o $(ECTEST).o \
        $(ECDSATEST).o $(ECDHTEST).o $(GMDIFFTEST).o $(PBELUTEST).o $(IDEATEST).o \
        $(MD2TEST).o $(MD4TEST).o $(MD5TEST).o \
        $(HMACTEST).o $(WPTEST).o \
@@ -117,7 +120,8 @@ OBJ=        $(NPTEST).o $(BNTEST).o $(ECTEST).o \
        $(CONSTTIMETEST).o $(VERIFYEXTRATEST).o $(CLIENTHELLOTEST).o \
        $(PACKETTEST).o $(ASYNCTEST).o testutil.o
 
-SRC=   $(NPTEST).c $(BNTEST).c $(ECTEST).c \
+SRC=   $(NPTEST).c $(MEMLEAKTEST).c \
+       $(BNTEST).c $(ECTEST).c \
        $(ECDSATEST).c $(ECDHTEST).c $(GMDIFFTEST).c $(PBELUTEST).c $(IDEATEST).c \
        $(MD2TEST).c  $(MD4TEST).c $(MD5TEST).c \
        $(HMACTEST).c $(WPTEST).c \
@@ -205,6 +209,9 @@ $(RSATEST)$(EXE_EXT): $(RSATEST).o $(DLIBCRYPTO)
 $(NPTEST)$(EXE_EXT): $(NPTEST).o $(DLIBCRYPTO)
        @target=$(NPTEST); $(BUILD_CMD)
 
+$(MEMLEAKTEST)$(EXE_EXT): $(MEMLEAKTEST).o $(DLIBCRYPTO)
+       @target=$(MEMLEAKTEST); $(BUILD_CMD)
+
 $(BNTEST)$(EXE_EXT): $(BNTEST).o $(DLIBCRYPTO)
        @target=$(BNTEST); $(BUILD_CMD)
 
@@ -570,7 +577,8 @@ gost2814789test.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
 gost2814789test.o: ../include/openssl/sha.h ../include/openssl/stack.h
 gost2814789test.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
 gost2814789test.o: ../include/openssl/x509_vfy.h gost2814789test.c
-heartbeat_test.o: ../e_os.h ../include/openssl/asn1.h
+heartbeat_test.o: ../e_os.h ../include/internal/dane.h
+heartbeat_test.o: ../include/internal/numbers.h ../include/openssl/asn1.h
 heartbeat_test.o: ../include/openssl/async.h ../include/openssl/bio.h
 heartbeat_test.o: ../include/openssl/bn.h ../include/openssl/buffer.h
 heartbeat_test.o: ../include/openssl/comp.h ../include/openssl/crypto.h
@@ -631,6 +639,11 @@ mdc2test.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
 mdc2test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
 mdc2test.o: ../include/openssl/safestack.h ../include/openssl/stack.h
 mdc2test.o: ../include/openssl/symhacks.h mdc2test.c
+memleaktest.o: ../include/openssl/bio.h ../include/openssl/crypto.h
+memleaktest.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
+memleaktest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+memleaktest.o: ../include/openssl/safestack.h ../include/openssl/stack.h
+memleaktest.o: ../include/openssl/symhacks.h memleaktest.c
 nptest.o: nptest.c
 p5_crpt2_test.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
 p5_crpt2_test.o: ../include/openssl/buffer.h ../include/openssl/conf.h
@@ -644,12 +657,12 @@ p5_crpt2_test.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
 p5_crpt2_test.o: ../include/openssl/sha.h ../include/openssl/stack.h
 p5_crpt2_test.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
 p5_crpt2_test.o: ../include/openssl/x509_vfy.h p5_crpt2_test.c
-packettest.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-packettest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
-packettest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-packettest.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
-packettest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-packettest.o: ../ssl/packet_locl.h packettest.c
+packettest.o: ../include/internal/numbers.h ../include/openssl/bn.h
+packettest.o: ../include/openssl/buffer.h ../include/openssl/crypto.h
+packettest.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
+packettest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+packettest.o: ../include/openssl/safestack.h ../include/openssl/stack.h
+packettest.o: ../include/openssl/symhacks.h ../ssl/packet_locl.h packettest.c
 pbelutest.o: ../include/openssl/asn1.h ../include/openssl/bio.h
 pbelutest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
 pbelutest.o: ../include/openssl/evp.h ../include/openssl/obj_mac.h
@@ -689,7 +702,8 @@ sha1test.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
 sha1test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
 sha1test.o: ../include/openssl/safestack.h ../include/openssl/sha.h
 sha1test.o: ../include/openssl/stack.h ../include/openssl/symhacks.h sha1test.c
-ssltest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssltest.o: ../e_os.h ../include/internal/dane.h ../include/internal/numbers.h
+ssltest.o: ../include/openssl/asn1.h ../include/openssl/async.h
 ssltest.o: ../include/openssl/bio.h ../include/openssl/bn.h
 ssltest.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 ssltest.o: ../include/openssl/conf.h ../include/openssl/crypto.h
diff --git a/test/Makefile.orig b/test/Makefile.orig
new file mode 100644 (file)
index 0000000..8103558
--- /dev/null
@@ -0,0 +1,747 @@
+#
+# test/Makefile
+#
+
+DIR=           test
+TOP=           ..
+CC=            cc
+INCLUDES=      -I$(TOP) -I../include -I../crypto/include -I$(TOP)/fips
+CFLAG=         -g
+MAKEDEPEND=    $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
+PERL=          perl
+
+PEX_LIBS=
+EX_LIBS= #-lnsl -lsocket
+
+CFLAGS= $(INCLUDES) $(CFLAG)
+
+GENERAL=Makefile maketests.com \
+       tests.com testenc.com tx509.com trsa.com tcrl.com tsid.com treq.com \
+       tpkcs7.com tpkcs7d.com tverify.com testgen.com testss.com testssl.com \
+       testca.com VMSca-response.1 VMSca-response.2
+
+DLIBCRYPTO= ../libcrypto.a
+DLIBSSL= ../libssl.a
+LIBCRYPTO= -L.. -lcrypto
+LIBSSL= -L.. -lssl
+LIBFIPS= -L.. -lfips
+
+# Prefix for logline for each test
+START= @@@ START
+
+NPTEST=                nptest
+BNTEST=                bntest
+ECTEST=                ectest
+ECDSATEST=     ecdsatest
+ECDHTEST=      ecdhtest
+EXPTEST=       exptest
+GMDIFFTEST=    gmdifftest
+PBELUTEST=     pbelutest
+IDEATEST=      ideatest
+SHA1TEST=      sha1test
+SHA256TEST=    sha256t
+SHA512TEST=    sha512t
+MDC2TEST=      mdc2test
+RMDTEST=       rmdtest
+MD2TEST=       md2test
+MD4TEST=       md4test
+MD5TEST=       md5test
+HMACTEST=      hmactest
+WPTEST=                wp_test
+RC2TEST=       rc2test
+RC4TEST=       rc4test
+RC5TEST=       rc5test
+BFTEST=                bftest
+CASTTEST=      casttest
+DESTEST=       destest
+GOST2814789TEST=gost2814789test
+RANDTEST=      randtest
+DHTEST=                dhtest
+DSATEST=       dsatest
+SSLTEST=       ssltest
+DANETEST=      danetest
+RSATEST=       rsa_test
+ENGINETEST=    enginetest
+EVPTEST=       evp_test
+EVPEXTRATEST=evp_extra_test
+P5_CRPT2_TEST= p5_crpt2_test
+IGETEST=       igetest
+JPAKETEST=     jpaketest
+SECMEMTEST=    secmemtest
+SRPTEST=       srptest
+V3NAMETEST=    v3nametest
+HEARTBEATTEST=  heartbeat_test
+CONSTTIMETEST=  constant_time_test
+VERIFYEXTRATEST=       verify_extra_test
+CLIENTHELLOTEST=       clienthellotest
+PACKETTEST=    packettest
+SSLVERTOLTEST= sslvertoltest
+SSLEXTENSIONTEST=      sslextensiontest
+SSLSESSIONTICKTEST=    sslsessionticktest
+SSLSKEWITH0PTEST=      sslskewith0ptest
+ASYNCTEST=     asynctest
+
+TESTS=         alltests
+
+EXE=   $(NPTEST)$(EXE_EXT) $(BNTEST)$(EXE_EXT) $(ECTEST)$(EXE_EXT) \
+       $(ECDSATEST)$(EXE_EXT) $(ECDHTEST)$(EXE_EXT) $(GMDIFFTEST)$(EXE_EXT) \
+       $(PBELUTEST)$(EXE_EXT) $(IDEATEST)$(EXE_EXT) \
+       $(MD2TEST)$(EXE_EXT)  $(MD4TEST)$(EXE_EXT) $(MD5TEST)$(EXE_EXT) $(HMACTEST)$(EXE_EXT) $(WPTEST)$(EXE_EXT) \
+       $(RC2TEST)$(EXE_EXT) $(RC4TEST)$(EXE_EXT) $(RC5TEST)$(EXE_EXT) \
+       $(DESTEST)$(EXE_EXT) $(SHA1TEST)$(EXE_EXT) $(SHA256TEST)$(EXE_EXT) $(SHA512TEST)$(EXE_EXT) \
+       $(MDC2TEST)$(EXE_EXT) $(RMDTEST)$(EXE_EXT) \
+       $(RANDTEST)$(EXE_EXT) $(DHTEST)$(EXE_EXT) $(ENGINETEST)$(EXE_EXT) \
+       $(GOST2814789TEST)$(EXE_EXT) $(DANETEST)$(EXE_EXT) \
+       $(BFTEST)$(EXE_EXT) $(CASTTEST)$(EXE_EXT) $(SSLTEST)$(EXE_EXT) \
+       $(EXPTEST)$(EXE_EXT) $(DSATEST)$(EXE_EXT) $(RSATEST)$(EXE_EXT) \
+       $(EVPTEST)$(EXE_EXT) $(EVPEXTRATEST)$(EXE_EXT) $(IGETEST)$(EXE_EXT) \
+       $(JPAKETEST)$(EXE_EXT) $(SECMEMTEST)$(EXE_EXT) \
+       $(SRPTEST)$(EXE_EXT) $(V3NAMETEST)$(EXE_EXT) \
+       $(HEARTBEATTEST)$(EXE_EXT) $(P5_CRPT2_TEST)$(EXE_EXT) \
+       $(CONSTTIMETEST)$(EXE_EXT) $(VERIFYEXTRATEST)$(EXE_EXT) \
+       $(CLIENTHELLOTEST)$(EXE_EXT) $(PACKETTEST)$(EXE_EXT) $(ASYNCTEST)$(EXE_EXT)
+
+# $(METHTEST)$(EXE_EXT)
+
+OBJ=   $(NPTEST).o $(BNTEST).o $(ECTEST).o \
+       $(ECDSATEST).o $(ECDHTEST).o $(GMDIFFTEST).o $(PBELUTEST).o $(IDEATEST).o \
+       $(MD2TEST).o $(MD4TEST).o $(MD5TEST).o \
+       $(HMACTEST).o $(WPTEST).o \
+       $(RC2TEST).o $(RC4TEST).o $(RC5TEST).o \
+       $(DESTEST).o $(SHA1TEST).o $(SHA256TEST).o $(SHA512TEST).o \
+       $(MDC2TEST).o $(RMDTEST).o $(DANETEST).o \
+       $(RANDTEST).o $(DHTEST).o $(ENGINETEST).o $(CASTTEST).o \
+       $(BFTEST).o  $(SSLTEST).o  $(DSATEST).o  $(EXPTEST).o $(RSATEST).o \
+       $(EVPTEST).o $(EVPEXTRATEST).o $(IGETEST).o $(JPAKETEST).o $(V3NAMETEST).o \
+       $(GOST2814789TEST).o $(HEARTBEATTEST).o $(P5_CRPT2_TEST).o \
+       $(CONSTTIMETEST).o $(VERIFYEXTRATEST).o $(CLIENTHELLOTEST).o \
+       $(PACKETTEST).o $(ASYNCTEST).o testutil.o
+
+SRC=   $(NPTEST).c $(BNTEST).c $(ECTEST).c \
+       $(ECDSATEST).c $(ECDHTEST).c $(GMDIFFTEST).c $(PBELUTEST).c $(IDEATEST).c \
+       $(MD2TEST).c  $(MD4TEST).c $(MD5TEST).c \
+       $(HMACTEST).c $(WPTEST).c \
+       $(RC2TEST).c $(RC4TEST).c $(RC5TEST).c $(DANETEST).c \
+       $(DESTEST).c $(SHA1TEST).c $(MDC2TEST).c $(RMDTEST).c \
+       $(RANDTEST).c $(DHTEST).c $(ENGINETEST).c $(CASTTEST).c \
+       $(BFTEST).c  $(SSLTEST).c $(DSATEST).c   $(EXPTEST).c $(RSATEST).c \
+       $(EVPTEST).c $(EVPEXTRATEST).c $(IGETEST).c $(JPAKETEST).c $(V3NAMETEST).c \
+       $(GOST2814789TEST).c $(HEARTBEATTEST).c $(P5_CRPT2_TEST).c \
+       $(CONSTTIMETEST).c $(VERIFYEXTRATEST).c $(CLIENTHELLOTEST).c \
+       $(PACKETTEST).c $(ASYNCTEST).c testutil.c
+
+HEADER=        testutil.h
+
+ALL=   $(GENERAL) $(SRC) $(HEADER)
+
+top:
+       (cd ..; $(MAKE) DIRS=$(DIR) TESTS=$(TESTS) all)
+
+all:   exe
+
+exe:   $(EXE) dummytest$(EXE_EXT)
+
+files:
+       $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
+
+generate: $(SRC)
+$(SRC):
+       @sh $(TOP)/util/point.sh dummytest.c $@
+
+errors:
+
+tags:
+       ctags $(SRC)
+
+tests: exe apps
+       TOP=$(TOP) PERL=$(PERL) $(PERL) run_tests.pl $(TESTS)
+list-tests:
+       @TOP=$(TOP) PERL=$(PERL) $(PERL) run_tests.pl list
+
+apps:
+       @(cd ..; $(MAKE) DIRS=apps all)
+
+update: local_depend
+       @if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
+
+depend: local_depend
+       @if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
+local_depend:
+       @[ -z "$(THIS)" ] || $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(SRC)
+
+dclean:
+       $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
+       mv -f Makefile.new $(MAKEFILE)
+       rm -f newkey.pem testkey.pem testreq.pem
+
+clean:
+       rm -f .rnd tmp.bntest tmp.bctest *.o *.obj *.dll lib tags core .pure .nfs* *.old *.bak fluff $(EXE) *.ss *.srl log *.log dummytest
+
+$(DLIBSSL):
+       (cd ..; $(MAKE) build_libssl)
+
+$(DLIBCRYPTO):
+       (cd ..; $(MAKE) build_libcrypto)
+
+BUILD_CMD=shlib_target=; if [ -n "$(SHARED_LIBS)" ]; then \
+               shlib_target="$(SHLIB_TARGET)"; \
+       fi; \
+       LIBRARIES="$(LIBSSL) $(LIBCRYPTO)"; \
+       $(MAKE) -f $(TOP)/Makefile.shared -e \
+               APPNAME=$$target$(EXE_EXT) OBJECTS="$$target.o $$testutil" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               link_app.$${shlib_target}
+
+BUILD_CMD_STATIC=shlib_target=; \
+       LIBRARIES="$(DLIBSSL) $(DLIBCRYPTO)"; \
+       $(MAKE) -f $(TOP)/Makefile.shared -e \
+               APPNAME=$$target$(EXE_EXT) OBJECTS="$$target.o $$testutil" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               link_app.$${shlib_target}
+
+$(RSATEST)$(EXE_EXT): $(RSATEST).o $(DLIBCRYPTO)
+       @target=$(RSATEST); $(BUILD_CMD)
+
+$(NPTEST)$(EXE_EXT): $(NPTEST).o $(DLIBCRYPTO)
+       @target=$(NPTEST); $(BUILD_CMD)
+
+$(BNTEST)$(EXE_EXT): $(BNTEST).o $(DLIBCRYPTO)
+       @target=$(BNTEST); $(BUILD_CMD)
+
+$(ECTEST)$(EXE_EXT): $(ECTEST).o $(DLIBCRYPTO)
+       @target=$(ECTEST); $(BUILD_CMD)
+
+$(EXPTEST)$(EXE_EXT): $(EXPTEST).o $(DLIBCRYPTO)
+       @target=$(EXPTEST); $(BUILD_CMD)
+
+$(IDEATEST)$(EXE_EXT): $(IDEATEST).o $(DLIBCRYPTO)
+       @target=$(IDEATEST); $(BUILD_CMD)
+
+$(GMDIFFTEST)$(EXE_EXT): $(GMDIFFTEST).o $(DLIBCRYPTO)
+       @target=$(GMDIFFTEST); $(BUILD_CMD)
+
+$(PBELUTEST)$(EXE_EXT): $(PBELUTEST).o $(DLIBCRYPTO)
+       @target=$(PBELUTEST); $(BUILD_CMD)
+
+$(MD2TEST)$(EXE_EXT): $(MD2TEST).o $(DLIBCRYPTO)
+       @target=$(MD2TEST); $(BUILD_CMD)
+
+$(SHA1TEST)$(EXE_EXT): $(SHA1TEST).o $(DLIBCRYPTO)
+       @target=$(SHA1TEST); $(BUILD_CMD)
+
+$(SHA256TEST)$(EXE_EXT): $(SHA256TEST).o $(DLIBCRYPTO)
+       @target=$(SHA256TEST); $(BUILD_CMD)
+
+$(SHA512TEST)$(EXE_EXT): $(SHA512TEST).o $(DLIBCRYPTO)
+       @target=$(SHA512TEST); $(BUILD_CMD)
+
+FIPS_BUILD_CMD=shlib_target=; if [ -n "$(SHARED_LIBS)" ]; then \
+               shlib_target="$(SHLIB_TARGET)"; \
+       fi; \
+       if [ "$(FIPSCANLIB)" = "libfips" ]; then \
+               LIBRARIES="-L$(TOP) -lfips"; \
+       elif [ -n "$(FIPSCANLIB)" ]; then \
+               FIPSLD_CC="$(CC)"; CC=$(TOP)/fips/fipsld; export CC FIPSLD_CC; \
+               LIBRARIES="$${FIPSLIBDIR:-$(TOP)/fips/}fipscanister.o"; \
+       else \
+               LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(MAKE) -f $(TOP)/Makefile.shared -e \
+               CC="$${CC}" APPNAME=$$target$(EXE_EXT) OBJECTS="$$target.o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               link_app.$${shlib_target}
+
+FIPS_CRYPTO_BUILD_CMD=shlib_target=; if [ -n "$(SHARED_LIBS)" ]; then \
+               shlib_target="$(SHLIB_TARGET)"; \
+       fi; \
+       LIBRARIES="$(LIBSSL) $(LIBCRYPTO)"; \
+       if [ -z "$(SHARED_LIBS)" -a -n "$(FIPSCANLIB)" ] ; then \
+               FIPSLD_CC="$(CC)"; CC=$(TOP)/fips/fipsld; export CC FIPSLD_CC; \
+       fi; \
+       [ "$(FIPSCANLIB)" = "libfips" ] && LIBRARIES="$$LIBRARIES -lfips"; \
+       $(MAKE) -f $(TOP)/Makefile.shared -e \
+               CC="$${CC}" APPNAME=$$target$(EXE_EXT) OBJECTS="$$target.o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               link_app.$${shlib_target}
+
+$(RMDTEST)$(EXE_EXT): $(RMDTEST).o $(DLIBCRYPTO)
+       @target=$(RMDTEST); $(BUILD_CMD)
+
+$(MDC2TEST)$(EXE_EXT): $(MDC2TEST).o $(DLIBCRYPTO)
+       @target=$(MDC2TEST); $(BUILD_CMD)
+
+$(MD4TEST)$(EXE_EXT): $(MD4TEST).o $(DLIBCRYPTO)
+       @target=$(MD4TEST); $(BUILD_CMD)
+
+$(MD5TEST)$(EXE_EXT): $(MD5TEST).o $(DLIBCRYPTO)
+       @target=$(MD5TEST); $(BUILD_CMD)
+
+$(HMACTEST)$(EXE_EXT): $(HMACTEST).o $(DLIBCRYPTO)
+       @target=$(HMACTEST); $(BUILD_CMD)
+
+$(WPTEST)$(EXE_EXT): $(WPTEST).o $(DLIBCRYPTO)
+       @target=$(WPTEST); $(BUILD_CMD)
+
+$(RC2TEST)$(EXE_EXT): $(RC2TEST).o $(DLIBCRYPTO)
+       @target=$(RC2TEST); $(BUILD_CMD)
+
+$(BFTEST)$(EXE_EXT): $(BFTEST).o $(DLIBCRYPTO)
+       @target=$(BFTEST); $(BUILD_CMD)
+
+$(CASTTEST)$(EXE_EXT): $(CASTTEST).o $(DLIBCRYPTO)
+       @target=$(CASTTEST); $(BUILD_CMD)
+
+$(RC4TEST)$(EXE_EXT): $(RC4TEST).o $(DLIBCRYPTO)
+       @target=$(RC4TEST); $(BUILD_CMD)
+
+$(RC5TEST)$(EXE_EXT): $(RC5TEST).o $(DLIBCRYPTO)
+       @target=$(RC5TEST); $(BUILD_CMD)
+
+$(DESTEST)$(EXE_EXT): $(DESTEST).o $(DLIBCRYPTO)
+       @target=$(DESTEST); $(BUILD_CMD)
+
+$(GOST2814789TEST)$(EXE_EXT): $(GOST2814789TEST).o $(DLIBCRYPTO)
+       @target=$(GOST2814789TEST); $(BUILD_CMD)
+
+$(RANDTEST)$(EXE_EXT): $(RANDTEST).o $(DLIBCRYPTO)
+       @target=$(RANDTEST); $(BUILD_CMD)
+
+$(DHTEST)$(EXE_EXT): $(DHTEST).o $(DLIBCRYPTO)
+       @target=$(DHTEST); $(BUILD_CMD)
+
+$(DSATEST)$(EXE_EXT): $(DSATEST).o $(DLIBCRYPTO)
+       @target=$(DSATEST); $(BUILD_CMD)
+
+$(METHTEST)$(EXE_EXT): $(METHTEST).o $(DLIBCRYPTO)
+       @target=$(METHTEST); $(BUILD_CMD)
+
+$(SSLTEST)$(EXE_EXT): $(SSLTEST).o $(DLIBSSL) $(DLIBCRYPTO)
+       @target=$(SSLTEST); $(BUILD_CMD)
+
+$(DANETEST)$(EXE_EXT): $(DANETEST).o $(DLIBSSL) $(DLIBCRYPTO)
+       @target=$(DANETEST); $(BUILD_CMD)
+
+$(ENGINETEST)$(EXE_EXT): $(ENGINETEST).o $(DLIBCRYPTO)
+       @target=$(ENGINETEST); $(BUILD_CMD)
+
+$(EVPTEST)$(EXE_EXT): $(EVPTEST).o $(DLIBCRYPTO)
+       @target=$(EVPTEST); $(BUILD_CMD)
+
+$(EVPEXTRATEST)$(EXE_EXT): $(EVPEXTRATEST).o $(DLIBCRYPTO)
+       @target=$(EVPEXTRATEST); $(BUILD_CMD)
+
+$(P5_CRPT2_TEST)$(EXE_EXT): $(P5_CRPT2_TEST).o $(DLIBCRYPTO)
+       @target=$(P5_CRPT2_TEST); $(BUILD_CMD)
+
+$(ECDSATEST)$(EXE_EXT): $(ECDSATEST).o $(DLIBCRYPTO)
+       @target=$(ECDSATEST); $(BUILD_CMD)
+
+$(ECDHTEST)$(EXE_EXT): $(ECDHTEST).o $(DLIBCRYPTO)
+       @target=$(ECDHTEST); $(BUILD_CMD)
+
+$(IGETEST)$(EXE_EXT): $(IGETEST).o $(DLIBCRYPTO)
+       @target=$(IGETEST); $(BUILD_CMD)
+
+$(JPAKETEST)$(EXE_EXT): $(JPAKETEST).o $(DLIBCRYPTO)
+       @target=$(JPAKETEST); $(BUILD_CMD)
+
+$(SECMEMTEST)$(EXE_EXT): $(SECMEMTEST).o $(DLIBCRYPTO)
+       @target=$(SECMEMTEST); $(BUILD_CMD)
+
+$(SRPTEST)$(EXE_EXT): $(SRPTEST).o $(DLIBCRYPTO)
+       @target=$(SRPTEST); $(BUILD_CMD)
+
+$(V3NAMETEST)$(EXE_EXT): $(V3NAMETEST).o $(DLIBCRYPTO)
+       @target=$(V3NAMETEST); $(BUILD_CMD)
+
+$(HEARTBEATTEST)$(EXE_EXT): $(HEARTBEATTEST).o $(DLIBCRYPTO) testutil.o
+       @target=$(HEARTBEATTEST) testutil=testutil.o; $(BUILD_CMD_STATIC)
+
+$(CONSTTIMETEST)$(EXE_EXT): $(CONSTTIMETEST).o
+       @target=$(CONSTTIMETEST) $(BUILD_CMD)
+
+$(VERIFYEXTRATEST)$(EXE_EXT): $(VERIFYEXTRATEST).o
+       @target=$(VERIFYEXTRATEST) $(BUILD_CMD)
+
+$(CLIENTHELLOTEST)$(EXE_EXT): $(CLIENTHELLOTEST).o
+       @target=$(CLIENTHELLOTEST) $(BUILD_CMD)
+
+$(PACKETTEST)$(EXE_EXT): $(PACKETTEST).o
+       @target=$(PACKETTEST) $(BUILD_CMD)
+
+$(ASYNCTEST)$(EXE_EXT): $(ASYNCTEST).o
+       @target=$(ASYNCTEST) $(BUILD_CMD)
+
+#$(AESTEST).o: $(AESTEST).c
+#      $(CC) -c $(CFLAGS) -DINTERMEDIATE_VALUE_KAT -DTRACE_KAT_MCT $(AESTEST).c
+
+#$(AESTEST)$(EXE_EXT): $(AESTEST).o $(DLIBCRYPTO)
+#      if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
+#        $(CC) -o $(AESTEST)$(EXE_EXT) $(CFLAGS) $(AESTEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+#      else \
+#        $(CC) -o $(AESTEST)$(EXE_EXT) $(CFLAGS) $(AESTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
+#      fi
+
+dummytest$(EXE_EXT): dummytest.o $(DLIBCRYPTO)
+       @target=dummytest; $(BUILD_CMD)
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+asynctest.o: ../e_os.h ../include/../apps/apps.h ../include/../apps/progs.h
+asynctest.o: ../include/openssl/asn1.h ../include/openssl/async.h
+asynctest.o: ../include/openssl/bio.h ../include/openssl/buffer.h
+asynctest.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+asynctest.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+asynctest.o: ../include/openssl/engine.h ../include/openssl/evp.h
+asynctest.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+asynctest.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+asynctest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+asynctest.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+asynctest.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+asynctest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+asynctest.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+asynctest.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h
+asynctest.o: asynctest.c
+bftest.o: ../e_os.h ../include/openssl/blowfish.h ../include/openssl/e_os2.h
+bftest.o: ../include/openssl/opensslconf.h bftest.c
+bntest.o: ../crypto/bn/bn_lcl.h ../crypto/include/internal/bn_int.h ../e_os.h
+bntest.o: ../include/openssl/asn1.h ../include/openssl/bio.h
+bntest.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+bntest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+bntest.o: ../include/openssl/ec.h ../include/openssl/err.h
+bntest.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+bntest.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+bntest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+bntest.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+bntest.o: ../include/openssl/rand.h ../include/openssl/safestack.h
+bntest.o: ../include/openssl/sha.h ../include/openssl/stack.h
+bntest.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
+bntest.o: ../include/openssl/x509_vfy.h bntest.c
+casttest.o: ../e_os.h ../include/openssl/cast.h ../include/openssl/e_os2.h
+casttest.o: ../include/openssl/opensslconf.h casttest.c
+clienthellotest.o: ../include/openssl/asn1.h ../include/openssl/bio.h
+clienthellotest.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+clienthellotest.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h
+clienthellotest.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+clienthellotest.o: ../include/openssl/err.h ../include/openssl/evp.h
+clienthellotest.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+clienthellotest.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+clienthellotest.o: ../include/openssl/opensslconf.h
+clienthellotest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+clienthellotest.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+clienthellotest.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
+clienthellotest.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+clienthellotest.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+clienthellotest.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+clienthellotest.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+clienthellotest.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+clienthellotest.o: clienthellotest.c
+constant_time_test.o: ../e_os.h ../include/internal/constant_time_locl.h
+constant_time_test.o: ../include/openssl/e_os2.h
+constant_time_test.o: ../include/openssl/opensslconf.h constant_time_test.c
+danetest.o: ../e_os.h ../include/internal/dane.h ../include/openssl/asn1.h
+danetest.o: ../include/openssl/bio.h ../include/openssl/buffer.h
+danetest.o: ../include/openssl/comp.h ../include/openssl/conf.h
+danetest.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h
+danetest.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+danetest.o: ../include/openssl/engine.h ../include/openssl/err.h
+danetest.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+danetest.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+danetest.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+danetest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+danetest.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+danetest.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
+danetest.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+danetest.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+danetest.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+danetest.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+danetest.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h danetest.c
+destest.o: ../include/openssl/des.h ../include/openssl/e_os2.h
+destest.o: ../include/openssl/opensslconf.h destest.c
+dhtest.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/bn.h
+dhtest.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+dhtest.o: ../include/openssl/e_os2.h ../include/openssl/err.h
+dhtest.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
+dhtest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+dhtest.o: ../include/openssl/rand.h ../include/openssl/safestack.h
+dhtest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h dhtest.c
+dsatest.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/bn.h
+dsatest.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+dsatest.o: ../include/openssl/e_os2.h ../include/openssl/err.h
+dsatest.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
+dsatest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+dsatest.o: ../include/openssl/rand.h ../include/openssl/safestack.h
+dsatest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h dsatest.c
+ecdhtest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+ecdhtest.o: ../include/openssl/bn.h ../include/openssl/crypto.h
+ecdhtest.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+ecdhtest.o: ../include/openssl/err.h ../include/openssl/lhash.h
+ecdhtest.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+ecdhtest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+ecdhtest.o: ../include/openssl/ossl_typ.h ../include/openssl/rand.h
+ecdhtest.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ecdhtest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h ecdhtest.c
+ecdsatest.o: ../include/openssl/asn1.h ../include/openssl/bio.h
+ecdsatest.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+ecdsatest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+ecdsatest.o: ../include/openssl/ec.h ../include/openssl/engine.h
+ecdsatest.o: ../include/openssl/err.h ../include/openssl/evp.h
+ecdsatest.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+ecdsatest.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+ecdsatest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+ecdsatest.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
+ecdsatest.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ecdsatest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+ecdsatest.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+ecdsatest.o: ecdsatest.c
+ectest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+ectest.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+ectest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+ectest.o: ../include/openssl/ec.h ../include/openssl/engine.h
+ectest.o: ../include/openssl/err.h ../include/openssl/evp.h
+ectest.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+ectest.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+ectest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+ectest.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
+ectest.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ectest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+ectest.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ectest.c
+enginetest.o: ../include/openssl/asn1.h ../include/openssl/bio.h
+enginetest.o: ../include/openssl/buffer.h ../include/openssl/crypto.h
+enginetest.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+enginetest.o: ../include/openssl/engine.h ../include/openssl/err.h
+enginetest.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+enginetest.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+enginetest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+enginetest.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+enginetest.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+enginetest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+enginetest.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+enginetest.o: enginetest.c
+evp_extra_test.o: ../include/openssl/asn1.h ../include/openssl/bio.h
+evp_extra_test.o: ../include/openssl/buffer.h ../include/openssl/crypto.h
+evp_extra_test.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+evp_extra_test.o: ../include/openssl/err.h ../include/openssl/evp.h
+evp_extra_test.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+evp_extra_test.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+evp_extra_test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+evp_extra_test.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+evp_extra_test.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+evp_extra_test.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+evp_extra_test.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+evp_extra_test.o: evp_extra_test.c
+evp_test.o: ../include/internal/numbers.h ../include/openssl/asn1.h
+evp_test.o: ../include/openssl/bio.h ../include/openssl/buffer.h
+evp_test.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+evp_test.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+evp_test.o: ../include/openssl/err.h ../include/openssl/evp.h
+evp_test.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+evp_test.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+evp_test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+evp_test.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+evp_test.o: ../include/openssl/pkcs12.h ../include/openssl/pkcs7.h
+evp_test.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+evp_test.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+evp_test.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+evp_test.o: ../include/openssl/x509v3.h evp_test.c
+exptest.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/bn.h
+exptest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+exptest.o: ../include/openssl/err.h ../include/openssl/lhash.h
+exptest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+exptest.o: ../include/openssl/ossl_typ.h ../include/openssl/rand.h
+exptest.o: ../include/openssl/safestack.h ../include/openssl/stack.h
+exptest.o: ../include/openssl/symhacks.h exptest.c
+gmdifftest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+gmdifftest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+gmdifftest.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
+gmdifftest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+gmdifftest.o: gmdifftest.c
+gost2814789test.o: ../e_os.h ../engines/ccgost/gost89.h
+gost2814789test.o: ../include/openssl/asn1.h ../include/openssl/bio.h
+gost2814789test.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+gost2814789test.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+gost2814789test.o: ../include/openssl/ec.h ../include/openssl/engine.h
+gost2814789test.o: ../include/openssl/err.h ../include/openssl/evp.h
+gost2814789test.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+gost2814789test.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+gost2814789test.o: ../include/openssl/opensslconf.h
+gost2814789test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+gost2814789test.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
+gost2814789test.o: ../include/openssl/sha.h ../include/openssl/stack.h
+gost2814789test.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
+gost2814789test.o: ../include/openssl/x509_vfy.h gost2814789test.c
+heartbeat_test.o: ../e_os.h ../include/openssl/asn1.h
+heartbeat_test.o: ../include/openssl/async.h ../include/openssl/bio.h
+heartbeat_test.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+heartbeat_test.o: ../include/openssl/comp.h ../include/openssl/crypto.h
+heartbeat_test.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
+heartbeat_test.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+heartbeat_test.o: ../include/openssl/err.h ../include/openssl/evp.h
+heartbeat_test.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+heartbeat_test.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+heartbeat_test.o: ../include/openssl/opensslconf.h
+heartbeat_test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+heartbeat_test.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+heartbeat_test.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+heartbeat_test.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+heartbeat_test.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+heartbeat_test.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+heartbeat_test.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+heartbeat_test.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+heartbeat_test.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+heartbeat_test.o: ../ssl/packet_locl.h ../ssl/record/record.h ../ssl/ssl_locl.h
+heartbeat_test.o: ../ssl/statem/statem.h heartbeat_test.c testutil.h
+hmactest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+hmactest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+hmactest.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+hmactest.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h
+hmactest.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+hmactest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+hmactest.o: ../include/openssl/safestack.h ../include/openssl/stack.h
+hmactest.o: ../include/openssl/symhacks.h hmactest.c
+ideatest.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/idea.h
+ideatest.o: ../include/openssl/opensslconf.h ideatest.c
+igetest.o: ../e_os.h ../include/openssl/aes.h ../include/openssl/crypto.h
+igetest.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
+igetest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+igetest.o: ../include/openssl/rand.h ../include/openssl/safestack.h
+igetest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h igetest.c
+jpaketest.o: ../include/openssl/opensslconf.h jpaketest.c
+md2test.o: ../e_os.h ../include/openssl/e_os2.h
+md2test.o: ../include/openssl/opensslconf.h md2test.c
+md4test.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+md4test.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+md4test.o: ../include/openssl/evp.h ../include/openssl/md4.h
+md4test.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+md4test.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+md4test.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
+md4test.o: ../include/openssl/stack.h ../include/openssl/symhacks.h md4test.c
+md5test.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+md5test.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+md5test.o: ../include/openssl/evp.h ../include/openssl/md5.h
+md5test.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+md5test.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+md5test.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
+md5test.o: ../include/openssl/stack.h ../include/openssl/symhacks.h md5test.c
+mdc2test.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+mdc2test.o: ../include/openssl/crypto.h ../include/openssl/des.h
+mdc2test.o: ../include/openssl/e_os2.h ../include/openssl/evp.h
+mdc2test.o: ../include/openssl/mdc2.h ../include/openssl/obj_mac.h
+mdc2test.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+mdc2test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+mdc2test.o: ../include/openssl/safestack.h ../include/openssl/stack.h
+mdc2test.o: ../include/openssl/symhacks.h mdc2test.c
+nptest.o: nptest.c
+p5_crpt2_test.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+p5_crpt2_test.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+p5_crpt2_test.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+p5_crpt2_test.o: ../include/openssl/ec.h ../include/openssl/engine.h
+p5_crpt2_test.o: ../include/openssl/err.h ../include/openssl/evp.h
+p5_crpt2_test.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+p5_crpt2_test.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+p5_crpt2_test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+p5_crpt2_test.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
+p5_crpt2_test.o: ../include/openssl/sha.h ../include/openssl/stack.h
+p5_crpt2_test.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
+p5_crpt2_test.o: ../include/openssl/x509_vfy.h p5_crpt2_test.c
+packettest.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+packettest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+packettest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+packettest.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
+packettest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+packettest.o: ../ssl/packet_locl.h packettest.c
+pbelutest.o: ../include/openssl/asn1.h ../include/openssl/bio.h
+pbelutest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+pbelutest.o: ../include/openssl/evp.h ../include/openssl/obj_mac.h
+pbelutest.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+pbelutest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+pbelutest.o: ../include/openssl/safestack.h ../include/openssl/stack.h
+pbelutest.o: ../include/openssl/symhacks.h pbelutest.c
+randtest.o: ../e_os.h ../include/openssl/e_os2.h
+randtest.o: ../include/openssl/opensslconf.h ../include/openssl/ossl_typ.h
+randtest.o: ../include/openssl/rand.h randtest.c
+rc2test.o: ../e_os.h ../include/openssl/e_os2.h
+rc2test.o: ../include/openssl/opensslconf.h ../include/openssl/rc2.h rc2test.c
+rc4test.o: ../e_os.h ../include/openssl/e_os2.h
+rc4test.o: ../include/openssl/opensslconf.h ../include/openssl/rc4.h
+rc4test.o: ../include/openssl/sha.h rc4test.c
+rc5test.o: ../e_os.h ../include/openssl/e_os2.h
+rc5test.o: ../include/openssl/opensslconf.h rc5test.c
+rmdtest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+rmdtest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+rmdtest.o: ../include/openssl/evp.h ../include/openssl/obj_mac.h
+rmdtest.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+rmdtest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+rmdtest.o: ../include/openssl/ripemd.h ../include/openssl/safestack.h
+rmdtest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h rmdtest.c
+rsa_test.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+rsa_test.o: ../include/openssl/bn.h ../include/openssl/crypto.h
+rsa_test.o: ../include/openssl/e_os2.h ../include/openssl/err.h
+rsa_test.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
+rsa_test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+rsa_test.o: ../include/openssl/rand.h ../include/openssl/rsa.h
+rsa_test.o: ../include/openssl/safestack.h ../include/openssl/stack.h
+rsa_test.o: ../include/openssl/symhacks.h rsa_test.c
+sha1test.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+sha1test.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+sha1test.o: ../include/openssl/evp.h ../include/openssl/obj_mac.h
+sha1test.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+sha1test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+sha1test.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+sha1test.o: ../include/openssl/stack.h ../include/openssl/symhacks.h sha1test.c
+ssltest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssltest.o: ../include/openssl/bio.h ../include/openssl/bn.h
+ssltest.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssltest.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+ssltest.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+ssltest.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+ssltest.o: ../include/openssl/ec.h ../include/openssl/engine.h
+ssltest.o: ../include/openssl/err.h ../include/openssl/evp.h
+ssltest.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+ssltest.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+ssltest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+ssltest.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+ssltest.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+ssltest.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+ssltest.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+ssltest.o: ../include/openssl/sha.h ../include/openssl/srp.h
+ssltest.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
+ssltest.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
+ssltest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+ssltest.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+ssltest.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h
+ssltest.o: ../ssl/packet_locl.h ../ssl/record/record.h ../ssl/ssl_locl.h
+ssltest.o: ../ssl/statem/statem.h ssltest.c
+testutil.o: ../e_os.h ../include/openssl/e_os2.h
+testutil.o: ../include/openssl/opensslconf.h testutil.c testutil.h
+v3nametest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+v3nametest.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+v3nametest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+v3nametest.o: ../include/openssl/ec.h ../include/openssl/evp.h
+v3nametest.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+v3nametest.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+v3nametest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+v3nametest.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
+v3nametest.o: ../include/openssl/sha.h ../include/openssl/stack.h
+v3nametest.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
+v3nametest.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h
+v3nametest.o: v3nametest.c
+verify_extra_test.o: ../include/openssl/asn1.h ../include/openssl/bio.h
+verify_extra_test.o: ../include/openssl/buffer.h ../include/openssl/crypto.h
+verify_extra_test.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+verify_extra_test.o: ../include/openssl/err.h ../include/openssl/evp.h
+verify_extra_test.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+verify_extra_test.o: ../include/openssl/objects.h
+verify_extra_test.o: ../include/openssl/opensslconf.h
+verify_extra_test.o: ../include/openssl/opensslv.h
+verify_extra_test.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+verify_extra_test.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+verify_extra_test.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+verify_extra_test.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+verify_extra_test.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+verify_extra_test.o: verify_extra_test.c
+wp_test.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+wp_test.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+wp_test.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
+wp_test.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+wp_test.o: ../include/openssl/whrlpool.h wp_test.c
index be41d2b2cf455d534d61f347c287e2cfbe8c9935..3e68b1d01bc88f8e31250f69723a119c80b92e4b 100644 (file)
@@ -282,8 +282,7 @@ int main(int argc, char **argv)
 #ifdef ASYNC_NULL
     fprintf(stderr, "NULL implementation - skipping async tests\n");
 #else
-    CRYPTO_malloc_debug_init();
-    CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
+    CRYPTO_set_mem_debug(1);
     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 
     if (       !test_ASYNC_init()
index 318d6e84f84c1f58b0ef456548f9b6dec538e346..289ca1e57275db171fa0453802f623f461be378c 100644 (file)
@@ -107,8 +107,7 @@ int main(int argc, char *argv[])
 
     err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT);
 
-    CRYPTO_malloc_debug_init();
-    CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
+    CRYPTO_set_mem_debug(1);
     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 
     /*
@@ -212,7 +211,9 @@ int main(int argc, char *argv[])
     ERR_remove_thread_state(NULL);
     EVP_cleanup();
     CRYPTO_cleanup_all_ex_data();
+#ifdef CRYPTO_MDEBUG
     CRYPTO_mem_leaks(err);
+#endif
     BIO_free(err);
 
     return testresult?0:1;
index 063b94470d410de9044ff84734ff2f75efb926f8..2c7c3c621a970c52f14ce7e453c5edf51395a41c 100644 (file)
@@ -301,27 +301,29 @@ static ossl_ssize_t checked_uint8(const char *in, void *out)
     return cp - in;
 }
 
+struct tlsa_field {
+    void *var;
+    const char *name;
+    ossl_ssize_t (*parser)(const char *, void *);
+};
+
 static int tlsa_import_rr(SSL *ssl, const char *rrdata)
 {
-    int ret;
-    uint8_t usage;
-    uint8_t selector;
-    uint8_t mtype;
-    unsigned char *data = NULL;
-    const char *cp = rrdata;
-    ossl_ssize_t len = 0;
-    struct tlsa_field {
-        void *var;
-        const char *name;
-        ossl_ssize_t (*parser)(const char *, void *);
-    } tlsa_fields[] = {
+    static uint8_t usage;
+    static uint8_t selector;
+    static uint8_t mtype;
+    static unsigned char *data = NULL;
+    static struct tlsa_field tlsa_fields[] = {
         { &usage, "usage", checked_uint8 },
         { &selector, "selector", checked_uint8 },
         { &mtype, "mtype", checked_uint8 },
         { &data, "data", hexdecode },
         { NULL, }
     };
+    int ret;
     struct tlsa_field *f;
+    const char *cp = rrdata;
+    ossl_ssize_t len = 0;
 
     for (f = tlsa_fields; f->var; ++f) {
         if ((len = f->parser(cp += len, f->var)) <= 0) {
@@ -452,23 +454,29 @@ static int test_tlsafile(SSL_CTX *ctx, const char *basename,
 
 int main(int argc, char *argv[])
 {
-    progname = argv[0];
     FILE *f;
     BIO *bio_err;
     SSL_CTX *ctx = NULL;
     const char *basedomain;
     const char *CAfile;
     const char *tlsafile;
+    const char *p;
     int ret = 1;
 
+    progname = argv[0];
     if (argc != 4) {
         usage();
         EXIT(1);
     }
     basedomain = argv[1];
+    basedomain++; /* Force a use! */
     CAfile = argv[2];
     tlsafile = argv[3];
 
+    p = getenv("OPENSSL_DEBUG_MEMORY");
+    if (p != NULL && strcmp(p, "on") == 0)
+        CRYPTO_set_mem_debug(1);
+
     f = fopen(tlsafile, "r");
     if (f == NULL) {
         fprintf(stderr, "%s: Error opening tlsa record file: '%s': %s\n",
@@ -478,17 +486,6 @@ int main(int argc, char *argv[])
 
     bio_err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT);
 
-    /* enable memory leak checking unless explicitly disabled */
-    if (!((getenv("OPENSSL_DEBUG_MEMORY") != NULL)
-          && (0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off")))) {
-        CRYPTO_malloc_debug_init();
-        CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
-    } else {
-        /* OPENSSL_DEBUG_MEMORY=off */
-        CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0);
-    }
-    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
-
     SSL_library_init();
     SSL_load_error_strings();
 
index 0ca51757224837823897c2ef52b3566b04783939..93a866c05f6f24bce72311262b5f16dcf96bb2dc 100644 (file)
@@ -96,14 +96,9 @@ int main(int argc, char *argv[])
     int ret = 1;
     BIO *out = NULL;
 
-    CRYPTO_malloc_debug_init();
-    CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
+    CRYPTO_set_mem_debug(1);
     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 
-# ifdef OPENSSL_SYS_WIN32
-    CRYPTO_malloc_init();
-# endif
-
     RAND_seed(rnd_seed, sizeof rnd_seed);
 
     out = BIO_new(BIO_s_file());
index 1f4b8379c4d7712fb0027ea2aab8f5fc37c38663..81c36cb48afd0c80f17f6fc6ec599b9253fab5b7 100644 (file)
@@ -138,8 +138,7 @@ int main(int argc, char **argv)
     if (bio_err == NULL)
         bio_err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT);
 
-    CRYPTO_malloc_debug_init();
-    CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
+    CRYPTO_set_mem_debug(1);
     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 
     ERR_load_crypto_strings();
@@ -216,7 +215,9 @@ int main(int argc, char **argv)
     CRYPTO_cleanup_all_ex_data();
     ERR_remove_thread_state(NULL);
     ERR_free_strings();
+#ifdef CRYPTO_MDEBUG
     CRYPTO_mem_leaks(bio_err);
+#endif
     BIO_free(bio_err);
     bio_err = NULL;
 # ifdef OPENSSL_SYS_NETWARE
index d77e007248a4116a3bba30bcf9aaf94532b3ea8d..c299c32d95939411bd917af8a945ad5dfcf19d37 100644 (file)
@@ -452,14 +452,9 @@ int main(int argc, char *argv[])
     int ret = 1;
     BIO *out;
 
-    CRYPTO_malloc_debug_init();
-    CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
+    CRYPTO_set_mem_debug(1);
     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 
-# ifdef OPENSSL_SYS_WIN32
-    CRYPTO_malloc_init();
-# endif
-
     RAND_seed(rnd_seed, sizeof rnd_seed);
 
     out = BIO_new(BIO_s_file());
@@ -521,7 +516,9 @@ int main(int argc, char *argv[])
     BIO_free(out);
     CRYPTO_cleanup_all_ex_data();
     ERR_remove_thread_state(NULL);
+#ifdef CRYPTO_MDEBUG
     CRYPTO_mem_leaks_fp(stderr);
+#endif
     EXIT(ret);
 }
 #endif
index 023eb1241fb70b0390fba584b242abef7189139b..2e85d5e04bb016aa05bf7f4a3068ca6bb2b87b56 100644 (file)
@@ -516,20 +516,13 @@ int main(void)
 {
     int ret = 1;
     BIO *out;
+    char *p;
 
     out = BIO_new_fp(stdout, BIO_NOCLOSE | BIO_FP_TEXT);
 
-    /* enable memory leak checking unless explicitly disabled */
-    if (!((getenv("OPENSSL_DEBUG_MEMORY") != NULL) &&
-          (0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off")))) {
-        CRYPTO_malloc_debug_init();
-        CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
-    } else {
-        /* OPENSSL_DEBUG_MEMORY=off */
-        CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0);
-    }
-    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
-
+    p = getenv("OPENSSL_DEBUG_MEMORY");
+    if (p != NULL && strcmp(p, "on") == 0)
+        CRYPTO_set_mem_debug(1);
     ERR_load_crypto_strings();
 
     /* initialize the prng */
@@ -552,7 +545,9 @@ int main(void)
     CRYPTO_cleanup_all_ex_data();
     ERR_remove_thread_state(NULL);
     ERR_free_strings();
+#ifdef CRYPTO_MDEBUG
     CRYPTO_mem_leaks(out);
+#endif
     BIO_free(out);
     return ret;
 }
index c6f1d7e1ff3519348cf78188b770c5603a4531ce..96677723150bfcd158b09ddae77dfb95b51730af 100644 (file)
@@ -1637,16 +1637,11 @@ static const char rnd_seed[] =
 
 int main(int argc, char *argv[])
 {
+    char *p;
 
-    /* enable memory leak checking unless explicitly disabled */
-    if (!((getenv("OPENSSL_DEBUG_MEMORY") != NULL)
-          && (0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off")))) {
-        CRYPTO_malloc_debug_init();
-        CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
-    } else {
-        /* OPENSSL_DEBUG_MEMORY=off */
-        CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0);
-    }
+    p = getenv("OPENSSL_DEBUG_MEMORY");
+    if (p != NULL && strcmp(p, "on") == 0)
+        CRYPTO_set_mem_debug(1);
     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
     ERR_load_crypto_strings();
 
@@ -1669,7 +1664,9 @@ int main(int argc, char *argv[])
     CRYPTO_cleanup_all_ex_data();
     ERR_free_strings();
     ERR_remove_thread_state(NULL);
+#ifdef CRYPTO_MDEBUG
     CRYPTO_mem_leaks_fp(stderr);
+#endif
 
     return 0;
 }
index bbe40e64f5d5ff4717a83ae99c89740315827711..f5924e07b65ed6c047f864b8578960fd8a9e4115 100644 (file)
@@ -98,7 +98,7 @@ int main(int argc, char *argv[])
 {
     ENGINE *block[512];
     char buf[256];
-    const char *id, *name;
+    const char *id, *name, *p;
     ENGINE *ptr;
     int loop;
     int to_return = 1;
@@ -107,16 +107,9 @@ int main(int argc, char *argv[])
     ENGINE *new_h3 = NULL;
     ENGINE *new_h4 = NULL;
 
-    /* enable memory leak checking unless explicitly disabled */
-    if (!((getenv("OPENSSL_DEBUG_MEMORY") != NULL)
-          && (0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off")))) {
-        CRYPTO_malloc_debug_init();
-        CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
-    } else {
-        /* OPENSSL_DEBUG_MEMORY=off */
-        CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0);
-    }
-    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
+    p = getenv("OPENSSL_DEBUG_MEMORY");
+    if (p != NULL && strcmp(p, "on") == 0)
+        CRYPTO_set_mem_debug(1);
     ERR_load_crypto_strings();
 
     memset(block, 0, sizeof(block));
@@ -256,7 +249,9 @@ int main(int argc, char *argv[])
     CRYPTO_cleanup_all_ex_data();
     ERR_free_strings();
     ERR_remove_thread_state(NULL);
+#ifdef CRYPTO_MDEBUG
     CRYPTO_mem_leaks_fp(stderr);
+#endif
     return to_return;
 }
 #endif
index a5363085f5d1d2837e19d367a699af7391e73f88..0d6ad03eb387d255e8afa1b049ce2cfdb4d4aa3a 100644 (file)
@@ -419,8 +419,7 @@ static int test_EVP_PKCS82PKEY(void)
 
 int main(void)
 {
-    CRYPTO_malloc_debug_init();
-    CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
+    CRYPTO_set_mem_debug(1);
     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 
     ERR_load_crypto_strings();
@@ -467,7 +466,9 @@ int main(void)
     CRYPTO_cleanup_all_ex_data();
     ERR_remove_thread_state(NULL);
     ERR_free_strings();
+#ifdef CRYPTO_MDEBUG
     CRYPTO_mem_leaks_fp(stderr);
+#endif
 
     printf("PASS\n");
     return 0;
index 15f00cf2e54c9a7cdcaacbccb88550d40ec89546..2771e511adfc95be32e799be4c90a05085f69f0c 100644 (file)
@@ -116,8 +116,7 @@ int main(int argc, char **argv)
 
     bio_err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT);
 
-    CRYPTO_malloc_debug_init();
-    CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
+    CRYPTO_set_mem_debug_functions(1)
     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 
     ERR_load_crypto_strings();
diff --git a/test/memleaktest.c b/test/memleaktest.c
new file mode 100644 (file)
index 0000000..cccbcf6
--- /dev/null
@@ -0,0 +1,88 @@
+/* ====================================================================
+ * Copyright (c) 2015 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <openssl/bio.h>
+#include <openssl/crypto.h>
+
+int main(int argc, char **argv)
+{
+#ifdef CRYPTO_MDEBUG
+    char *p;
+    char *lost;
+
+    p = getenv("OPENSSL_DEBUG_MEMORY");
+    if (p != NULL && strcmp(p, "on") == 0)
+        CRYPTO_set_mem_debug(1);
+    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
+
+    lost = OPENSSL_malloc(3);
+    if (lost == NULL) {
+        fprintf(stderr, "OPENSSL_malloc failed\n");
+        return 1;
+    }
+
+    if (argv[1] && strcmp(argv[1], "freeit") == 0)
+        OPENSSL_free(lost);
+
+    CRYPTO_mem_leaks_fp(stderr);
+    return 0;
+#else
+    if (argv[1] && strcmp(argv[1], "freeit") == 0)
+        return 0;
+    fprintf(stderr, "Leak simulated\n");
+    return 1;
+#endif
+}
index 01661b15eda3603af2a124c30c7ee4361b6d0257..657d10e7683882845f23df6ea370d2f0275acc5b 100644 (file)
@@ -180,8 +180,7 @@ int main(int argc, char **argv)
     int i;
     testdata *test = test_cases;
 
-    CRYPTO_malloc_debug_init();
-    CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
+    CRYPTO_set_mem_debug(1);
     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 
     OpenSSL_add_all_digests();
@@ -206,6 +205,8 @@ int main(int argc, char **argv)
     CRYPTO_cleanup_all_ex_data();
     ERR_remove_thread_state(NULL);
     ERR_free_strings();
+# ifdef CRYPTO_MDEBUG
     CRYPTO_mem_leaks_fp(stderr);
+# endif
     return 0;
 }
diff --git a/test/recipes/90-test_memleak.t b/test/recipes/90-test_memleak.t
new file mode 100644 (file)
index 0000000..7aff0c0
--- /dev/null
@@ -0,0 +1,7 @@
+#! /usr/bi/nperl
+
+use OpenSSL::Test;
+
+setup("test_memleak");
+plan tests => 1;
+ok(!run(test(["memleaktest"])), "running memleaktest");
index 85c7440b8c6805125dc4bf977c01296f246588a0..3cfd32edb4e4d595ce81d869cf1831c160890e11 100644 (file)
@@ -222,8 +222,7 @@ int main(int argc, char *argv[])
     int num;
     int n;
 
-    CRYPTO_malloc_debug_init();
-    CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
+    CRYPTO_set_mem_debug(1);
     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 
     RAND_seed(rnd_seed, sizeof rnd_seed); /* or OAEP may fail */
@@ -328,7 +327,9 @@ int main(int argc, char *argv[])
     CRYPTO_cleanup_all_ex_data();
     ERR_remove_thread_state(NULL);
 
+#ifdef CRYPTO_MDEBUG
     CRYPTO_mem_leaks_fp(stderr);
+#endif
 
 # ifdef OPENSSL_SYS_NETWARE
     if (err)
index 60cdbc31fd5221af0d87ae76b4b8a996ae9faacf..03e8cf438ad35d2c1a79a5f83ca75754f4d5d9a2 100644 (file)
@@ -126,8 +126,7 @@ int main(int argc, char **argv)
     BIO *bio_err;
     bio_err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT);
 
-    CRYPTO_malloc_debug_init();
-    CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
+    CRYPTO_set_mem_debug(1);
     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 
     ERR_load_crypto_strings();
@@ -147,7 +146,9 @@ int main(int argc, char **argv)
     CRYPTO_cleanup_all_ex_data();
     ERR_remove_thread_state(NULL);
     ERR_free_strings();
+#ifdef CRYPTO_MDEBUG
     CRYPTO_mem_leaks(bio_err);
+#endif
     BIO_free(bio_err);
 
     return 0;
index 44d001965e83955274d5abd1d12ad6784496519b..c3d655e36f2deaecba844de2202f7cb8bdb4133f 100644 (file)
@@ -1009,6 +1009,7 @@ int main(int argc, char *argv[])
     int server_auth = 0, i;
     struct app_verify_arg app_verify_arg =
         { APP_CALLBACK_STRING, 0, 0, NULL, NULL };
+    char *p;
 #ifndef OPENSSL_NO_EC
     char *named_curve = NULL;
 #endif
@@ -1059,15 +1060,9 @@ int main(int argc, char *argv[])
 
     CRYPTO_set_locking_callback(lock_dbg_cb);
 
-    /* enable memory leak checking unless explicitly disabled */
-    if (!((getenv("OPENSSL_DEBUG_MEMORY") != NULL)
-          && (0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off")))) {
-        CRYPTO_malloc_debug_init();
-        CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
-    } else {
-        /* OPENSSL_DEBUG_MEMORY=off */
-        CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0);
-    }
+    p = getenv("OPENSSL_DEBUG_MEMORY");
+    if (p != NULL && strcmp(p, "on") == 0)
+        CRYPTO_set_mem_debug(1);
     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 
     RAND_seed(rnd_seed, sizeof rnd_seed);
@@ -1826,7 +1821,9 @@ int main(int argc, char *argv[])
     ERR_free_strings();
     ERR_remove_thread_state(NULL);
     EVP_cleanup();
+#ifdef CRYPTO_MDEBUG
     CRYPTO_mem_leaks(bio_err);
+#endif
     BIO_free(bio_err);
     EXIT(ret);
 }
index 7cc673929ccf04e51605f3782cdaa900a52fa5ba..005fae63c01f1266303a0a17ae19c8712b444ffa 100644 (file)
@@ -187,8 +187,7 @@ static int test_alt_chains_cert_forgery(const char *roots_f,
 
 int main(int argc, char **argv)
 {
-    CRYPTO_malloc_debug_init();
-    CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
+    CRYPTO_set_mem_debug(1);
     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 
     ERR_load_crypto_strings();
@@ -208,7 +207,9 @@ int main(int argc, char **argv)
     CRYPTO_cleanup_all_ex_data();
     ERR_remove_thread_state(NULL);
     ERR_free_strings();
+#ifdef CRYPTO_MDEBUG
     CRYPTO_mem_leaks_fp(stderr);
+#endif
 
     printf("PASS\n");
     return 0;
index a202fcab80c3912f8fc1dc39f03998bb20b5cb5e..45e0d28ab57577c4cc75e7c2ffd633f7a9ee48eb 100755 (executable)
@@ -159,16 +159,15 @@ BN_value_one                            166       1_1_0   EXIST::FUNCTION:
 BUF_MEM_free                            167    1_1_0   EXIST::FUNCTION:
 BUF_MEM_grow                            168    1_1_0   EXIST::FUNCTION:
 BUF_MEM_new                             169    1_1_0   EXIST::FUNCTION:
-BUF_strdup                              170    1_1_0   NOEXIST::FUNCTION:
 CONF_free                               171    1_1_0   EXIST::FUNCTION:
 CONF_get_number                         172    1_1_0   EXIST::FUNCTION:
 CONF_get_section                        173    1_1_0   EXIST::FUNCTION:
 CONF_get_string                         174    1_1_0   EXIST::FUNCTION:
 CONF_load                               175    1_1_0   EXIST::FUNCTION:
 CRYPTO_add_lock                         176    1_1_0   EXIST::FUNCTION:
-CRYPTO_dbg_free                         177    1_1_0   EXIST::FUNCTION:
-CRYPTO_dbg_malloc                       178    1_1_0   EXIST::FUNCTION:
-CRYPTO_dbg_realloc                      179    1_1_0   EXIST::FUNCTION:
+CRYPTO_mem_debug_free                   177    1_1_0   EXIST::FUNCTION:
+CRYPTO_mem_debug_malloc                 178    1_1_0   EXIST::FUNCTION:
+CRYPTO_mem_debug_realloc                179    1_1_0   EXIST::FUNCTION:
 CRYPTO_dbg_remalloc                     180    1_1_0   NOEXIST::FUNCTION:
 CRYPTO_free                             181    1_1_0   EXIST::FUNCTION:
 CRYPTO_get_add_lock_callback            182    1_1_0   EXIST::FUNCTION:
@@ -180,7 +179,7 @@ CRYPTO_lock                             187 1_1_0   EXIST::FUNCTION:
 CRYPTO_malloc                           188    1_1_0   EXIST::FUNCTION:
 CRYPTO_mem_ctrl                         189    1_1_0   EXIST::FUNCTION:
 CRYPTO_mem_leaks                        190    1_1_0   EXIST::FUNCTION:
-CRYPTO_mem_leaks_cb                     191    1_1_0   EXIST::FUNCTION:
+CRYPTO_mem_leaks_cb                     191    1_1_0   NOEXIST::FUNCTION:
 CRYPTO_mem_leaks_fp                     192    1_1_0   EXIST::FUNCTION:STDIO
 CRYPTO_realloc                          193    1_1_0   EXIST::FUNCTION:
 CRYPTO_remalloc                         194    1_1_0   NOEXIST::FUNCTION:
@@ -1679,14 +1678,12 @@ PKCS7_simple_smimecap                   2153    1_1_0   EXIST::FUNCTION:
 PKCS7_get_smimecap                      2154   1_1_0   EXIST::FUNCTION:
 PKCS7_sign                              2155   1_1_0   EXIST::FUNCTION:
 PKCS7_add_attrib_smimecap               2156   1_1_0   EXIST::FUNCTION:
-CRYPTO_dbg_set_options                  2157   1_1_0   EXIST::FUNCTION:
+CRYPTO_dbg_set_options                  2157   1_1_0   NOEXIST::FUNCTION:
 CRYPTO_remove_all_info                  2158   1_1_0   NOEXIST::FUNCTION:
-CRYPTO_get_mem_debug_functions          2159   1_1_0   EXIST::FUNCTION:
-CRYPTO_is_mem_check_on                  2160   1_1_0   EXIST::FUNCTION:
-CRYPTO_set_mem_debug_functions          2161   1_1_0   EXIST::FUNCTION:
-CRYPTO_mem_debug_pop                    2162   1_1_0   EXIST::FUNCTION:
-CRYPTO_mem_debug_push                   2163   1_1_0   EXIST::FUNCTION:
-CRYPTO_set_mem_debug_options            2164   1_1_0   EXIST::FUNCTION:
+CRYPTO_get_mem_debug_functions          2159   1_1_0   NOEXIST::FUNCTION:
+CRYPTO_is_mem_check_on                  2160   1_1_0   NOEXIST::FUNCTION:
+CRYPTO_set_mem_debug_functions          2161   1_1_0   NOEXIST::FUNCTION:
+CRYPTO_set_mem_debug_options            2164   1_1_0   NOEXIST::FUNCTION:
 PEM_write_PKCS8PrivateKey_nid           2165   1_1_0   EXIST::FUNCTION:STDIO
 PEM_write_bio_PKCS8PrivateKey_nid       2166   1_1_0   EXIST:!VMS:FUNCTION:
 PEM_write_bio_PKCS8PrivKey_nid          2166   1_1_0   EXIST:VMS:FUNCTION:
@@ -1750,9 +1747,9 @@ BN_CTX_start                            2242      1_1_0   EXIST::FUNCTION:
 BN_CTX_get                              2243   1_1_0   EXIST::FUNCTION:
 EVP_PKEY2PKCS8_broken                   2244   1_1_0   EXIST::FUNCTION:
 ASN1_STRING_TABLE_add                   2245   1_1_0   EXIST::FUNCTION:
-CRYPTO_dbg_get_options                  2246   1_1_0   EXIST::FUNCTION:
+CRYPTO_dbg_get_options                  2246   1_1_0   NOEXIST::FUNCTION:
 AUTHORITY_INFO_ACCESS_new               2247   1_1_0   EXIST::FUNCTION:
-CRYPTO_get_mem_debug_options            2248   1_1_0   EXIST::FUNCTION:
+CRYPTO_get_mem_debug_options            2248   1_1_0   NOEXIST::FUNCTION:
 DES_crypt                               2249   1_1_0   EXIST::FUNCTION:DES
 PEM_write_bio_X509_REQ_NEW              2250   1_1_0   EXIST::FUNCTION:
 PEM_write_X509_REQ_NEW                  2251   1_1_0   EXIST::FUNCTION:
@@ -2233,7 +2230,6 @@ DIRECTORYSTRING_it                      2767      1_1_0   EXIST:!EXPORT_VAR_AS_FUNCTION
 DIRECTORYSTRING_it                      2767   1_1_0   EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
 d2i_OCSP_CRLID                          2768   1_1_0   EXIST::FUNCTION:
 EC_POINT_is_on_curve                    2769   1_1_0   EXIST::FUNCTION:EC
-CRYPTO_set_locked_mem_ex_funcs          2770   1_1_0   NOEXIST::FUNCTION:
 CRYPTO_set_locked_mem_ex_functions      2770   1_1_0   NOEXIST::FUNCTION:
 d2i_KRB5_CHECKSUM                       2771   1_1_0   NOEXIST::FUNCTION:
 ASN1_item_dup                           2772   1_1_0   EXIST::FUNCTION:
@@ -2243,13 +2239,10 @@ BN_mod_add                              2774    1_1_0   EXIST::FUNCTION:
 KRB5_AUTHDATA_free                      2775   1_1_0   NOEXIST::FUNCTION:
 _ossl_old_des_cbc_cksum                 2776   1_1_0   NOEXIST::FUNCTION:
 ASN1_item_verify                        2777   1_1_0   EXIST::FUNCTION:
-CRYPTO_set_mem_ex_functions             2778   1_1_0   EXIST::FUNCTION:
 EC_POINT_get_Jprojective_coordinates_GFp 2779  1_1_0   EXIST:!VMS:FUNCTION:EC
 EC_POINT_get_Jproj_coords_GFp           2779   1_1_0   EXIST:VMS:FUNCTION:EC
 ZLONG_it                                2780   1_1_0   EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
 ZLONG_it                                2780   1_1_0   EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
-CRYPTO_get_locked_mem_ex_funcs          2781   1_1_0   NOEXIST::FUNCTION:
-CRYPTO_get_locked_mem_ex_functions      2781   1_1_0   NOEXIST::FUNCTION:
 ASN1_TIME_check                         2782   1_1_0   EXIST::FUNCTION:
 UI_get0_user_data                       2783   1_1_0   EXIST::FUNCTION:
 HMAC_CTX_cleanup                        2784   1_1_0   NOEXIST::FUNCTION:
@@ -2339,7 +2332,6 @@ OCSP_ONEREQ_get_ext                     2851      1_1_0   EXIST::FUNCTION:
 EC_POINT_method_of                      2852   1_1_0   EXIST::FUNCTION:EC
 i2d_KRB5_APREQBODY                      2853   1_1_0   NOEXIST::FUNCTION:
 _ossl_old_des_ecb3_encrypt              2854   1_1_0   NOEXIST::FUNCTION:
-CRYPTO_get_mem_ex_functions             2855   1_1_0   EXIST::FUNCTION:
 ENGINE_get_ex_data                      2856   1_1_0   EXIST::FUNCTION:ENGINE
 UI_destroy_method                       2857   1_1_0   EXIST::FUNCTION:
 ASN1_item_i2d_bio                       2858   1_1_0   EXIST::FUNCTION:
@@ -2786,10 +2778,8 @@ EVP_des_ede3_ecb                        3236     1_1_0   EXIST::FUNCTION:DES
 X509_REQ_print_ex                       3237   1_1_0   EXIST::FUNCTION:
 ENGINE_up_ref                           3238   1_1_0   EXIST::FUNCTION:ENGINE
 BUF_MEM_grow_clean                      3239   1_1_0   EXIST::FUNCTION:
-CRYPTO_clear_realloc                    3240   1_1_0   EXIST::FUNCTION:
 BUF_strlcat                             3241   1_1_0   NOEXIST::FUNCTION:
 BIO_indent                              3242   1_1_0   EXIST::FUNCTION:
-BUF_strlcpy                             3243   1_1_0   NOEXIST::FUNCTION:
 OpenSSLDie                              3244   1_1_0   EXIST::FUNCTION:
 OPENSSL_cleanse                         3245   1_1_0   EXIST::FUNCTION:
 ENGINE_setup_bsd_cryptodev              3246   1_1_0   EXIST:__FreeBSD__:FUNCTION:ENGINE
@@ -3051,7 +3041,6 @@ STORE_meth_set_delete_fn                3486      1_1_0   NOEXIST::FUNCTION:
 STORE_method_set_delete_function        3486   1_1_0   NOEXIST::FUNCTION:
 STORE_list_certificate_next             3487   1_1_0   NOEXIST::FUNCTION:
 ASN1_generate_nconf                     3488   1_1_0   EXIST::FUNCTION:
-BUF_memdup                              3489   1_1_0   NOEXIST::FUNCTION:
 BN_GF2m_mod_mul                         3490   1_1_0   EXIST::FUNCTION:EC2M
 STORE_meth_get_list_next_fn             3491   1_1_0   NOEXIST::FUNCTION:
 STORE_method_get_list_next_function     3491   1_1_0   NOEXIST::FUNCTION:
@@ -3077,7 +3066,6 @@ ECDSA_get_ex_data                       3509      1_1_0   NOEXIST::FUNCTION:
 SHA224                                  3510   1_1_0   EXIST::FUNCTION:
 BIO_dump_indent_fp                      3511   1_1_0   EXIST::FUNCTION:STDIO
 EC_KEY_set_group                        3512   1_1_0   EXIST::FUNCTION:EC
-BUF_strndup                             3513   1_1_0   NOEXIST::FUNCTION:
 STORE_list_certificate_start            3514   1_1_0   NOEXIST::FUNCTION:
 BN_GF2m_mod                             3515   1_1_0   EXIST::FUNCTION:EC2M
 X509_REQ_check_private_key              3516   1_1_0   EXIST::FUNCTION:
@@ -3655,7 +3643,6 @@ FIPS_dsa_sig_decode                     4049      1_1_0   NOEXIST::FUNCTION:
 EVP_CIPHER_CTX_clear_flags              4050   1_1_0   EXIST::FUNCTION:
 FIPS_rand_status                        4051   1_1_0   NOEXIST::FUNCTION:
 FIPS_rand_set_key                       4052   1_1_0   NOEXIST::FUNCTION:
-CRYPTO_set_mem_info_functions           4053   1_1_0   NOEXIST::FUNCTION:
 RSA_X931_generate_key_ex                4054   1_1_0   EXIST::FUNCTION:RSA
 int_ERR_set_state_func                  4055   1_1_0   NOEXIST::FUNCTION:
 int_EVP_MD_set_engine_callbacks         4056   1_1_0   NOEXIST::FUNCTION:
@@ -4393,7 +4380,6 @@ X509_VERIFY_PARAM_get0                  4762      1_1_0   EXIST::FUNCTION:
 X509V3_EXT_free                         4763   1_1_0   NOEXIST::FUNCTION:
 BIO_hex_string                          4764   1_1_0   EXIST::FUNCTION:
 X509_VERIFY_PARAM_set_hostflags         4765   1_1_0   EXIST::FUNCTION:
-BUF_strnlen                             4766   1_1_0   NOEXIST::FUNCTION:
 X509_VERIFY_PARAM_get0_peername         4767   1_1_0   EXIST::FUNCTION:
 ECDSA_METHOD_set_app_data               4768   1_1_0   NOEXIST::FUNCTION:
 sk_deep_copy                            4769   1_1_0   EXIST::FUNCTION:
@@ -4560,7 +4546,6 @@ PKCS5_pbe2_set_scrypt                   4931      1_1_0   EXIST::FUNCTION:SCRYPT
 PKCS8_set0_pbe                          4932   1_1_0   EXIST::FUNCTION:
 DH_bits                                 4933   1_1_0   EXIST::FUNCTION:DH
 RSA_bits                                4934   1_1_0   EXIST::FUNCTION:RSA
-CRYPTO_set_secure_mem_ex_functions      4935   1_1_0   EXIST::FUNCTION:
 CRYPTO_secure_allocated                 4936   1_1_0   EXIST::FUNCTION:
 BN_CTX_secure_new                       4937   1_1_0   EXIST::FUNCTION:
 CRYPTO_secure_malloc                    4938   1_1_0   EXIST::FUNCTION:
@@ -4568,12 +4553,9 @@ CRYPTO_secure_malloc_done               4939     1_1_0   EXIST::FUNCTION:
 BUF_MEM_new_ex                          4940   1_1_0   EXIST::FUNCTION:
 CRYPTO_secure_malloc_initialized        4941   1_1_0   EXIST::FUNCTION:
 CRYPTO_secure_malloc_init               4942   1_1_0   EXIST::FUNCTION:
-CRYPTO_get_secure_mem_functions         4943   1_1_0   EXIST::FUNCTION:
 BN_secure_new                           4944   1_1_0   EXIST::FUNCTION:
 CRYPTO_secure_free                      4945   1_1_0   EXIST::FUNCTION:
 BIO_s_secmem                            4946   1_1_0   EXIST::FUNCTION:
-CRYPTO_get_secure_mem_ex_functions      4947   1_1_0   EXIST::FUNCTION:
-CRYPTO_set_secure_mem_functions         4948   1_1_0   EXIST::FUNCTION:
 X509_STORE_CTX_get_num_untrusted        4949   1_1_0   EXIST::FUNCTION:
 X509_up_ref                             4950   1_1_0   EXIST::FUNCTION:
 X509_REQ_get_version                    4951   1_1_0   EXIST::FUNCTION:
@@ -4732,8 +4714,12 @@ EC_KEY_oct2key                          5107     1_1_0   EXIST::FUNCTION:EC
 OPENSSL_strlcpy                         5108   1_1_0   EXIST::FUNCTION:
 OPENSSL_strnlen                         5109   1_1_0   EXIST::FUNCTION:
 OPENSSL_strlcat                         5110   1_1_0   EXIST::FUNCTION:
-OPENSSL_memdup                          5111   1_1_0   NOEXIST::FUNCTION:
 CRYPTO_memdup                           5112   1_1_0   EXIST::FUNCTION:
 CRYPTO_strndup                          5113   1_1_0   EXIST::FUNCTION:
 X509_VERIFY_PARAM_move_peername         5114   1_1_0   EXIST::FUNCTION:
 X509_STORE_CTX_set0_dane                5115   1_1_0   EXIST::FUNCTION:
+CRYPTO_secure_used                      5116   1_1_0   EXIST::FUNCTION:
+CRYPTO_clear_realloc                    5117   1_1_0   EXIST::FUNCTION:
+CRYPTO_mem_debug_push                   5118   1_1_0   EXIST::FUNCTION:
+CRYPTO_set_mem_debug                    5119   1_1_0   EXIST::FUNCTION:
+CRYPTO_mem_debug_pop                    5120   1_1_0   EXIST::FUNCTION: