summaryrefslogtreecommitdiffstats
path: root/crypto/init.c
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2019-04-22 17:18:56 +1000
committerRichard Levitte <levitte@openssl.org>2019-05-03 17:52:50 +0200
commitd2ba812343a62b1f86a15ae09bdeafec6d82f43a (patch)
treee37b3953dae069a3ea00ebdd321f68a29761d627 /crypto/init.c
parente616c11e170ef524b12e218537f4bf290057f8b7 (diff)
Added EVP_KDF (similiar to the EVP_MAC)
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/8808)
Diffstat (limited to 'crypto/init.c')
-rw-r--r--crypto/init.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/crypto/init.c b/crypto/init.c
index d2048ea6cd..58fff701f5 100644
--- a/crypto/init.c
+++ b/crypto/init.c
@@ -293,6 +293,26 @@ DEFINE_RUN_ONCE_STATIC_ALT(ossl_init_no_add_all_macs, ossl_init_add_all_macs)
return 1;
}
+static CRYPTO_ONCE add_all_kdfs = CRYPTO_ONCE_STATIC_INIT;
+DEFINE_RUN_ONCE_STATIC(ossl_init_add_all_kdfs)
+{
+ /*
+ * OPENSSL_NO_AUTOALGINIT is provided here to prevent at compile time
+ * pulling in all the macs during static linking
+ */
+#ifndef OPENSSL_NO_AUTOALGINIT
+ OSSL_TRACE(INIT, "openssl_add_all_kdfs_int()\n");
+ openssl_add_all_kdfs_int();
+#endif
+ return 1;
+}
+
+DEFINE_RUN_ONCE_STATIC_ALT(ossl_init_no_add_all_kdfs, ossl_init_add_all_kdfs)
+{
+ /* Do nothing */
+ return 1;
+}
+
static CRYPTO_ONCE config = CRYPTO_ONCE_STATIC_INIT;
static int config_inited = 0;
static const OPENSSL_INIT_SETTINGS *conf_settings = NULL;
@@ -666,6 +686,15 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings)
&& !RUN_ONCE(&add_all_macs, ossl_init_add_all_macs))
return 0;
+ if ((opts & OPENSSL_INIT_NO_ADD_ALL_KDFS)
+ && !RUN_ONCE_ALT(&add_all_kdfs, ossl_init_no_add_all_kdfs,
+ ossl_init_add_all_kdfs))
+ return 0;
+
+ if ((opts & OPENSSL_INIT_ADD_ALL_KDFS)
+ && !RUN_ONCE(&add_all_kdfs, ossl_init_add_all_kdfs))
+ return 0;
+
if ((opts & OPENSSL_INIT_ATFORK)
&& !openssl_init_fork_handlers())
return 0;