From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web11.1776.1603228202909029991 for ; Tue, 20 Oct 2020 14:10:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=DPnynEpW; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: christopher.j.zurcher@intel.com) IronPort-SDR: VbOG5HnpvTfzay/nbj6ahDum9ng7ew1CyRQhDo3YftPQ0bTjwLUd4M/ZUFzerbj4iMTFH+Bf6h jlmaQtLFnrSg== X-IronPort-AV: E=McAfee;i="6000,8403,9780"; a="163788911" X-IronPort-AV: E=Sophos;i="5.77,398,1596524400"; d="scan'208";a="163788911" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2020 14:10:01 -0700 IronPort-SDR: z40p4FjhMmJKDRBKvPIBkL7ZvTfAlK0St+7YOkPDAps1ufOC6GnS9yb1EQmFpl2MXWO+CJuRAa 1DpXvXVTzncA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,398,1596524400"; d="scan'208";a="466064993" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by orsmga004.jf.intel.com with ESMTP; 20 Oct 2020 14:10:01 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 20 Oct 2020 14:10:00 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 20 Oct 2020 14:10:00 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) 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.1713.5 via Frontend Transport; Tue, 20 Oct 2020 14:10:00 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.173) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Tue, 20 Oct 2020 14:10:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lLLi1HZ5McHlk1ZGRe1kqHfUlC0TSE2AjdvyxiqfNZkm5GAA3LR5Nk7rDVDTP2kZda/LnsBte3lTuyTxyotwVeFkNzhYtx4D20HC2qdvx9XgB8Cog6XXKMsCB8D51bifwkpUEGqdPVrP8iMaKLXBi+nCgq1+7THU2weqWZdlgIEC7+WbnSMq53DIsqUydRtPcvnx6XUJnDOJn6UqmZ0ApksJj/hi7dGOXRJ3ZajkQdkllxE7WVy/Xma8DahWqXZJJMMpsgAFkVJEJbS+oqTcCz2FBPoVq6Hdjl85e5t1+lJjY8RMTMyrdLs72Pb/GZKqJUm3O9p0VCMI9XRfnQsGUw== 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=3Kk6kv1lX8I/mEmAlxzFLL9qhyc1TQG/nYByyJZw7ck=; b=iISP4q8guz+PQt3R7UhHoklwqyvflKNp6aB+Mkz9MfMBg5GiSA5Z8RcOml3XCK1RJbEvObVWOIcnw+yTplj/uO4X2dUA2DKckw56hLAxVF6UdUAsCTiVilrbaVXpsWEBJORnl7zKjwJCoqGcTfO2/jMGImIIi4PaDbz5Ylgd7gH21CMKTOR762Z37dL7QST6BtAYg9q8vzBh9ZjgFNbKUqzbOvfjKKjAIzPU4TVjyEH8vRTITyDq1ymhWR1lW0w5FS9mNqsTkL+KgVsaj2HS75+J+xW+HGMzvtz5UUmsHJc3j+HnTn5fHw1elJv+MRQUtAq/uqSaXoZrSPxUNelVyQ== 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=3Kk6kv1lX8I/mEmAlxzFLL9qhyc1TQG/nYByyJZw7ck=; b=DPnynEpWTVP4XPjY77lEMY54aiYnhmkhsdD93HX7K8Allu71ZQ4y0PI/So4ngoraYqx9eyYv9o3NCZUrrcb6PXyVt7vKXnV74Uk+xUVWJ/3eoUEy7CzA5nrPfV0dRREgt2hwchYuTM0R+QOtiCRzCUinwHXrlDnED3AQzyykzYg= Received: from MWHPR1101MB2125.namprd11.prod.outlook.com (2603:10b6:301:4d::10) by MWHPR11MB1405.namprd11.prod.outlook.com (2603:10b6:300:21::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21; Tue, 20 Oct 2020 21:09:59 +0000 Received: from MWHPR1101MB2125.namprd11.prod.outlook.com ([fe80::f88d:c4b1:1f6d:7a73]) by MWHPR1101MB2125.namprd11.prod.outlook.com ([fe80::f88d:c4b1:1f6d:7a73%4]) with mapi id 15.20.3477.028; Tue, 20 Oct 2020 21:09:59 +0000 From: "Zurcher, Christopher J" 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 Thread-Topic: [PATCH v3 0/2] CryptoPkg/OpensslLib: Add native instruction support for X64 Thread-Index: AQHWomtsc/hyP1oknUui8L6WK87Cr6mckeOwgARxkjA= Date: Tue, 20 Oct 2020 21:09:59 +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-reaction: no-action dlp-product: dlpe-windows 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: [50.53.185.44] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1ce665cc-5d72-48ba-7437-08d8753c80f9 x-ms-traffictypediagnostic: MWHPR11MB1405: 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: 0KlimWyYQz1duSMIQe84Pu+StfArFOCPl1RJch7scJcMCZDQN8kGBberbpQ7SyGs6sxJ1omhrHswuUrz2QN3dCZm0YnfEM8exp5vYmoulEvFkLDX7lLGvbgsH8HD07UdH30o2UvKc4rzAQqWqqM5R+a4KhKXRmSeUitg8we1QLpZLCRnxoZ5VdaQr1CF4b6mbjL4MfPhfJxbM9RUV5j+oguPdQPAWzISq4f7edrrXutCIfTiONe+I4vbhuWQcuk/pV9bbtpLCyV4LjYO4bgArf+DOLvpg6/5A+Q18Uj2inVXvMiUUAdwk7C3AW4d4HopFXnEHYmDjGJpwWwjH64I4A/ulr8QbrGd6rbtoPpmvlPcDPhdoKYkIvlpqOx+0M4PwV3bMca6QYkvnt9KT3uZMA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1101MB2125.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(396003)(136003)(346002)(366004)(39860400002)(110136005)(26005)(19627235002)(54906003)(316002)(64756008)(76116006)(5660300002)(66946007)(7696005)(8676002)(66556008)(66476007)(6506007)(66446008)(966005)(52536014)(186003)(83380400001)(53546011)(55016002)(33656002)(8936002)(478600001)(4326008)(9686003)(86362001)(71200400001)(2906002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: 4QpRJO7dken9yjz/ZCUAMrY6KfMmVgWUIF7XBj5q4DiiDkiRBR9TRVw1dVYPeQIiG4U10UfPlA1CrYfRXjbBhxtIeyDMUWHdlkxw3oW0JYiza31lrBuFZ2dLtZfVNy13TLnGauY9Joy85Leu+IPFtSx51iodE4SAXfd5yxtkxKwrq+5S5gGlq2NFFamOp7wlytX/gAWSnSjfSGWsO6o4gHeZCu35WJKe+/aVFe4A6PwHcQe1gRWp/e0jVIkihCdWnFP2DaIuqnIfPvws2pA+Sb36SYxLhEJEiwIsnPe0Fv3JKRH/u4uSqVzrk8p853JE+kjrGOLlYE2sLnyO4svO5W+mFPoURO94oXgTbmohvBDQqS4sUwKRv5YQekbPDLGIY7mPLTRAVfc7sFr20h5/j4Q2744bJ75N4y4MdYbqa90JjuT3970PmZ/VT5y7RmFuRyF7GcpdVpSF7XfiQnFCTnpuf8sPp7gxTTaC8igUjnYEBHVLmsLrmSH+DnV40j6FqUH1eIek7h2Q0mosQq0tszTkYvJ1+D40adP0glNyhlRpCrmAhsxjn92veypKb9W1W4O7mQgho+Fed0ykBwVz7ZivCwpj+mCgalKX3dK8pM9ogkAbo4erENzoBpvVFn5p/LUX3r4M5P7smVLIiM1AOQ== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR1101MB2125.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ce665cc-5d72-48ba-7437-08d8753c80f9 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Oct 2020 21:09:59.3355 (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: QPnG45/dSpq9JsE+iciJ5wiGSiy9TzdFv1QEdr6/eHQ8ymrnGOV/5rAnBmIMpukMzl0mAbV02HWsvEYfih4jf++gGH47mA9N2pHy4zsjUIM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1405 Return-Path: christopher.j.zurcher@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Comments inline. > -----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 instruction > support for X64 >=20 > Thanks Zurcher. >=20 > Comment: > 1) I do not see the copy right header and license header for uefi-asm.con= f. > Please add it. >=20 > 2) Is "ApiHooks.c" only for Visual Studio? Do we need it for GCC and LLVM= ? > If it is only for visual studio, I suggest we rename to MsftApiHooks.c, a= nd > add "| MSFT" in INF. ApiHooks.c is for any compiler building the assembly files, not only Visual= Studio. >=20 > 3) Since nasm is only for X64=B8 please use [Source.X64] for them. Since the .c file set can change depending on which assembly target is sele= cted (X64 vs. IA32 etc.) and since this .inf file is only for X64 targets, = 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_f= iles.pl. >=20 > Please refer to > https://github.com/tianocore/edk2/blob/master/MdePkg/Library/BaseLib/Base= Lib. > inf, on 2) and 3). >=20 > I want to get ACK from Mike Kinney, to see if it is right way to manually= add > nasm and ApiHooks.c. Or if we need some extra documentation for that. > Please do add him as reviewer in next version patch. I have added Mike Kinney for the next patch set but I have already had mult= iple discussions with him on this topic and the current implementation was = agreed upon. 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. >=20 >=20 > Thank you > Yao Jiewen >=20 >=20 > > -----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 failure= and > > can be added in a later patch). > > Removed XMM instructions from assembly generation. > > Added automatic copyright header porting for generated assembly files= . > > > > This patch adds support for building the native instruction algorithms = 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 struc= t, > and > > generate the necessary assembly files for the EDK2 build environment. > > > > For the X64 variant, OpenSSL includes calls to a Windows error handling > 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 native > > 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 us= ing > a > > perl script. To avoid that burden on EDK2 users, these end-result assem= bly > > files are generated during the configuration steps performed by the pac= kage > > maintainer (through process_files.pl). The perl generator scripts insid= e > > OpenSSL do not parse file comments as they are only meant to create > > intermediate build files, so process_files.pl contains additional hooks= to > > preserve the copyright headers as well as clean up tabs and line ending= s to > > comply with EDK2 coding standards. The resulting file headers align wit= h > > the generated .h files which are already included in the EDK2 repositor= y. > > > > 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 X6= 4 > > > > 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