From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web11.15107.1678696241288738410 for ; Mon, 13 Mar 2023 01:30:41 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=icBH/ltV; spf=pass (domain: redhat.com, ip: 170.10.129.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678696240; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S+KfsjL8YvdIRcQATnSPD4Qd5IkLNms/mtyomjIa1Rs=; b=icBH/ltVA3x/F92U31q69mu2JTmeHz8r1vNDeurB1ay/z0ZFLwEo1g1wSeCe/XU3nuCcFj Uk8B+Mm1wVxMiZ+qzAvLmmSdU8VhBMJ9L2HJCHnNdDmPSsUJRKgKD9+AYixJJ3cDb3X0X8 1rF2KBY2Kt121qm8OoYqB1IjYRu5xA0= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-637-0jCecvySNB6TtO5CWlWysw-1; Mon, 13 Mar 2023 04:30:37 -0400 X-MC-Unique: 0jCecvySNB6TtO5CWlWysw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C31F12A5957C; Mon, 13 Mar 2023 08:30:36 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.142]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 578CF20341A0; Mon, 13 Mar 2023 08:30:36 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 7D00B1801E94; Mon, 13 Mar 2023 09:30:16 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Jian J Wang , Pawel Polawski , Xiaoyu Lu , Ard Biesheuvel , Guomin Jiang , Gerd Hoffmann , Jiewen Yao , Oliver Steffen , Jordan Justen Subject: [PATCH 18/22] [provider] CryptoPkg/openssl: use our own predefined providers Date: Mon, 13 Mar 2023 09:30:12 +0100 Message-Id: <20230313083016.136448-19-kraxel@redhat.com> In-Reply-To: <20230313083016.136448-1-kraxel@redhat.com> References: <20230313083016.136448-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 --- 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 +#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