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.web12.3152.1657863306046477836 for ; Thu, 14 Jul 2022 22:35:06 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=NGnNA10L; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: ming.tan@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657863306; x=1689399306; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=e0ELGeNoROKDQQSR14rVbZV2uCrsNuXhW0fsR6Fi/ZI=; b=NGnNA10LMPK31FLC/LjwfaSfxI6riSIoNArQpZ+q62sF0+FIaUb7wYP4 AFKVC1f7dxGJ5LIMOZ9K4PfW7DFlrfE2VNvLrOEFgRT8d9cPTEIFbenLL iLt45xiUKvpXJNnK4lHDj94xX/RI9DyY8bD1LvbsaBdipphvU7S4Jt6PO Bd9fRekR+vVKrbf7T3a3M3TlJ6VjEF5f9c1xPL2JPo7UV4Z3MT08ma7xK 8OqMgLN8OmpFtuVF3ZhXnKU0f1alG5rbRdPhNfPcXpT2wjNHI8BMeuF03 nN7PI6bQBhz5hEOUGOXdwQbQ8OBqlb6pzNlbmAGJNPJFxo87WIKGs9IZp w==; X-IronPort-AV: E=McAfee;i="6400,9594,10408"; a="286844102" X-IronPort-AV: E=Sophos;i="5.92,272,1650956400"; d="scan'208";a="286844102" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2022 22:34:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,272,1650956400"; d="scan'208";a="571387904" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga006.jf.intel.com with ESMTP; 14 Jul 2022 22:34:50 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 14 Jul 2022 22:34:49 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 14 Jul 2022 22:34:49 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Thu, 14 Jul 2022 22:34:49 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.168) 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.2308.27; Thu, 14 Jul 2022 22:34:49 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DcB4e0HR3DJoR2aXcUiCUlHlwiegaWRyc2Rgmw4swwokZiDH9DecVf6Ny82ZMm79aa/QWzCYvgpNHkchOErPbXME5I3YeHECdG8zqW+sNzb8aaXTD7OujylfERUkYhyJ/RGVJUmgHOXCqZGCzSS638VfSFBZ6D3NDB5xR0ltFYa4nK6SC8TPPRt7vrrCCT7MfHoVSyUAj40x4CmiFmsXKAVcq01Q36QW4eOXw86onahe/SSw8P3FfVoFmS2avJi2q83vzz3HYhDwGRy7CxiTkxKX4bHETufFbViw8DD+4FxQ50sx7C0JbMlXhkR59+uHJ7vTlwE9UNP+WlhaihGF+w== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bgO4/ew8KCrT8Pv9ZSq6YED8rsJOFXnwNe6ykJcIbs8=; b=NLzVEGS3MMJLVMp9DUiqwWcQHY4WEcHLq96pWINqoCfwd6tpYXr9niZiSxgRLJXzk19w7wr5J7RfjY7cYcNmeacXsV56RZkOzfWdJ4P+a+cPIqNobc88hhTx+PiOTa5q2/dQJtO6e0KGQUnzwh7m6ONtq75zZCZInkmWez7x4rp8LwZKPyElsoMebnrAZOp1VHmWC5UTinOYRAnLiChe7eHFLBpQ5nafYYCut9Se8sxhxpCvtTzI/8B5aqtXLjb71DX0kSumWjScFL7XoVKTU4IyV7mv1zlReiVWMg5kpkzB7sWO3X0tKYwfYyVNs/zTdHakQ9ImRq9e/pROlphytw== 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 Received: from BN8PR11MB3713.namprd11.prod.outlook.com (2603:10b6:408:8e::28) by PH7PR11MB6029.namprd11.prod.outlook.com (2603:10b6:510:1d0::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.14; Fri, 15 Jul 2022 05:34:42 +0000 Received: from BN8PR11MB3713.namprd11.prod.outlook.com ([fe80::103e:e2e:9f5:6085]) by BN8PR11MB3713.namprd11.prod.outlook.com ([fe80::103e:e2e:9f5:6085%5]) with mapi id 15.20.5438.014; Fri, 15 Jul 2022 05:34:41 +0000 From: "Tan, Ming" To: "devel@edk2.groups.io" , "Li, Yi1" CC: "Luo, Heng" Subject: Re: [edk2-devel] [staging/crypto-new-api PATCH] CryptoPkg: Fixed possible security implications in ECDH and BN. Thread-Topic: [edk2-devel] [staging/crypto-new-api PATCH] CryptoPkg: Fixed possible security implications in ECDH and BN. Thread-Index: AQHYmAwLefCl0zES9ECo7OtCBip7ya1+6NNQ Date: Fri, 15 Jul 2022 05:34:41 +0000 Message-ID: References: <20220715052948.1297-1-yi1.li@intel.com> In-Reply-To: <20220715052948.1297-1-yi1.li@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.500.17 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8109bf9c-371f-40f6-40ca-08da6623b7b0 x-ms-traffictypediagnostic: PH7PR11MB6029:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: V0RoJdNGkG0OgRhzAWYZuSSUvmDehm389EgVsSyMdpT6Ijb8gNydvQG7rQuluD+bKOUZeRCV4gAMnuuJanbmf8ctmiCeDO5S54ynwcJBD5NG1oWNLC7fAaUEtNjSj2axgKCAFSSWX0UCY9m+6UIQiBCfx4sM7yMxDyf2pDbJfBuMgDZvKykLlo2Mn0uOn+NeUfZwIwR9IDl+vuYFhtaRa328CM6KrDyjhjIgt9ZX7FmbpmbUJ6IxUV2I9+EZFyQDKbfxquE4GjgEluE42l8UMdb45wA1oIW/fzPsdXml+foQpmDy/EwPzN5VrjKgJEGGjkxPWQqaKIpctDgBke4Y/L7pxLhzL15Qm9AcMZbs7OtE+uMEKKfVnKJ3r7sWskabcysfstXG5BHOKzWYbf5ZwkVWN9zhEUWZ7FBroQ7Gf6VyUgEtCdSYFKi/0HjMLMTDKVQfMusw5gBKVSmiQgvuuk8XpAMOEXOHliK1yl1J1/xz4jW1nWOgnbN/xG1TpacY3Fd74SEdG+eBjRl+WSzxFtK6bxWBNq3Y5g4r+4kCFWBjpkB2jXkIJUXJXHavIZU5DtfUVds/CfSRauRWLI2kfIoFrwpuPLYZvoTfAjGBu5EtW/dszGUhkGrfyrkIB8tvOr6/EXdNdfA/ZMPYXhAeJVFz7NzfVvd+f8PS/AgSROiTfFq/XT9W1tQstPO6yyOgvIrAw1xw/FLQxijvW9EXlTkil8Ev/l2ajRrikHLP2ra4REJ/OsSyw8gFYWZQlyOWoij8nJZ5hWlgU3GEAbVw8vAzoaweYZCmhqINb1FJjMm3EzZaH+Zx2CszS1+XlPCSbm1p7S4HQ1DPlUE1Zs9KaY69hDHOB8IjtUh1Nrt/1aB4Mz1mRemixF/bgWSLaQrnEG0c6rwL+Kc7Kas8eCl4iw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR11MB3713.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(346002)(366004)(39860400002)(136003)(376002)(396003)(26005)(33656002)(966005)(55016003)(52536014)(107886003)(110136005)(82960400001)(71200400001)(8676002)(2906002)(41300700001)(15650500001)(86362001)(66476007)(122000001)(5660300002)(30864003)(83380400001)(186003)(478600001)(53546011)(6506007)(7696005)(9686003)(38070700005)(316002)(4326008)(6636002)(76116006)(66946007)(38100700002)(8936002)(66446008)(64756008)(66556008)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?hfMxXd53Fn4ltl/15FpcAN8vU5BeV/emo3L3P1Lt2H5yCPVq/si0QGvK9Tvc?= =?us-ascii?Q?wJBd/KhZq7QARmlMSfmb6IOrXSFh1zWYtXYt28YnZBWElmptdeP/IY4NQAyD?= =?us-ascii?Q?9QRLKbvZFH3Fg5+egQoFnoTC+Cec0zOHiNq+XTBIDe9rudCXAh15nc7job/k?= =?us-ascii?Q?HfKgK/A5qJWJhOJlfSz96TS10AX3Xo41hxr7v+icfNIl5m4BvWPj5usm32g8?= =?us-ascii?Q?guJbD8W6C37Sz0HGWOVxnymm5Wphrk3eGTNgHIF9D2UtPcI/jazACi982zRL?= =?us-ascii?Q?KhM11orhvn0GohgYJQbxXry7TQnn/mi8z1JVbdldsG2mlj+e7OmFHkoxXPOW?= =?us-ascii?Q?nZmDzWzg5lMfXQ5g3CykiYOyPAnlC37HDgAxBCIAYxDpF+vRA8pFJJpa8SEB?= =?us-ascii?Q?4ChxiFIdNisxjI0axJCj1BUtCalIz0FHIiohoAjvKgmOXk1aV3ilDwqYiILk?= =?us-ascii?Q?5DQQc417TyVmYLRUkrDBs3iHaOf8UuY9wnOmjXKns3vqSN3kFWbEC9T5bd0u?= =?us-ascii?Q?WEH0aJdIsLLe/GwxUHGl309zJx5b8kgb9UM82YYNvSQgQndspCPhudUhjP0n?= =?us-ascii?Q?n9ek5sPco6pO3EaLHt7Tqh1Ujp75zJb7Yb0S+QfSGSLjM4RLxnAZkHL6EM07?= =?us-ascii?Q?3bBF/S2DhWxIzxaGD/E8m6Rq85qYQocA1Tmmf38RTK1xZyEtWHV6efbC+YLQ?= =?us-ascii?Q?L4/yGr6/wD85S+wMKhK8rmGkY5KIzffJbO1zfbQbcF+2MsIpO5cqi3rsdGGD?= =?us-ascii?Q?t/3cH95kc0gmj/gHigWdOUpSAX2ej5eXg8tHwYkq8nWD//T6zKGaYNlD/8ie?= =?us-ascii?Q?hVnDSOUukWxBveTkx0+8dRCy5orxKLZcoZa8EiWEA3eXzF2R4heQPfwAHbKr?= =?us-ascii?Q?HRTemXyVYSah0zUBy2t83Tyr90X6zokBReNm7kGni9S3YUSnywjsIS3cvZx6?= =?us-ascii?Q?kPl/Z8mXo6QA5hkZxYpqDoVzx56UJGZrmoyVIGMV8z4cdq/bNZvcBgFXsvoh?= =?us-ascii?Q?Ywn84eRN0Z0z9ubiOHnjfPRSWk5X0iUFWGz24jPjyFWX4A4wEaACjZQ9hW+K?= =?us-ascii?Q?Dt0qADTdLCuidllmnsJCRC3+2R73qDgU1gCfiSFZJUf1goe/8Z5G7YSgyxdG?= =?us-ascii?Q?3PSpTqqsswORwchJsti95636U555CA3+JYYvtY2xgZOa33PVGONxqkOKCVXR?= =?us-ascii?Q?phrYsWX73mCPrQeUoByij+/rBKKSzHWD4XbLJ3b/QjIBnUeTetjYofUkYgk4?= =?us-ascii?Q?KjN7qmJMRDGgoC0/QYq6TFONkPWC6paVu6UvEy5M1lu0/9Xu2A9xDy/FCiGv?= =?us-ascii?Q?NcRWTcuDPsEUZIwajQ5OzGEZZYPKUsrtOdcuV4t7dke5tP5+v6zUalkpWrsX?= =?us-ascii?Q?V9D2ESBpvhceiaWfR2/6KeJOP1cO2Uf4DnS/73L3IAT/PEkv77XJMNs8l2nM?= =?us-ascii?Q?WCIAy+ODn8Cmo6uyUZSpcrmKbB5Oqjpd8TdLWDNqZDxnn/T8SpiPNAawz02O?= =?us-ascii?Q?Mccz78pH2tLEcjyn42bCWYgXt/R0+CRJV9vbK2ia4FZ2xc7nF9D1CNdeEKUn?= =?us-ascii?Q?bWnalgmrAqw1smN8wPdN/fLXVUcH6P+yC8PqZEYL?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR11MB3713.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8109bf9c-371f-40f6-40ca-08da6623b7b0 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jul 2022 05:34:41.7860 (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: 8yQ9B6D6bPEkYK5AMeIeQvuOosf+hZd5HGNW9O+q69+Lkl6rZvY8sK7tWb7h3d8TdOIMH8H4NkBJ4vDLmFeHBw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB6029 Return-Path: ming.tan@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ming Tan -----Original Message----- From: devel@edk2.groups.io On Behalf Of yi1 li Sent: Friday, July 15, 2022 1:30 PM To: devel@edk2.groups.io Cc: Li, Yi1 ; Tan, Ming ; Luo, Heng <= heng.luo@intel.com> Subject: [edk2-devel] [staging/crypto-new-api PATCH] CryptoPkg: Fixed possi= ble security implications in ECDH and BN. 1. Origenal code mixes up the input/output parameters for the BN_rshift() f= unction - the output is actually the first parameter and not the second one= . Now we correct BnRShift() param order. 2. NID_X9_62_prime192v1() and NID_secp224r1 prohibited by Intel Crypto/TLS = Guidelines (due to being insufficiently secure). Now we remove those curve. 3. ECDH pubilc key check is insufficient and therefore opens the implementa= tion up to invalid curve attacks (see e.g.Dragonblood attack report). Need = to perform the checks described by Appendix D of the NIST SP800-186, or Sec= tion 5.6.2.3 of NIST SP800-56Ar3. Now we add full public key validating pro= cedures to EcDhDeriveSecret(). 4. Some APIs need more detail comment. Fix some typos and add more detail d= iscription for return value. Cc: Ming Tan Cc: Heng Luo Signed-off-by: Yi Li --- CryptoPkg/Driver/Crypto.c | 31 ++++++++++++++= ++++++----------- CryptoPkg/Include/Library/BaseCryptLib.h | 31 ++++++++++++++= ++++++----------- CryptoPkg/Library/BaseCryptLib/Bn/CryptBn.c | 7 ++++--- CryptoPkg/Library/BaseCryptLib/Bn/CryptBnNull.c | 4 +++- CryptoPkg/Library/BaseCryptLib/Ec/CryptEc.c | 61 ++++++++++++++= ++++++++++++++++++++--------------------------- CryptoPkg/Library/BaseCryptLib/Ec/CryptEcNull.c | 27 ++++++++++++++= +++---------- CryptoPkg/Library/BaseCryptLibNull/Bn/CryptBnNull.c | 4 +++- CryptoPkg/Library/BaseCryptLibNull/Ec/CryptEcNull.c | 27 ++++++++++++++= +++---------- CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c | 31 ++++++++++++++= ++++++----------- CryptoPkg/Private/Protocol/Crypto.h | 31 ++++++++++++++= ++++++----------- 10 files changed, 158 insertions(+), 96 deletions(-) diff --git a/CryptoPkg/Driver/Crypto.c b/CryptoPkg/Driver/Crypto.c index de= 422b7f53..10a0ce8800 100644 --- a/CryptoPkg/Driver/Crypto.c +++ b/CryptoPkg/Driver/Crypto.c @@ -4962,7 +4962,6 @@ CryptoServiceBigNumValueOne ( @param[out] BnRes The result. =20 @retval EFI_SUCCESS On success. - @retval EFI_OUT_OF_RESOURCES In case of internal allocation failures. @retval EFI_PROTOCOL_ERROR Otherwise. **/ EFI_STATUS @@ -5051,6 +5050,9 @@ CryptoServiceBigNumContextFree ( =20 @param[in] Bn Big number to set. @param[in] Val Value to set. + + @retval EFI_SUCCESS On success. + @retval EFI_PROTOCOL_ERROR Otherwise. **/ EFI_STATUS EFIAPI @@ -5092,7 +5094,7 @@ CryptoServiceBigNumAddMod ( using EcGroupFree() function. =20 @param[in] Group Identifying number for the ECC group (IANA "Group - Description" attribute registrty for RFC 2409). + Description" attribute registry for RFC 2409). =20 @retval EcGroup object On success. @retval NULL On failure. @@ -5114,8 +5116,8 @@ CryptoServiceEcGroupInit ( =20 @param[in] EcGroup EC group object. @param[out] BnPrime Group prime number. - @param[out] BnA A coofecient. - @param[out] BnB B coofecient. + @param[out] BnA A coefficient. + @param[out] BnB B coefficient. @param[in] BnCtx BN context. =20 @retval EFI_SUCCESS On success. @@ -5426,13 +5428,14 @@ CryptoServiceEcPointSetCompressedCoordinates ( /** Generate a key using ECDH algorithm. Please note, this function uses pseudo random number generator. The caller must make sure RandomSeed() - funtion was properly called before. + function was properly called before. =20 @param[in] Group Identifying number for the ECC group (IANA "Group - Description" attribute registrty for RFC 2409). + Description" attribute registry for RFC 2409). @param[out] PKey Pointer to an object that will hold the ECDH key. =20 @retval EFI_SUCCESS On success. + @retval EFI_UNSUPPORTED ECC group not supported. @retval EFI_PROTOCOL_ERROR On failure. **/ EFI_STATUS @@ -5466,8 +5469,9 @@ CryptoServiceEcDhKeyFree ( @param[in] PKey ECDH Key object. @param[out] EcPoint Properly initialized EC Point to hold the public ke= y. =20 - @retval EFI_SUCCESS On success. - @retval EFI_PROTOCOL_ERROR On failure. + @retval EFI_SUCCESS On success. + @retval EFI_INVALID_PARAMETER EcPoint should be initialized properly. + @retval EFI_PROTOCOL_ERROR On failure. **/ EFI_STATUS EFIAPI @@ -5484,15 +5488,20 @@ CryptoServiceEcDhGetPubKey ( =20 @param[in] PKey ECDH Key object. @param[in] Group Identifying number for the ECC group (IANA "G= roup - Description" attribute registrty for RFC 2409= ). + Description" attribute registry for RFC 2409)= . @param[in] EcPointPublic Peer public key. @param[out] SecretSize On success, holds secret size. @param[out] Secret On success, holds the derived secret. Should be freed by caller using FreePool() function. =20 - @retval EFI_SUCCESS On success. - @retval EFI_PROTOCOL_ERROR On failure. + @retval EFI_SUCCESS On success. + @retval EFI_UNSUPPORTED ECC group not supported. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is= TRUE: + Secret is NULL. + SecretSize is NULL. + Public key in EcPointPublic is invalid. + @retval EFI_PROTOCOL_ERROR On failure. **/ EFI_STATUS EFIAPI diff --git a/CryptoPkg/Include/Library/BaseCryptLib.h b/CryptoPkg/Include/L= ibrary/BaseCryptLib.h index 8fcb496c40..0de9f0739e 100644 --- a/CryptoPkg/Include/Library/BaseCryptLib.h +++ b/CryptoPkg/Include/Library/BaseCryptLib.h @@ -2723,7 +2723,6 @@ BigNumValueOne ( @param[out] BnRes The result. =20 @retval EFI_SUCCESS On success. - @retval EFI_OUT_OF_RESOURCES In case of internal allocation failures. @retval EFI_PROTOCOL_ERROR Otherwise. **/ EFI_STATUS @@ -2797,6 +2796,9 @@ BigNumContextFree ( =20 @param[in] Bn Big number to set. @param[in] Val Value to set. + + @retval EFI_SUCCESS On success. + @retval EFI_PROTOCOL_ERROR Otherwise. **/ EFI_STATUS EFIAPI @@ -2832,7 +2834,7 @@ BigNumAddMod ( using EcGroupFree() function. =20 @param[in] Group Identifying number for the ECC group (IANA "Group - Description" attribute registrty for RFC 2409). + Description" attribute registry for RFC 2409). =20 @retval EcGroup object On success. @retval NULL On failure. @@ -2851,8 +2853,8 @@ EcGroupInit ( =20 @param[in] EcGroup EC group object. @param[out] BnPrime Group prime number. - @param[out] BnA A coofecient. - @param[out] BnB B coofecient. + @param[out] BnA A coefficient. + @param[out] BnB B coefficient. @param[in] BnCtx BN context. =20 @retval EFI_SUCCESS On success. @@ -3121,13 +3123,14 @@ EcPointSetCompressedCoordinates ( /** Generate a key using ECDH algorithm. Please note, this function uses pseudo random number generator. The caller must make sure RandomSeed() - funtion was properly called before. + function was properly called before. =20 @param[in] Group Identifying number for the ECC group (IANA "Group - Description" attribute registrty for RFC 2409). + Description" attribute registry for RFC 2409). @param[out] PKey Pointer to an object that will hold the ECDH key. =20 @retval EFI_SUCCESS On success. + @retval EFI_UNSUPPORTED ECC group not supported. @retval EFI_PROTOCOL_ERROR On failure. **/ EFI_STATUS @@ -3155,8 +3158,9 @@ EcDhKeyFree ( @param[in] PKey ECDH Key object. @param[out] EcPoint Properly initialized EC Point to hold the public ke= y. =20 - @retval EFI_SUCCESS On success. - @retval EFI_PROTOCOL_ERROR On failure. + @retval EFI_SUCCESS On success. + @retval EFI_INVALID_PARAMETER EcPoint should be initialized properly. + @retval EFI_PROTOCOL_ERROR On failure. **/ EFI_STATUS EFIAPI @@ -3170,15 +3174,20 @@ EcDhGetPubKey ( =20 @param[in] PKey ECDH Key object. @param[in] Group Identifying number for the ECC group (IANA "G= roup - Description" attribute registrty for RFC 2409= ). + Description" attribute registry for RFC 2409)= . @param[in] EcPointPublic Peer public key. @param[out] SecretSize On success, holds secret size. @param[out] Secret On success, holds the derived secret. Should be freed by caller using FreePool() function. =20 - @retval EFI_SUCCESS On success. - @retval EFI_PROTOCOL_ERROR On failure. + @retval EFI_SUCCESS On success. + @retval EFI_UNSUPPORTED ECC group not supported. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is= TRUE: + Secret is NULL. + SecretSize is NULL. + Public key in EcPointPublic is invalid. + @retval EFI_PROTOCOL_ERROR On failure. **/ EFI_STATUS EFIAPI diff --git a/CryptoPkg/Library/BaseCryptLib/Bn/CryptBn.c b/CryptoPkg/Librar= y/BaseCryptLib/Bn/CryptBn.c index 3e43492a56..b6411cd541 100644 --- a/CryptoPkg/Library/BaseCryptLib/Bn/CryptBn.c +++ b/CryptoPkg/Library/BaseCryptLib/Bn/CryptBn.c @@ -442,7 +442,6 @@ BigNumValueOne ( @param[out] BnRes The result. =20 @retval EFI_SUCCESS On success. - @retval EFI_OUT_OF_RESOURCES In case of internal allocation failures. @retval EFI_PROTOCOL_ERROR Otherwise. **/ EFI_STATUS @@ -453,8 +452,7 @@ BigNumRShift ( OUT VOID *BnRes ) { - // BN_rshift() does not modify the first argument, so we remove const. - if (BN_rshift ((BIGNUM *)Bn, BnRes, (int)n) =3D=3D 1) { + if (BN_rshift (BnRes, Bn, (int)n) =3D=3D 1) { return EFI_SUCCESS; } else { return EFI_PROTOCOL_ERROR; @@ -547,6 +545,9 @@ BigNumContextFree ( =20 @param[in] Bn Big number to set. @param[in] Val Value to set. + + @retval EFI_SUCCESS On success. + @retval EFI_PROTOCOL_ERROR Otherwise. **/ EFI_STATUS EFIAPI diff --git a/CryptoPkg/Library/BaseCryptLib/Bn/CryptBnNull.c b/CryptoPkg/Li= brary/BaseCryptLib/Bn/CryptBnNull.c index 4a27433a0e..4d2fa039df 100644 --- a/CryptoPkg/Library/BaseCryptLib/Bn/CryptBnNull.c +++ b/CryptoPkg/Library/BaseCryptLib/Bn/CryptBnNull.c @@ -395,7 +395,6 @@ BigNumValueOne ( @param[out] BnRes The result. =20 @retval EFI_SUCCESS On success. - @retval EFI_OUT_OF_RESOURCES In case of internal allocation failures. @retval EFI_PROTOCOL_ERROR Otherwise. **/ EFI_STATUS @@ -487,6 +486,9 @@ BigNumContextFree ( =20 @param[in] Bn Big number to set. @param[in] Val Value to set. + + @retval EFI_SUCCESS On success. + @retval EFI_PROTOCOL_ERROR Otherwise. **/ EFI_STATUS EFIAPI diff --git a/CryptoPkg/Library/BaseCryptLib/Ec/CryptEc.c b/CryptoPkg/Librar= y/BaseCryptLib/Ec/CryptEc.c index 4d1aab8d32..90d1b8bce7 100644 --- a/CryptoPkg/Library/BaseCryptLib/Ec/CryptEc.c +++ b/CryptoPkg/Library/BaseCryptLib/Ec/CryptEc.c @@ -21,13 +21,13 @@ #include =20 /** - Temp comment. + Return the Nid of certain ECC group. =20 @param[in] Group Identifying number for the ECC group (IANA "Group - Description" attribute registrty for RFC 2409). + Description" attribute registry for RFC 2409). =20 - @retval EcGroup object On success. - @retval NULL On failure. + @retval !=3D-1 On success. + @retval -1 ECC group not supported. **/ STATIC INT32 @@ -47,12 +47,6 @@ GroupToNid ( case 21: Nid =3D NID_secp521r1; break; - case 25: - Nid =3D NID_X9_62_prime192v1; - break; - case 26: - Nid =3D NID_secp224r1; - break; default: return -1; } @@ -66,7 +60,7 @@ GroupToNid ( using EcGroupFree() function. =20 @param[in] Group Identifying number for the ECC group (IANA "Group - Description" attribute registrty for RFC 2409). + Description" attribute registry for RFC 2409). =20 @retval EcGroup object On success. @retval NULL On failure. @@ -96,8 +90,8 @@ EcGroupInit ( =20 @param[in] EcGroup EC group object. @param[out] BnPrime Group prime number. - @param[out] BnA A coofecient. - @param[out] BnB B coofecient. + @param[out] BnA A coefficient. + @param[out] BnB B coefficient. @param[in] BnCtx BN context. =20 @retval EFI_SUCCESS On success. @@ -218,7 +212,7 @@ EcPointGetAffineCoordinates ( ) { return EC_POINT_get_affine_coordinates (EcGroup, EcPoint, BnX, BnY, BnCt= x) ? - EFI_SUCCESS : EFI_INVALID_PARAMETER; + EFI_SUCCESS : EFI_PROTOCOL_ERROR; } =20 /** @@ -244,7 +238,7 @@ EcPointSetAffineCoordinates ( ) { return EC_POINT_set_affine_coordinates (EcGroup, EcPoint, BnX, BnY, BnCt= x) ? - EFI_SUCCESS : EFI_INVALID_PARAMETER; + EFI_SUCCESS : EFI_PROTOCOL_ERROR; } =20 /** @@ -271,7 +265,7 @@ EcPointAdd ( ) { return EC_POINT_add (EcGroup, EcPointResult, EcPointA, EcPointB, BnCtx) = ? - EFI_SUCCESS : EFI_INVALID_PARAMETER; + EFI_SUCCESS : EFI_PROTOCOL_ERROR; } =20 /** @@ -298,7 +292,7 @@ EcPointMul ( ) { return EC_POINT_mul (EcGroup, EcPointResult, NULL, EcPoint, BnPScalar, B= nCtx) ? - EFI_SUCCESS : EFI_INVALID_PARAMETER; + EFI_SUCCESS : EFI_PROTOCOL_ERROR; } =20 /** @@ -320,7 +314,7 @@ EcPointInvert ( ) { return EC_POINT_invert (EcGroup, EcPoint, BnCtx) ? - EFI_SUCCESS : EFI_INVALID_PARAMETER; + EFI_SUCCESS : EFI_PROTOCOL_ERROR; } =20 /** @@ -414,19 +408,20 @@ EcPointSetCompressedCoordinates ( ) { return EC_POINT_set_compressed_coordinates (EcGroup, EcPoint, BnX, YBit,= BnCtx) ? - EFI_SUCCESS : EFI_INVALID_PARAMETER; + EFI_SUCCESS : EFI_PROTOCOL_ERROR; } =20 /** Generate a key using ECDH algorithm. Please note, this function uses pseudo random number generator. The caller must make sure RandomSeed() - funtion was properly called before. + function was properly called before. =20 @param[in] Group Identifying number for the ECC group (IANA "Group - Description" attribute registrty for RFC 2409). + Description" attribute registry for RFC 2409). @param[out] PKey Pointer to an object that will hold the ECDH key. =20 @retval EFI_SUCCESS On success. + @retval EFI_UNSUPPORTED ECC group not supported. @retval EFI_PROTOCOL_ERROR On failure. **/ EFI_STATUS @@ -508,8 +503,9 @@ EcDhKeyFree ( @param[in] PKey ECDH Key object. @param[out] EcPoint Properly initialized EC Point to hold the public ke= y. =20 - @retval EFI_SUCCESS On success. - @retval EFI_PROTOCOL_ERROR On failure. + @retval EFI_SUCCESS On success. + @retval EFI_INVALID_PARAMETER EcPoint should be initialized properly. + @retval EFI_PROTOCOL_ERROR On failure. **/ EFI_STATUS EFIAPI @@ -553,15 +549,21 @@ out: =20 @param[in] PKey ECDH Key object. @param[in] Group Identifying number for the ECC group (IANA "G= roup - Description" attribute registrty for RFC 2409= ). - @param[in] EcPointPublic Peer public key. + Description" attribute registry for RFC 2409)= . + @param[in] EcPointPublic Peer public key. Certain sanity checks on the= key + will be performed to confirm that it is valid= . @param[out] SecretSize On success, holds secret size. @param[out] Secret On success, holds the derived secret. Should be freed by caller using FreePool() function. =20 - @retval EFI_SUCCESS On success. - @retval EFI_PROTOCOL_ERROR On failure. + @retval EFI_SUCCESS On success. + @retval EFI_UNSUPPORTED ECC group not supported. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is= TRUE: + Secret is NULL. + SecretSize is NULL. + Public key in EcPointPublic is invalid. + @retval EFI_PROTOCOL_ERROR On failure. **/ EFI_STATUS EFIAPI @@ -605,6 +607,11 @@ EcDhDeriveSecret ( goto fail; } =20 + if (!EC_KEY_check_key (EcKey)) { + Status =3D EFI_INVALID_PARAMETER; + goto fail; + } + Ctx =3D EVP_PKEY_CTX_new (PKey, NULL); if ((Ctx =3D=3D NULL) || (EVP_PKEY_derive_init (Ctx) !=3D 1) || (EVP_PKEY_derive_set_peer (Ctx, PeerKey) !=3D 1) || diff --git a/Cry= ptoPkg/Library/BaseCryptLib/Ec/CryptEcNull.c b/CryptoPkg/Library/BaseCryptL= ib/Ec/CryptEcNull.c index 2d7e5db464..e7fe378095 100644 --- a/CryptoPkg/Library/BaseCryptLib/Ec/CryptEcNull.c +++ b/CryptoPkg/Library/BaseCryptLib/Ec/CryptEcNull.c @@ -15,7 +15,7 @@ using EcGroupFree() function. =20 @param[in] Group Identifying number for the ECC group (IANA "Group - Description" attribute registrty for RFC 2409). + Description" attribute registry for RFC 2409). =20 @retval EcGroup object On success. @retval NULL On failure. @@ -38,8 +38,8 @@ EcGroupInit ( =20 @param[in] EcGroup EC group object. @param[out] BnPrime Group prime number. - @param[out] BnA A coofecient. - @param[out] BnB B coofecient. + @param[out] BnA A coefficient. + @param[out] BnB B coefficient. @param[in] BnCtx BN context. =20 @retval EFI_SUCCESS On success. @@ -362,13 +362,14 @@ EcPointSetCompressedCoordinates ( /** Generate a key using ECDH algorithm. Please note, this function uses pseudo random number generator. The caller must make sure RandomSeed() - funtion was properly called before. + function was properly called before. =20 @param[in] Group Identifying number for the ECC group (IANA "Group - Description" attribute registrty for RFC 2409). + Description" attribute registry for RFC 2409). @param[out] PKey Pointer to an object that will hold the ECDH key. =20 @retval EFI_SUCCESS On success. + @retval EFI_UNSUPPORTED ECC group not supported. @retval EFI_PROTOCOL_ERROR On failure. **/ EFI_STATUS @@ -403,8 +404,9 @@ EcDhKeyFree ( @param[in] PKey ECDH Key object. @param[out] EcPoint Properly initialized EC Point to hold the public ke= y. =20 - @retval EFI_SUCCESS On success. - @retval EFI_PROTOCOL_ERROR On failure. + @retval EFI_SUCCESS On success. + @retval EFI_INVALID_PARAMETER EcPoint should be initialized properly. + @retval EFI_PROTOCOL_ERROR On failure. **/ EFI_STATUS EFIAPI @@ -422,15 +424,20 @@ EcDhGetPubKey ( =20 @param[in] PKey ECDH Key object. @param[in] Group Identifying number for the ECC group (IANA "G= roup - Description" attribute registrty for RFC 2409= ). + Description" attribute registry for RFC 2409)= . @param[in] EcPointPublic Peer public key. @param[out] SecretSize On success, holds secret size. @param[out] Secret On success, holds the derived secret. Should be freed by caller using FreePool() function. =20 - @retval EFI_SUCCESS On success. - @retval EFI_PROTOCOL_ERROR On failure. + @retval EFI_SUCCESS On success. + @retval EFI_UNSUPPORTED ECC group not supported. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is= TRUE: + Secret is NULL. + SecretSize is NULL. + Public key in EcPointPublic is invalid. + @retval EFI_PROTOCOL_ERROR On failure. **/ EFI_STATUS EFIAPI diff --git a/CryptoPkg/Library/BaseCryptLibNull/Bn/CryptBnNull.c b/CryptoPk= g/Library/BaseCryptLibNull/Bn/CryptBnNull.c index 4a27433a0e..4d2fa039df 100644 --- a/CryptoPkg/Library/BaseCryptLibNull/Bn/CryptBnNull.c +++ b/CryptoPkg/Library/BaseCryptLibNull/Bn/CryptBnNull.c @@ -395,7 +395,6 @@ BigNumValueOne ( @param[out] BnRes The result. =20 @retval EFI_SUCCESS On success. - @retval EFI_OUT_OF_RESOURCES In case of internal allocation failures. @retval EFI_PROTOCOL_ERROR Otherwise. **/ EFI_STATUS @@ -487,6 +486,9 @@ BigNumContextFree ( =20 @param[in] Bn Big number to set. @param[in] Val Value to set. + + @retval EFI_SUCCESS On success. + @retval EFI_PROTOCOL_ERROR Otherwise. **/ EFI_STATUS EFIAPI diff --git a/CryptoPkg/Library/BaseCryptLibNull/Ec/CryptEcNull.c b/CryptoPk= g/Library/BaseCryptLibNull/Ec/CryptEcNull.c index 2d7e5db464..e7fe378095 100644 --- a/CryptoPkg/Library/BaseCryptLibNull/Ec/CryptEcNull.c +++ b/CryptoPkg/Library/BaseCryptLibNull/Ec/CryptEcNull.c @@ -15,7 +15,7 @@ using EcGroupFree() function. =20 @param[in] Group Identifying number for the ECC group (IANA "Group - Description" attribute registrty for RFC 2409). + Description" attribute registry for RFC 2409). =20 @retval EcGroup object On success. @retval NULL On failure. @@ -38,8 +38,8 @@ EcGroupInit ( =20 @param[in] EcGroup EC group object. @param[out] BnPrime Group prime number. - @param[out] BnA A coofecient. - @param[out] BnB B coofecient. + @param[out] BnA A coefficient. + @param[out] BnB B coefficient. @param[in] BnCtx BN context. =20 @retval EFI_SUCCESS On success. @@ -362,13 +362,14 @@ EcPointSetCompressedCoordinates ( /** Generate a key using ECDH algorithm. Please note, this function uses pseudo random number generator. The caller must make sure RandomSeed() - funtion was properly called before. + function was properly called before. =20 @param[in] Group Identifying number for the ECC group (IANA "Group - Description" attribute registrty for RFC 2409). + Description" attribute registry for RFC 2409). @param[out] PKey Pointer to an object that will hold the ECDH key. =20 @retval EFI_SUCCESS On success. + @retval EFI_UNSUPPORTED ECC group not supported. @retval EFI_PROTOCOL_ERROR On failure. **/ EFI_STATUS @@ -403,8 +404,9 @@ EcDhKeyFree ( @param[in] PKey ECDH Key object. @param[out] EcPoint Properly initialized EC Point to hold the public ke= y. =20 - @retval EFI_SUCCESS On success. - @retval EFI_PROTOCOL_ERROR On failure. + @retval EFI_SUCCESS On success. + @retval EFI_INVALID_PARAMETER EcPoint should be initialized properly. + @retval EFI_PROTOCOL_ERROR On failure. **/ EFI_STATUS EFIAPI @@ -422,15 +424,20 @@ EcDhGetPubKey ( =20 @param[in] PKey ECDH Key object. @param[in] Group Identifying number for the ECC group (IANA "G= roup - Description" attribute registrty for RFC 2409= ). + Description" attribute registry for RFC 2409)= . @param[in] EcPointPublic Peer public key. @param[out] SecretSize On success, holds secret size. @param[out] Secret On success, holds the derived secret. Should be freed by caller using FreePool() function. =20 - @retval EFI_SUCCESS On success. - @retval EFI_PROTOCOL_ERROR On failure. + @retval EFI_SUCCESS On success. + @retval EFI_UNSUPPORTED ECC group not supported. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is= TRUE: + Secret is NULL. + SecretSize is NULL. + Public key in EcPointPublic is invalid. + @retval EFI_PROTOCOL_ERROR On failure. **/ EFI_STATUS EFIAPI diff --git a/CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c b/Crypt= oPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c index 548116abb4..0410067c9d 100644 --- a/CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c +++ b/CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c @@ -4069,7 +4069,6 @@ BigNumValueOne ( @param[out] BnRes The result. =20 @retval EFI_SUCCESS On success. - @retval EFI_OUT_OF_RESOURCES In case of internal allocation failures. @retval EFI_PROTOCOL_ERROR Otherwise. **/ EFI_STATUS @@ -4158,6 +4157,9 @@ BigNumContextFree ( =20 @param[in] Bn Big number to set. @param[in] Val Value to set. + + @retval EFI_SUCCESS On success. + @retval EFI_PROTOCOL_ERROR Otherwise. **/ EFI_STATUS EFIAPI @@ -4199,7 +4201,7 @@ BigNumAddMod ( using EcGroupFree() function. =20 @param[in] Group Identifying number for the ECC group (IANA "Group - Description" attribute registrty for RFC 2409). + Description" attribute registry for RFC 2409). =20 @retval EcGroup object On success. @retval NULL On failure. @@ -4221,8 +4223,8 @@ EcGroupInit ( =20 @param[in] EcGroup EC group object. @param[out] BnPrime Group prime number. - @param[out] BnA A coofecient. - @param[out] BnB B coofecient. + @param[out] BnA A coefficient. + @param[out] BnB B coefficient. @param[in] BnCtx BN context. =20 @retval EFI_SUCCESS On success. @@ -4533,13 +4535,14 @@ EcPointSetCompressedCoordinates ( /** Generate a key using ECDH algorithm. Please note, this function uses pseudo random number generator. The caller must make sure RandomSeed() - funtion was properly called before. + function was properly called before. =20 @param[in] Group Identifying number for the ECC group (IANA "Group - Description" attribute registrty for RFC 2409). + Description" attribute registry for RFC 2409). @param[out] PKey Pointer to an object that will hold the ECDH key. =20 @retval EFI_SUCCESS On success. + @retval EFI_UNSUPPORTED ECC group not supported. @retval EFI_PROTOCOL_ERROR On failure. **/ EFI_STATUS @@ -4573,8 +4576,9 @@ EcDhKeyFree ( @param[in] PKey ECDH Key object. @param[out] EcPoint Properly initialized EC Point to hold the public ke= y. =20 - @retval EFI_SUCCESS On success. - @retval EFI_PROTOCOL_ERROR On failure. + @retval EFI_SUCCESS On success. + @retval EFI_INVALID_PARAMETER EcPoint should be initialized properly. + @retval EFI_PROTOCOL_ERROR On failure. **/ EFI_STATUS EFIAPI @@ -4591,15 +4595,20 @@ EcDhGetPubKey ( =20 @param[in] PKey ECDH Key object. @param[in] Group Identifying number for the ECC group (IANA "G= roup - Description" attribute registrty for RFC 2409= ). + Description" attribute registry for RFC 2409)= . @param[in] EcPointPublic Peer public key. @param[out] SecretSize On success, holds secret size. @param[out] Secret On success, holds the derived secret. Should be freed by caller using FreePool() function. =20 - @retval EFI_SUCCESS On success. - @retval EFI_PROTOCOL_ERROR On failure. + @retval EFI_SUCCESS On success. + @retval EFI_UNSUPPORTED ECC group not supported. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is= TRUE: + Secret is NULL. + SecretSize is NULL. + Public key in EcPointPublic is invalid. + @retval EFI_PROTOCOL_ERROR On failure. **/ EFI_STATUS EFIAPI diff --git a/CryptoPkg/Private/Protocol/Crypto.h b/CryptoPkg/Private/Protoc= ol/Crypto.h index 1b31714d77..1cf5d18cc3 100644 --- a/CryptoPkg/Private/Protocol/Crypto.h +++ b/CryptoPkg/Private/Protocol/Crypto.h @@ -3863,7 +3863,6 @@ CONST VOID * @param[out] BnRes The result, such that (BnA * BnB) % BnM. =20 @retval EFI_SUCCESS On success. - @retval EFI_OUT_OF_RESOURCES In case of internal allocation failures. @retval EFI_PROTOCOL_ERROR Otherwise. **/ typedef @@ -3935,6 +3934,9 @@ VOID =20 @param[in] Bn Big number to set. @param[in] Val Value to set. + + @retval EFI_SUCCESS On success. + @retval EFI_PROTOCOL_ERROR Otherwise. **/ typedef EFI_STATUS @@ -3970,7 +3972,7 @@ EFI_STATUS using EcGroupFree() function. =20 @param[in] Group Identifying number for the ECC group (IANA "Group - Description" attribute registrty for RFC 2409) + Description" attribute registry for RFC 2409) =20 @retval EcGroup object On success @retval NULL On failure @@ -3989,8 +3991,8 @@ VOID * =20 @param[in] EcGroup EC group object @param[out] BnPrime Group prime number - @param[out] BnA A coofecient - @param[out] BnB B coofecient + @param[out] BnA A coefficient + @param[out] BnB B coefficient @param[in] BnCtx BN context =20 @retval EFI_SUCCESS On success @@ -4260,13 +4262,14 @@ EFI_STATUS /** Generate a key using ECDH algorithm. Please note, this function uses pseudo random number generator. The caller must make sure RandomSeed() - funtion was properly called before. + function was properly called before. =20 @param[in] Group Identifying number for the ECC group (IANA "Group - Description" attribute registrty for RFC 2409) + Description" attribute registry for RFC 2409) @param[out] PKey Pointer to an object that will hold the ECDH key =20 @retval EFI_SUCCESS On success + @retval EFI_UNSUPPORTED ECC group not supported. @retval EFI_PROTOCOL_ERROR On failure **/ typedef @@ -4294,8 +4297,9 @= @ VOID @param[in] PKey ECDH Key object @param[out] EcPoint Properly initialized EC Point to hold the public ke= y =20 - @retval EFI_SUCCESS On success - @retval EFI_PROTOCOL_ERROR On failure + @retval EFI_SUCCESS On success + @retval EFI_INVALID_PARAMETER EcPoint should be initialized properly. + @retval EFI_PROTOCOL_ERROR On failure **/ typedef EFI_STATUS @@ -4309,15 +4313,20 @@ EFI_STATUS =20 @param[in] PKey ECDH Key object @param[in] Group Identifying number for the ECC group (IANA "G= roup - Description" attribute registrty for RFC 2409= ) + Description" attribute registry for RFC=20 + 2409) @param[in] EcPointPublic Peer public key @param[out] SecretSize On success, holds secret size @param[out] Secret On success, holds the derived secret Should be freed by caller using FreePool() function. =20 - @retval EFI_SUCCESS On success - @retval EFI_PROTOCOL_ERROR On failure + @retval EFI_SUCCESS On success. + @retval EFI_UNSUPPORTED ECC group not supported. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is= TRUE: + Secret is NULL. + SecretSize is NULL. + Public key in EcPointPublic is invalid. + @retval EFI_PROTOCOL_ERROR On failure. **/ typedef EFI_STATUS -- 2.31.1.windows.1