[edk2-devel] [PATCH 18/22] [provider] CryptoPkg/openssl: use our own predefined providers
Gerd Hoffmann
kraxel at redhat.com
Mon Mar 13 08:30:12 UTC 2023
Define our own ossl_predefined_providers, so we can easily
compile out some or all of them for testing purposes.
Effect seems to not be that big though:
1157758 TlsDxe ('default' + 'base' + 'null')
897022 TlsDxe (only 'null')
So not sure yet if we actually want/need this ...
Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
CryptoPkg/Library/OpensslLib/OpensslLib.inf | 1 +
.../Library/OpensslLib/OpensslLibAccel.inf | 1 +
.../Library/OpensslLib/OpensslLibCrypto.inf | 1 +
.../Library/OpensslLib/OpensslLibFull.inf | 1 +
.../OpensslLib/OpensslLibFullAccel.inf | 1 +
CryptoPkg/Library/OpensslLib/provider.c | 21 +++++++++++++++++++
CryptoPkg/Library/OpensslLib/configure.py | 1 +
7 files changed, 27 insertions(+)
create mode 100644 CryptoPkg/Library/OpensslLib/provider.c
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
index b92b1daf2096..05a88d9a13ff 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
@@ -36,6 +36,7 @@ [Sources]
buildinf.h
buildinf.c
ossl_store.c
+ provider.c
rand_pool.c
# SslNull.c
EcSm2Null.c
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf b/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
index 59c5d42bc78e..b2ff45a2f771 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
@@ -39,6 +39,7 @@ [Sources]
buildinf.h
buildinf.c
ossl_store.c
+ provider.c
rand_pool.c
# SslNull.c
EcSm2Null.c
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
index 5bd6fa09ab33..64341653ff9e 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
@@ -37,6 +37,7 @@ [Sources]
buildinf.h
buildinf.c
ossl_store.c
+ provider.c
rand_pool.c
# SslNull.c
EcSm2Null.c
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf b/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
index aaea1bab5b26..fcb898bba2d2 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
@@ -41,6 +41,7 @@ [Sources]
buildinf.h
buildinf.c
ossl_store.c
+ provider.c
rand_pool.c
# SslNull.c
# EcSm2Null.c
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf b/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
index 2f559042dbab..e152ab278c94 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
@@ -43,6 +43,7 @@ [Sources]
# Autogenerated files list ends here
buildinf.h
ossl_store.c
+ provider.c
rand_pool.c
# SslNull.c
# EcSm2Null.c
diff --git a/CryptoPkg/Library/OpensslLib/provider.c b/CryptoPkg/Library/OpensslLib/provider.c
new file mode 100644
index 000000000000..bb17b008270f
--- /dev/null
+++ b/CryptoPkg/Library/OpensslLib/provider.c
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#include <openssl/core.h>
+#include "provider_local.h"
+
+OSSL_provider_init_fn ossl_default_provider_init;
+OSSL_provider_init_fn ossl_base_provider_init;
+OSSL_provider_init_fn ossl_null_provider_init;
+const OSSL_PROVIDER_INFO ossl_predefined_providers[] = {
+ { "default", NULL, ossl_default_provider_init, NULL, 1 },
+ { "base", NULL, ossl_base_provider_init, NULL, 0 },
+ { "null", NULL, ossl_null_provider_init, NULL, 0 },
+ { NULL, NULL, NULL, NULL, 0 }
+};
diff --git a/CryptoPkg/Library/OpensslLib/configure.py b/CryptoPkg/Library/OpensslLib/configure.py
index d8aa0cb03edf..8b44e3124a1e 100755
--- a/CryptoPkg/Library/OpensslLib/configure.py
+++ b/CryptoPkg/Library/OpensslLib/configure.py
@@ -195,6 +195,7 @@ def sources_filter_fn(filename):
'randfile.c',
'/store/',
'/storemgmt/',
+ 'provider_predefined.c'
]
for item in exclude:
if item in filename:
--
2.39.2
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101078): https://edk2.groups.io/g/devel/message/101078
Mute This Topic: https://groups.io/mt/97576425/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list