From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web08.4561.1603493822697668617 for ; Fri, 23 Oct 2020 15:57:02 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=Lx69qkyi; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: jiewen.yao@intel.com) IronPort-SDR: rV/jDICHC6560lZTaMfwfhBokmguSfh2zTv4lHjkEJWKWmilIGvFLIsTk0KN7YfHS2G2gCbA1P eao53FCqLUOQ== X-IronPort-AV: E=McAfee;i="6000,8403,9783"; a="155525931" X-IronPort-AV: E=Sophos;i="5.77,410,1596524400"; d="scan'208";a="155525931" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Oct 2020 15:57:01 -0700 IronPort-SDR: W6ko3LGX44BMOnkqk5LzWjQzPMKTWanu+XG56CGTejM0K0fCr438gctmD52eFt6gvRoi20k2uq FVV3UpSW7T1g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,410,1596524400"; d="scan'208";a="360369483" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga007.jf.intel.com with ESMTP; 23 Oct 2020 15:57:01 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 23 Oct 2020 15:57:01 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 23 Oct 2020 15:57:00 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Fri, 23 Oct 2020 15:57:00 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.176) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Fri, 23 Oct 2020 15:56:59 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FmvDpJWVufqjXguQ8eZD0Ogvg1X/QrHDPArKBzza3osk8TTIDs5V5NbEJ/HYGP5kb7o7Nooypufcd2bDxnVtPOi7qnaR1dhPXg0wqjRy7iNDh9zgAB8d77PDZvo+HHSynOEhHOD/XB72WFgouNORUR3eefNxC9MgwubHYKewBdeclTx1F/qkY0s8NsBW+HGUCWeKj8us1zGFA8xvl9ddsTPSb2XnJU3E6ybV5yifD4DfsEp63fYXMxy35Pmk5VghXHKGW0hkJvoPwgMigbz2O+ovaBBfGhHvQshWQkkyEZx8dbwnsseQgY+8no2gb27T0Ke/ynrcmmCWdekLDh1dnQ== 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=ZxGNf2L8NOKTp8iaFGJkuSCtXmq/zQzfWjzsXFT6DNs=; b=nSmqVLbWZbDSy6tsIP750FJOuB5gn31bCoZl0HzDEuTbnrmjxkYg3g8JxENQN4UTSMH3sxP2Vse11oELET6jfwnz96BjpBuQ9VoCdIPBnKQm+mJM/F0dqBtEeKEzKUwe32lN9EDVlvR2z0B+jdnZVIig8ZLRKuwtmjw+wNfSu9wMgDv6Yl6g+bJWkw38wYokPT123dJ8qSm2W22OpSCJzoyzzs6o64JCILukJQX27O2wXdrSIgdV9Jn8Y1bTAjtNY6nvavR/3Pb9iiOg51WfrCeZhTL/q8bCBcRSNJjNM0RP6prO7BXQThZAYUh2f3cYLffjDRO7rydWbkyyrvfitw== 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=ZxGNf2L8NOKTp8iaFGJkuSCtXmq/zQzfWjzsXFT6DNs=; b=Lx69qkyiiRRGJMfkpddaa1JJmHoM76iWoAWSLdwg7+9lnexzMR2hM4ul6nJ/6PIjHaEtzDEl5kWXqkyvXKRY4MxDD1RV1Px8eqlhBEAfqYOSO9dUe/FiyZT7uDowUSagRKzuPzFCvvodA848TR45dXQhtFAkzb125qw8doUWfaw= Received: from CY4PR11MB1288.namprd11.prod.outlook.com (2603:10b6:903:23::8) by CY4PR11MB0008.namprd11.prod.outlook.com (2603:10b6:910:76::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.28; Fri, 23 Oct 2020 22:56:57 +0000 Received: from CY4PR11MB1288.namprd11.prod.outlook.com ([fe80::8948:caa4:ca1a:23ac]) by CY4PR11MB1288.namprd11.prod.outlook.com ([fe80::8948:caa4:ca1a:23ac%10]) with mapi id 15.20.3477.028; Fri, 23 Oct 2020 22:56:57 +0000 From: "Yao, Jiewen" To: "Zurcher, Christopher J" , "devel@edk2.groups.io" CC: "Wang, Jian J" , "Lu, XiaoyuX" , Ard Biesheuvel , "Yao, Jiewen" Subject: Re: [PATCH v3 0/2] CryptoPkg/OpensslLib: Add native instruction support for X64 Thread-Topic: [PATCH v3 0/2] CryptoPkg/OpensslLib: Add native instruction support for X64 Thread-Index: AQHWomtsc/hyP1oknUui8L6WK87Cr6mckeOwgARxkjCABNagkA== Date: Fri, 23 Oct 2020 22:56:56 +0000 Message-ID: References: <20201014204842.4161-1-christopher.j.zurcher@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.217] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 870732cf-39c6-413f-423f-08d877a6f1da x-ms-traffictypediagnostic: CY4PR11MB0008: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: iepu4mO5lvSNC8gz0w33o0VRukkP6OGpWnmG3Bcpag74YXMx2CHn1GsAa+pSavExJ1Arbu5+W+x5h3oI4qH8xKbghwUCy6zb9IJsS+FWXbRhXX7EtC5CX/Z6+H8yhklovOVne5iVUO2LHoMwtZZo+Kkgztg9pX/oC6pyf/Dr8qRmU1+wwdGLXZpZvv3MRbwYFMUEiLjpHyoyIfeiT2ayLyfX24cpJva2aICSTNPPUqwcIs3Gdf1fDGMRdbJfgSwaoTPJtmWxLNu9yDXe5YhMUZ3+OYKWZpQWdRNFtxAqemPfJyD+T9nuTzbjiT4gN82CC5rYqXXcW1wkhuwEfKY4O/67m13R32z9QURZCixRsizOOpZ9mJDnUbKulesSiB+c7B2OAv/H54C8TNSZtZmKoA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR11MB1288.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(396003)(346002)(136003)(39860400002)(366004)(52536014)(26005)(33656002)(110136005)(478600001)(966005)(54906003)(86362001)(5660300002)(9686003)(7696005)(6506007)(53546011)(66556008)(8936002)(19627235002)(83380400001)(66446008)(186003)(316002)(66946007)(64756008)(8676002)(66476007)(71200400001)(4326008)(55016002)(76116006)(107886003)(2906002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: Ud7FSfvAJfgwlRRmUWSOaxoBw7URs78zyTk2pr8KGAAdgzUROOICaO6h8DZUOGRvm7PVBFkp5g3PxZvGg3IlH4OmkL5MPk5i8MdOaKqG6dUqV17m3bYwi3s43ydWvnA05hb5YM/aKqXcOQ5H2wmdKhkIjSwbIF5spfCqScNx04QF+LlYv11HEBmkhlxYO6KtxwocHWXONB0bOGoz4JbjILWHbZP2LNdPaq6o2kpGk/IhEvPqnznfLMdbhD5BlAexL7zkkS7Z/O3cEwAp+Fpst+sBh01uA16XERmfCcmLACJyi/7DZ77eREnWZWsWOY0Vj+kGATr/dPJCrqubKwFgXYe+emfkg1BuL960F24A4qoU6v0tLjoJJ2zbI5Yyg0+og/Bmt6ina9ZssXDmSAxEXnKTO8rezvIlWHJZn0d/DRHwNQbsRFhaFDTa7q5AtTtnVV5v66LOYo9YyM87j8FaCgsrMfRHiRBEFbOF76SsDU54bveEufjPdIwfAE+LsXcNVm7b+wjQlIYHbCayHSay4LsaiFbAV9Wy7w0hAgCnyuc3VCiyp3wP82OihoCUZiXtiVotx+Ax0SgpFQrz8AZ6syal5TO77NDhJoiqHRAf3EHdDI0CBpot7uBO6d4DTFmN2MqyC+DGEb1ULA40fL1Erg== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY4PR11MB1288.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 870732cf-39c6-413f-423f-08d877a6f1da X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Oct 2020 22:56:57.7765 (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: yo01NZCAxC8Vdi6bJv/6qbWxDUK4zmFjFEZMielHvx7zr637N+pZ0x6/DC1eR97xu7p+meRG9+HA9iI0lmDv7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB0008 Return-Path: jiewen.yao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Zurcher, Christopher J > Sent: Wednesday, October 21, 2020 5:10 AM > To: Yao, Jiewen ; devel@edk2.groups.io > Cc: Wang, Jian J ; Lu, XiaoyuX > ; Ard Biesheuvel > Subject: RE: [PATCH v3 0/2] CryptoPkg/OpensslLib: Add native instruction > support for X64 >=20 > Comments inline. >=20 > > -----Original Message----- > > From: Yao, Jiewen > > Sent: Saturday, October 17, 2020 18:26 > > To: Zurcher, Christopher J ; > > devel@edk2.groups.io > > Cc: Wang, Jian J ; Lu, XiaoyuX > ; > > Ard Biesheuvel > > Subject: RE: [PATCH v3 0/2] CryptoPkg/OpensslLib: Add native instructio= n > > support for X64 > > > > Thanks Zurcher. > > > > Comment: > > 1) I do not see the copy right header and license header for uefi-asm.c= onf. > > Please add it. > > > > 2) Is "ApiHooks.c" only for Visual Studio? Do we need it for GCC and LL= VM? > > If it is only for visual studio, I suggest we rename to MsftApiHooks.c,= and > > add "| MSFT" in INF. >=20 > ApiHooks.c is for any compiler building the assembly files, not only Visu= al > Studio. [Jiewen] Got it. Thanks for the clarification. It is only needed for X64 assembly. Right? If so, I recommend to put it to [Source.X64] >=20 > > > > 3) Since nasm is only for X64=B8 please use [Source.X64] for them. >=20 > Since the .c file set can change depending on which assembly target is > selected (X64 vs. IA32 etc.) and since this .inf file is only for X64 tar= gets, I will > move all sources under the [Sources.X64] header. Is that OK? Leaving the > current [Sources] adding a second autogen section under [Sources.X64] for > only the .nasm files would add another layer of complexity to > process_files.pl. [Jiewen] I think it is OK. You can put all X64 released C file under [Sourc= es.X64]. >=20 > > > > Please refer to > > > https://github.com/tianocore/edk2/blob/master/MdePkg/Library/BaseLib/Ba > seLib. > > inf, on 2) and 3). > > > > I want to get ACK from Mike Kinney, to see if it is right way to manual= ly > add > > nasm and ApiHooks.c. Or if we need some extra documentation for that. > > Please do add him as reviewer in next version patch. >=20 > I have added Mike Kinney for the next patch set but I have already had > multiple discussions with him on this topic and the current implementatio= n > was agreed upon. [Jiewen] Sounds good. Then, please add his Acked-by. >=20 > Thanks, > Christopher Zurcher >=20 > > > > I treat the ApiHooks.c is a work-around and it should be removed in the > > future, once openssl resolve it. Maybe we need a Bugzilla to track this= . > > > > > > Thank you > > Yao Jiewen > > > > > > > -----Original Message----- > > > From: Christopher J Zurcher > > > Sent: Thursday, October 15, 2020 4:49 AM > > > To: devel@edk2.groups.io > > > Cc: Yao, Jiewen ; Wang, Jian J > > > ; Lu, XiaoyuX ; Ard > > > Biesheuvel > > > Subject: [PATCH v3 0/2] CryptoPkg/OpensslLib: Add native instruction > > > support for X64 > > > > > > V3 Changes: > > > Added definitions for ptrdiff_t and wchar_t to CrtLibSupport.h for > > > LLVM/Clang build support. > > > Added -UWIN32 to GCC Flags for LLVM/Clang build support. > > > Added missing AES GCM assembly file. > > > > > > V2 Changes: > > > Limit scope of assembly config to SHA and AES functions. > > > Removed IA32 native support (reduced config was causing build failu= re > and > > > can be added in a later patch). > > > Removed XMM instructions from assembly generation. > > > Added automatic copyright header porting for generated assembly fil= es. > > > > > > This patch adds support for building the native instruction algorithm= s for > > > the X64 architecture in OpensslLib. The process_files.pl script was > > modified > > > to parse the .asm file targets from the OpenSSL build config data str= uct, > > and > > > generate the necessary assembly files for the EDK2 build environment. > > > > > > For the X64 variant, OpenSSL includes calls to a Windows error handli= ng > > API, > > > and that function has been stubbed out in ApiHooks.c. > > > > > > For all variants, a constructor is added to call the required CPUID > > function > > > within OpenSSL to facilitate processor capability checks in the nativ= e > > > algorithms. > > > > > > Additional native architecture variants should be simple to add by > > following > > > the changes made for this architecture. > > > > > > The OpenSSL assembly files are traditionally generated at build time > using > > a > > > perl script. To avoid that burden on EDK2 users, these end-result > assembly > > > files are generated during the configuration steps performed by the > package > > > maintainer (through process_files.pl). The perl generator scripts ins= ide > > > OpenSSL do not parse file comments as they are only meant to create > > > intermediate build files, so process_files.pl contains additional hoo= ks to > > > preserve the copyright headers as well as clean up tabs and line endi= ngs > to > > > comply with EDK2 coding standards. The resulting file headers align w= ith > > > the generated .h files which are already included in the EDK2 reposit= ory. > > > > > > Cc: Jiewen Yao > > > Cc: Jian J Wang > > > Cc: Xiaoyu Lu > > > Cc: Ard Biesheuvel > > > > > > Christopher J Zurcher (2): > > > CryptoPkg/OpensslLib: Add native instruction support for X64 > > > CryptoPkg/OpensslLib: Commit the auto-generated assembly files for > X64 > > > > > > CryptoPkg/Library/OpensslLib/OpensslLib.inf = | > > 2 +- > > > CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf = | > > 2 +- > > > CryptoPkg/Library/OpensslLib/OpensslLibX64.inf = | > > 657 +++ > > > CryptoPkg/Library/Include/CrtLibSupport.h = | > > 2 + > > > CryptoPkg/Library/Include/openssl/opensslconf.h = | > > 3 - > > > CryptoPkg/Library/OpensslLib/ApiHooks.c = | > > 18 + > > > CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c = | > > 34 + > > > CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-mb-x86_64.nasm > | > > > 732 +++ > > > CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha1-x86_64.nasm > | > > > 1916 ++++++++ > > > CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha256- > x86_64.nasm | > > > 78 + > > > CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-x86_64.nasm = | > > > 5103 ++++++++++++++++++++ > > > CryptoPkg/Library/OpensslLib/X64/crypto/aes/vpaes-x86_64.nasm = | > > > 1173 +++++ > > > CryptoPkg/Library/OpensslLib/X64/crypto/modes/aesni-gcm- > x86_64.nasm | > > > 34 + > > > CryptoPkg/Library/OpensslLib/X64/crypto/modes/ghash-x86_64.nasm > | > > > 1569 ++++++ > > > CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha1-mb-x86_64.nasm > | > > > 3137 ++++++++++++ > > > CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha1-x86_64.nasm = | > > > 2884 +++++++++++ > > > CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha256-mb-x86_64.nasm > | > > > 3461 +++++++++++++ > > > CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha256-x86_64.nasm = | > > > 3313 +++++++++++++ > > > CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha512-x86_64.nasm = | > > > 1938 ++++++++ > > > CryptoPkg/Library/OpensslLib/X64/crypto/x86_64cpuid.nasm = | > > 491 > > > ++ > > > CryptoPkg/Library/OpensslLib/process_files.pl = | > > 223 +- > > > CryptoPkg/Library/OpensslLib/uefi-asm.conf = | > > 15 + > > > 22 files changed, 26735 insertions(+), 50 deletions(-) > > > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibX64.inf > > > create mode 100644 CryptoPkg/Library/OpensslLib/ApiHooks.c > > > create mode 100644 > CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c > > > create mode 100644 > CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni- > > > mb-x86_64.nasm > > > create mode 100644 > CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni- > > > sha1-x86_64.nasm > > > create mode 100644 > CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni- > > > sha256-x86_64.nasm > > > create mode 100644 > CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni- > > > x86_64.nasm > > > create mode 100644 > CryptoPkg/Library/OpensslLib/X64/crypto/aes/vpaes- > > > x86_64.nasm > > > create mode 100644 > > > CryptoPkg/Library/OpensslLib/X64/crypto/modes/aesni-gcm-x86_64.nasm > > > create mode 100644 > > > CryptoPkg/Library/OpensslLib/X64/crypto/modes/ghash-x86_64.nasm > > > create mode 100644 CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha1- > > > mb-x86_64.nasm > > > create mode 100644 CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha1- > > > x86_64.nasm > > > create mode 100644 > CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha256- > > > mb-x86_64.nasm > > > create mode 100644 > CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha256- > > > x86_64.nasm > > > create mode 100644 > CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha512- > > > x86_64.nasm > > > create mode 100644 > > > CryptoPkg/Library/OpensslLib/X64/crypto/x86_64cpuid.nasm > > > create mode 100644 CryptoPkg/Library/OpensslLib/uefi-asm.conf > > > > > > -- > > > 2.28.0.windows.1