public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: Jian J Wang <jian.j.wang@intel.com>,
	Pawel Polawski <ppolawsk@redhat.com>,
	Xiaoyu Lu <xiaoyu1.lu@intel.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Guomin Jiang <guomin.jiang@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Jiewen Yao <jiewen.yao@intel.com>,
	Oliver Steffen <osteffen@redhat.com>,
	Jordan Justen <jordan.l.justen@intel.com>
Subject: [PATCH 18/22] [provider] CryptoPkg/openssl: use our own predefined providers
Date: Mon, 13 Mar 2023 09:30:12 +0100	[thread overview]
Message-ID: <20230313083016.136448-19-kraxel@redhat.com> (raw)
In-Reply-To: <20230313083016.136448-1-kraxel@redhat.com>

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@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


  parent reply	other threads:[~2023-03-13  8:30 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-13  8:29 [PATCH 00/22] [edk2-staging] CryptoPkg/openssl: switch to openssl-3.0 Gerd Hoffmann
2023-03-13  8:29 ` [PATCH 01/22] CryptoPkg/openssl: update submodule to openssl-3.0.8 Gerd Hoffmann
2023-03-13 15:13   ` [edk2-devel] " Li, Yi
2023-03-14  8:16     ` Gerd Hoffmann
2023-03-14  8:45       ` Ard Biesheuvel
2023-03-14  9:04         ` Gerd Hoffmann
2023-06-02  2:53         ` Yao, Jiewen
2023-06-02  9:14           ` Ard Biesheuvel
2023-06-02 14:29             ` Yao, Jiewen
2023-06-19  8:12               ` Gerd Hoffmann
2023-06-19  8:37                 ` Li, Yi
2023-08-03  4:40             ` Li, Yi
2023-03-13  8:29 ` [PATCH 02/22] CryptoPkg/openssl: remove openssl 1.1.1 header files Gerd Hoffmann
2023-03-13  8:29 ` [PATCH 03/22] CryptoPkg/openssl: remove generated file lists Gerd Hoffmann
2023-03-13  8:29 ` [PATCH 04/22] CryptoPkg/openssl: add openssl3 configure scripts Gerd Hoffmann
2023-03-13  8:29 ` [PATCH 05/22] CryptoPkg/openssl: UefiAsm.conf update for openssl 3.0, add aarch64 Gerd Hoffmann
2023-03-13  8:30 ` [PATCH 06/22] CryptoPkg/openssl: update Openssl*.inf files for openssl 3.0 Gerd Hoffmann
2023-03-13  8:30 ` [PATCH 07/22] CryptoPkg/BaseCryptLib: no openssl deprecation warnings please Gerd Hoffmann
2023-03-13  8:30 ` [PATCH 08/22] CryptoPkg/BaseCryptLib; adapt CryptSm3.c to openssl 3.0 changes Gerd Hoffmann
2023-03-13  8:30 ` [PATCH 09/22] CryptoPkg/BaseCryptLib: drop BIO_* dummy functions Gerd Hoffmann
2023-03-13  8:30 ` [PATCH 10/22] CryptoPkg/TlsLib: ERR_GET_FUNC is gone Gerd Hoffmann
2023-03-13  8:30 ` [PATCH 11/22] CryptoPkg/TlsLib: use unsigned long for ErrorCode Gerd Hoffmann
2023-03-13  8:30 ` [PATCH 12/22] CryptoPkg/openssl: adapt rand_pool.c to openssl 3.0 changes Gerd Hoffmann
2023-03-13  8:30 ` [PATCH 13/22] CryptoPkg/openssl: move compiler_flags to buildinf.c Gerd Hoffmann
2023-03-13  8:30 ` [PATCH 14/22] CryptoPkg/openssl: store dummy update for openssl 3.0 Gerd Hoffmann
2023-03-13  8:30 ` [PATCH 15/22] CryptoPkg/openssl: adapt EcSm2Null.c " Gerd Hoffmann
2023-03-13  8:30 ` [PATCH 16/22] [hash] CryptoPkg/openssl: add OpensslLibHash.inf Gerd Hoffmann
2023-03-13 15:46   ` [edk2-devel] " Li, Yi
2023-03-14  7:45     ` Gerd Hoffmann
2023-03-13  8:30 ` [PATCH 17/22] [hash] OvmfPkg: wire up OpensslLibHash.inf Gerd Hoffmann
2023-03-13  8:30 ` Gerd Hoffmann [this message]
2023-03-13  8:30 ` [PATCH 19/22] CryptoPkg/openssl: update *.inf, add generated files Gerd Hoffmann
2023-03-13 15:26   ` [edk2-devel] " Li, Yi
2023-03-14  7:55     ` Gerd Hoffmann
2023-03-13  8:30 ` [PATCH 20/22] CryptoPkg/openssl: update CI config for openssl 3.0 Gerd Hoffmann
2023-03-13  8:30 ` [PATCH 21/22] CryptoPkg/openssl: cleanup remaining openssl-1.1.1 files Gerd Hoffmann
2023-03-13  8:30 ` [PATCH 22/22] CryptoPkg/openssl: update HOWTO file Gerd Hoffmann
2023-06-01 16:40 ` [edk2-devel] [PATCH 00/22] [edk2-staging] CryptoPkg/openssl: switch to openssl-3.0 Michael D Kinney
2023-06-02  2:51   ` Yao, Jiewen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230313083016.136448-19-kraxel@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox