From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web09.8103.1618909954070686454 for ; Tue, 20 Apr 2021 02:12:34 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=oiCNJbGl; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: jiewen.yao@intel.com) IronPort-SDR: WcJha4eb4dn1ZekJJSXLN3pRP2/CZYbBGwzTU0LDzVsjwjtKmUj20aLfZYpazVzJu8cVYurl+R mEytMiuLbL6A== X-IronPort-AV: E=McAfee;i="6200,9189,9959"; a="195501209" X-IronPort-AV: E=Sophos;i="5.82,236,1613462400"; d="scan'208";a="195501209" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2021 02:12:32 -0700 IronPort-SDR: moqHLs42/cYE0L00uiO/E80nAZ3HGNZHpaSGXbnY/+iA/axat5Kie+6kW2MmGR7OoOcvUNteuL HrrsWWAvssEA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,236,1613462400"; d="scan'208";a="534424076" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga004.jf.intel.com with ESMTP; 20 Apr 2021 02:12:32 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 20 Apr 2021 02:12:31 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 20 Apr 2021 02:12:31 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Tue, 20 Apr 2021 02:12:31 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.106) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Tue, 20 Apr 2021 02:12:31 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lOKOaKx1kGqrI6sOUV31u/RFFwrRgfQLhZQ863GiIT+Z9KIBiidKb8axF9kFq9Pbin1Jy/H3YV30Mmi0R0OVpnfaCeh0Oxue5fWf3pZXF0J8HGLDk0HpHNe1V/Z/0yIaIMETF+6oaVyip2poLwnfH1X+GXEMb2KrWRKLNDYc1t7wa7TFhkxydg27S8DmT1JZcYzqpa32EBx+ddxFBZbQ/108cdOO9p6ZQMGX6Dtg+g/cvb0S7Yc6HfvuxorE+qem86Cla78a7ctF59Oyh/j96ccjzJBz1fbzyY8hGZ7YSBaRbUJXX7820vr7Y0LOQKR0W/Gj9OFecZOtZYNJHaaPjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nN/r8TKGi4nfzQHW8XgoYQXtW0gOYMXvjLunnwTKMWY=; b=HfnH1V3nOygOhIOFtONVtX1TySHxY8U2JXcSQTh2atZxYIlmR0DyfitisMWBq48JNMDpZL1gq5B1MEW35NtgatNh4GKtuF3AN4cXDYauYqVT97PDh0ssHTeR5/d9IHDwdmQ7HKcoIiZMMvW5ZebRCsW/LLF8jEY+8WXF5c2xBhvCIcbKr3oP/moGkH894h9F6zyBv3HAkotBxVipAXJCt4GXqG3uqtgc+oFxBkWoJMMRlrFusnOt+EmsaTuSTHpmmbwfvDOYQYwZ532F4FT+3Ry978pz3XE0QAIHz1CLc8UQ9hwBU7e4p5NtREPbxdecXwMpdOlUIhEIHW2wBRwLsQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nN/r8TKGi4nfzQHW8XgoYQXtW0gOYMXvjLunnwTKMWY=; b=oiCNJbGlCNi5bX0XoVHflKKfOA2swUSWKPhY1xZ1tOR1iCrFuPXPfAcZO6m5/h0aeMTBnIKdF/mm4W35aVKaDMdgtbb3u4INjK8ym1309VVSBB7dmKww9+oR5zGHGL6OmGPUjgnbQTr7ouDix6f5sj+hQpfTI0yuGjJCCrz8Kgc= Received: from BY5PR11MB4166.namprd11.prod.outlook.com (2603:10b6:a03:191::25) by BY5PR11MB4040.namprd11.prod.outlook.com (2603:10b6:a03:186::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.23; Tue, 20 Apr 2021 09:12:29 +0000 Received: from BY5PR11MB4166.namprd11.prod.outlook.com ([fe80::c9d9:1b92:3014:6f17]) by BY5PR11MB4166.namprd11.prod.outlook.com ([fe80::c9d9:1b92:3014:6f17%3]) with mapi id 15.20.4042.024; Tue, 20 Apr 2021 09:12:29 +0000 From: "Yao, Jiewen" To: "Agrawal, Sachin" , "devel@edk2.groups.io" CC: "Wang, Jian J" , "Lu, XiaoyuX" , "Jiang, Guomin" Subject: Re: [PATCH v1 1/1] CryptoPkg: BaseCryptLib: Add RSA PSS verify support Thread-Topic: [PATCH v1 1/1] CryptoPkg: BaseCryptLib: Add RSA PSS verify support Thread-Index: AQHXNYklz3Rjg2QaiUSFN9fpAiRHjqq8rqtAgABREACAABsoEA== Date: Tue, 20 Apr 2021 09:12:29 +0000 Message-ID: References: <20210420020150.29212-1-sachin.agrawal@intel.com> <20210420020150.29212-2-sachin.agrawal@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.199] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b3cc4d77-04ad-4aad-6ffd-08d903dc6c5e x-ms-traffictypediagnostic: BY5PR11MB4040: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: /tZ1qvN2dlQrmfwyyEMF0Zmlcds2Bb92POWNcqpB8lNUIrrVNTLYTbYQHFLTshLQK9NXVcg6zqGXTuw3CSZ5Bt9eExzGNUSFVNBoS9HGYE+TR4aC7hDvEMMw3s4h26F/Y+qIjcZwb7/ank7hBVwlIDX1zzvvtvPrY0AyOr5bjjGfWrEgv98+PYho3BNfIsmW51Z7dRJoPpF6cxMEea4+ZvzvkzKmidtgcjX/Dhq4CnzK6L+nnZR9d6dXh71LuclTGqa/o9fbrWMRqXHNejH8KZ99Fl3+2sxe9iEfCcP3RLQ3Ntq6BRZSp8MsUBxwVY8sICK8FCBKMssf2LXDmCrMof7VPolqC80HnDlqIFmpbMt/7FhVLkCueVBz9CFXUVz0S9tbgtJGCUgcPNU/Pbd3/enlDfQ8HMFpmXNDGPtfZrboQ6hNp3/+iay7vN1s6vvoejxDZGzz0hIPAPDkMrvLGn8QrWB3yl7uKLvOhmjKxFcrLKoozt2qurK5uBEuJTK1oToborhXwft8ZB8s6+RuutrtyFBY2nWvxWK3oo+DQTMCY565V+/TZRpXgRmVceJ+nq0TwtmLfTRPw7OGDTM1ndmqotI03RC6Le6T4RA+ymd9rPRNccWfm4SSdKy6c+SaY8NmfCyt3jLfj25hqEFNXlK0bWaP7uramw9rwYuz2jVHejmMdZuuHf5HtnYxW7kh x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR11MB4166.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(39850400004)(366004)(396003)(376002)(346002)(136003)(86362001)(6506007)(2906002)(15650500001)(966005)(122000001)(26005)(5660300002)(66556008)(76116006)(33656002)(186003)(9686003)(4326008)(71200400001)(107886003)(66946007)(53546011)(83380400001)(66476007)(66446008)(64756008)(52536014)(54906003)(8936002)(8676002)(38100700002)(478600001)(316002)(55016002)(110136005)(7696005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?kLYFRZfghx4QAwuJ0mXDG2cBQ3OB5ItY6pzVjP6/7FDfSPQBvzNbIeSihhcb?= =?us-ascii?Q?PEuQTR48p6lomfe4MkHQ5HI3a4ZCvj4QfL/lYU+8jKVf6Y5wditVhE0DzIHH?= =?us-ascii?Q?xO3Q4C/gSmZHiWqV4linQXrNsKD4K9mdoCGN8ELnKuE7lRiI2yC7W/TXXEvy?= =?us-ascii?Q?lQ6yWp1dB4ZxWB51Z2Ufl9vipyPNADozL1LqT0jO9A9VUVBYAxNlI1TeYwu3?= =?us-ascii?Q?uE6DVnhn+88Xq0fTs5piZ7m2e/vLfS1vcG3QJ0aiZVJcWD/9QqQAZyLb/F+K?= =?us-ascii?Q?O9K9mDpyklNwAkp19S09/ocmd2Zmknc1Ynsttj/DL0VdL06jIOmCulhZtrK7?= =?us-ascii?Q?+FHl/SaBIwCcqcSFB/vn9LdE7GBi/k9gkzHJXX8a6y4IIZGbwcmkMQUrrZtj?= =?us-ascii?Q?CMkl+ZONrayxirdizjKJXOb0a5CRNEVvczHn9ZWxB0adk5N1KZzCjOQkHBX/?= =?us-ascii?Q?K6BlaVF5lnleTTJ1WKaABws1B8dphKDYDiJchGbq4M05a7tw68fJXsgVshRU?= =?us-ascii?Q?7mmzU48S+b75nu4cX6a54toQLnM3NFe+jKE17wvqMR50G5QW6dEKwWSH76a2?= =?us-ascii?Q?PJjoNdLpRs7zBdSUK/IafT1XLtp4vZtnuJVvSs4uIgLUbVkMGpAVGmg3cb7E?= =?us-ascii?Q?dyXr2IOfXe60MwI4YQk30T1zTdJXB+GOR6DBg667mFzTuQn7CXeMIffSKshs?= =?us-ascii?Q?ddrcPxiRLzh57Sz6RGIPN/d/0z5oqb9BP1AGiusf9gSka1jcTHwbgpX74eY7?= =?us-ascii?Q?Mm6YIVfHkRhcQw8MgayU9z8b7Ti7MmulXoayqkgfjeRbAmGplpeOpOreP1fJ?= =?us-ascii?Q?Q07BCLlxBF23HK0JQFZTvxp4GXFTFHrZQRZDN7qebrfvWE9NT1Tlh+Ra8BzZ?= =?us-ascii?Q?VOYyRwtZnOzwL14nd9lWXf1k6Nf79YJkQe4xpHrBNQWPvQZ+dhuSqySXUzz/?= =?us-ascii?Q?qhJF0kN9TQP/WzLK89BJD9X3cwLLBJBf5U2A5IavqW81WG3ljjKtDqydzj39?= =?us-ascii?Q?HO5bbY3gmzmbBJN9NlZ5NIT//UcmV1oLJXSuAGjFOqjCTIXKl5lz5SGXp7P4?= =?us-ascii?Q?vNSdqGTljF8/X75bs0fj7xnsv8tIFJ1pE70O61Jd4thbjw/orQ4komlJCEL1?= =?us-ascii?Q?17jVxwrzrYQmXwwcBRnQ2+vc8r4e/IcmPIbDbeNSP666GKouIKghU25/auYX?= =?us-ascii?Q?vKu/GiTpV9kg6dBulVq8McPBD7hpBToxLawL1I9V5pfaY4xUF15p/XoNBil2?= =?us-ascii?Q?0TabHxHWOtougDTKMVl+Og07l9ZL4Hcg5fX39TbMMpLdIN8QICUd0xSMcoeh?= =?us-ascii?Q?QffTVNriebKdomxL/4ulG0HQ?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR11MB4166.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3cc4d77-04ad-4aad-6ffd-08d903dc6c5e X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Apr 2021 09:12:29.4133 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Qx59AXu3LR4PvPGXKObiXFIGvxzyH9Ifmkreo7IzMT64pmfkZ6BstAdLJsfcelbjvDJTTHJEFdVW5Nxf5biqfg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR11MB4040 Return-Path: jiewen.yao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Right. That has PROs and CONs. On one hand, that allows maximum compatibility, salt could be HASH_SIZE or = MAX, or even 0 ? On the other hand, what if the consumer only wants to accept a specific len= gth? E.g. TPM in FIPS mode and TLS requires SaltLength=3D=3DHashLength. Thank you Yao Jiewen > -----Original Message----- > From: Agrawal, Sachin > Sent: Tuesday, April 20, 2021 3:19 PM > To: Yao, Jiewen ; devel@edk2.groups.io > Cc: Wang, Jian J ; Lu, XiaoyuX ; > Jiang, Guomin > Subject: RE: [PATCH v1 1/1] CryptoPkg: BaseCryptLib: Add RSA PSS verify s= upport >=20 > Hi Jiewen, >=20 > From Section 9.1 in RFC 8017: > " Note that the verification operation follows reverse steps to recover > salt and then forward steps to recompute and compare H." >=20 > Therefore, salt length can be inferred from the PSS block structure durin= g > verification operation. >=20 > I opted for 'RSA_PSS_SALTLEN_AUTO' as it will allow Edk2 to verify PSS > signatures of any salt lengths. >=20 > Thanks > Sachin >=20 > -----Original Message----- > From: Yao, Jiewen > Sent: Monday, April 19, 2021 7:30 PM > To: Agrawal, Sachin ; devel@edk2.groups.io > Cc: Wang, Jian J ; Lu, XiaoyuX ; > Jiang, Guomin > Subject: RE: [PATCH v1 1/1] CryptoPkg: BaseCryptLib: Add RSA PSS verify s= upport >=20 > Hi Sachin > May I know why you hardcode PSS salt length to be RSA_PSS_SALTLEN_AUTO ? >=20 > Thank you > Yao Jiewen >=20 >=20 > > -----Original Message----- > > From: Agrawal, Sachin > > Sent: Tuesday, April 20, 2021 10:02 AM > > To: devel@edk2.groups.io > > Cc: Yao, Jiewen ; Wang, Jian J > > ; Lu, XiaoyuX ; Jiang, > > Guomin ; Agrawal, Sachin > > > > Subject: [PATCH v1 1/1] CryptoPkg: BaseCryptLib: Add RSA PSS verify > > support > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3314 > > > > This patch uses Openssl's EVP API's to perform RSASSA-PSS verification > > of a binary blob. > > > > Cc: Jiewen Yao > > Cc: Jian J Wang > > Cc: Xiaoyu Lu > > Cc: Guomin Jiang > > > > Signed-off-by: Sachin Agrawal > > --- > > CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaPss.c | 139 > > ++++++++++++++++++++ > > CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaPssNull.c | 43 ++++++ > > CryptoPkg/Include/Library/BaseCryptLib.h | 27 ++++ > > CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf | 1 + > > CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf | 1 + > > CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf | 1 + > > CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf | 1 + > > 7 files changed, 213 insertions(+) > > > > diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaPss.c > > b/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaPss.c > > new file mode 100644 > > index 000000000000..acf5eb689cd8 > > --- /dev/null > > +++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaPss.c > > @@ -0,0 +1,139 @@ > > +/** @file > > + RSA Asymmetric Cipher Wrapper Implementation over OpenSSL. > > + > > + This file implements following APIs which provide basic capabilities= for RSA: > > + 1) RsaPssVerify > > + > > +Copyright (c) 2021, Intel Corporation. All rights reserved.
> > +SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#include "InternalCryptLib.h" > > + > > +#include > > +#include > > +#include > > +#include > > + > > + > > +/** > > + Retrieve a pointer to EVP message digest object. > > + > > + @param[in] DigestLen Length of the message digest. > > + > > +**/ > > +static > > +EVP_MD* > > +GetEvpMD ( > > + IN UINT16 DigestLen > > + ) > > +{ > > + switch (DigestLen){ > > + case SHA256_DIGEST_SIZE: > > + return EVP_sha256(); > > + break; > > + case SHA384_DIGEST_SIZE: > > + return EVP_sha384(); > > + break; > > + case SHA512_DIGEST_SIZE: > > + return EVP_sha512(); > > + break; > > + default: > > + return NULL; > > + } > > +} > > + > > + > > +/** > > + Verifies the RSA signature with RSASSA-PSS signature scheme defined > > +in RFC > > 8017. > > + Implementation determines salt length automatically from the > > + signature > > encoding. > > + Mask generation function is the same as the message digest algorithm= . > > + > > + @param[in] RsaContext Pointer to RSA context for signature ver= ification. > > + @param[in] Message Pointer to octet message to be verified. > > + @param[in] MsgSize Size of the message in bytes. > > + @param[in] Signature Pointer to RSASSA-PSS signature to be ve= rified. > > + @param[in] SigSize Size of signature in bytes. > > + @param[in] DigestLen Length of digest for RSA operation. > > + > > + @retval TRUE Valid signature encoded in RSASSA-PSS. > > + @retval FALSE Invalid signature or invalid RSA context. > > + > > +**/ > > +BOOLEAN > > +EFIAPI > > +RsaPssVerify ( > > + IN VOID *RsaContext, > > + IN CONST UINT8 *Message, > > + IN UINTN MsgSize, > > + IN CONST UINT8 *Signature, > > + IN UINTN SigSize, > > + IN UINT16 DigestLen > > + ) > > +{ > > + BOOLEAN Result; > > + EVP_PKEY *pEvpRsaKey =3D NULL; > > + EVP_MD_CTX *pEvpVerifyCtx =3D NULL; > > + EVP_PKEY_CTX *pKeyCtx =3D NULL; > > + CONST EVP_MD *HashAlg =3D NULL; > > + > > + if (RsaContext =3D=3D NULL) { > > + return FALSE; > > + } > > + if (Message =3D=3D NULL || MsgSize =3D=3D 0 || MsgSize > INT_MAX) { > > + return FALSE; > > + } > > + if (Signature =3D=3D NULL || SigSize =3D=3D 0 || SigSize > INT_MAX) = { > > + return FALSE; > > + } > > + > > + HashAlg =3D GetEvpMD(DigestLen); > > + > > + if (HashAlg =3D=3D NULL) { > > + return FALSE; > > + } > > + > > + pEvpRsaKey =3D EVP_PKEY_new(); > > + if (pEvpRsaKey =3D=3D NULL) { > > + goto _Exit; > > + } > > + > > + EVP_PKEY_set1_RSA(pEvpRsaKey, RsaContext); > > + > > + pEvpVerifyCtx =3D EVP_MD_CTX_create(); if (pEvpVerifyCtx =3D=3D NUL= L) { > > + goto _Exit; > > + } > > + > > + Result =3D EVP_DigestVerifyInit(pEvpVerifyCtx, &pKeyCtx, HashAlg, > > + NULL, > > pEvpRsaKey) > 0; > > + if (pKeyCtx =3D=3D NULL) { > > + goto _Exit; > > + } > > + > > + if (Result) { > > + Result =3D EVP_PKEY_CTX_set_rsa_padding(pKeyCtx, > > RSA_PKCS1_PSS_PADDING) > 0; > > + } > > + if (Result) { > > + Result =3D EVP_PKEY_CTX_set_rsa_pss_saltlen(pKeyCtx, > > RSA_PSS_SALTLEN_AUTO) > 0; > > + } > > + if (Result) { > > + Result =3D EVP_PKEY_CTX_set_rsa_mgf1_md(pKeyCtx, HashAlg) > 0; } > > + if (Result) { > > + Result =3D EVP_DigestVerifyUpdate(pEvpVerifyCtx, Message, > > (UINT32)MsgSize) > 0; > > + } > > + if (Result) { > > + Result =3D EVP_DigestVerifyFinal(pEvpVerifyCtx, Signature, > > + (UINT32)SigSize) > 0; } > > + > > +_Exit : > > + if (pEvpRsaKey) { > > + EVP_PKEY_free(pEvpRsaKey); > > + } > > + if (pEvpVerifyCtx) { > > + EVP_MD_CTX_destroy(pEvpVerifyCtx); > > + } > > + > > + return Result; > > +} > > diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaPssNull.c > > b/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaPssNull.c > > new file mode 100644 > > index 000000000000..8d84b4c1426c > > --- /dev/null > > +++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaPssNull.c > > @@ -0,0 +1,43 @@ > > +/** @file > > + RSA-PSS Asymmetric Cipher Wrapper Implementation over OpenSSL. > > + > > + This file does not provide real capabilities for following APIs in R= SA handling: > > + 1) RsaPssVerify > > + > > +Copyright (c) 2021, Intel Corporation. All rights reserved.
> > +SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#include "InternalCryptLib.h" > > + > > +/** > > + Verifies the RSA signature with RSASSA-PSS signature scheme defined > > +in RFC > > 8017. > > + Implementation determines salt length automatically from the > > + signature > > encoding. > > + Mask generation function is the same as the message digest algorithm= . > > + > > + @param[in] RsaContext Pointer to RSA context for signature ver= ification. > > + @param[in] Message Pointer to octet message to be verified. > > + @param[in] MsgSize Size of the message in bytes. > > + @param[in] Signature Pointer to RSASSA-PSS signature to be ve= rified. > > + @param[in] SigSize Size of signature in bytes. > > + @param[in] DigestLen Length of digest for RSA operation. > > + > > + @retval TRUE Valid signature encoded in RSASSA-PSS. > > + @retval FALSE Invalid signature or invalid RSA context. > > + > > +**/ > > +BOOLEAN > > +EFIAPI > > +RsaPssVerify ( > > + IN VOID *RsaContext, > > + IN CONST UINT8 *Message, > > + IN UINTN MsgSize, > > + IN CONST UINT8 *Signature, > > + IN UINTN SigSize, > > + IN UINT16 DigestLen > > + ) > > +{ > > + ASSERT (FALSE); > > + return FALSE; > > +} > > diff --git a/CryptoPkg/Include/Library/BaseCryptLib.h > > b/CryptoPkg/Include/Library/BaseCryptLib.h > > index 496121e6a4ed..36d560b8d691 100644 > > --- a/CryptoPkg/Include/Library/BaseCryptLib.h > > +++ b/CryptoPkg/Include/Library/BaseCryptLib.h > > @@ -1363,6 +1363,33 @@ RsaPkcs1Verify ( > > IN UINTN SigSize > > ); > > > > +/** > > + Verifies the RSA signature with RSASSA-PSS signature scheme defined > > +in RFC > > 8017. > > + Implementation determines salt length automatically from the > > + signature > > encoding. > > + Mask generation function is the same as the message digest algorithm= . > > + > > + @param[in] RsaContext Pointer to RSA context for signature ver= ification. > > + @param[in] Message Pointer to octet message to be verified. > > + @param[in] MsgSize Size of the message in bytes. > > + @param[in] Signature Pointer to RSASSA-PSS signature to be ve= rified. > > + @param[in] SigSize Size of signature in bytes. > > + @param[in] DigestLen Length of digest for RSA operation. > > + > > + @retval TRUE Valid signature encoded in RSASSA-PSS. > > + @retval FALSE Invalid signature or invalid RSA context. > > + > > +**/ > > +BOOLEAN > > +EFIAPI > > +RsaPssVerify ( > > + IN VOID *RsaContext, > > + IN CONST UINT8 *Message, > > + IN UINTN MsgSize, > > + IN CONST UINT8 *Signature, > > + IN UINTN SigSize, > > + IN UINT16 DigestLen > > + ); > > + > > /** > > Retrieve the RSA Private Key from the password-protected PEM key dat= a. > >