From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web11.9492.1596500670882200844 for ; Mon, 03 Aug 2020 17:24:30 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: christopher.j.zurcher@intel.com) IronPort-SDR: Ve1zras9nXgZG9fz8d/FQaM+8njMGrKqiALptYcQ72j48RBSTP30n0RloV19KYxn9TALwlZCTw tgej4IRUiTIQ== X-IronPort-AV: E=McAfee;i="6000,8403,9702"; a="132285445" X-IronPort-AV: E=Sophos;i="5.75,432,1589266800"; d="scan'208";a="132285445" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2020 17:24:29 -0700 IronPort-SDR: VdRvKOLLuOPsA5MMtFih94WS0fHti4tKumYBqEFykMFz9e0GteP0oh0zJYzSfS7NOnKa1XMvp9 uWaMELeQClJA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,432,1589266800"; d="scan'208";a="330376411" Received: from cjzurch-desk.amr.corp.intel.com ([10.9.70.181]) by FMSMGA003.fm.intel.com with ESMTP; 03 Aug 2020 17:24:29 -0700 From: "Zurcher, Christopher J" To: devel@edk2.groups.io Cc: Jiewen Yao , Jian J Wang , Xiaoyu Lu , Ard Biesheuvel Subject: [PATCH v2 0/2] CryptoPkg/OpensslLib: Add native instruction support for X64 Date: Mon, 3 Aug 2020 17:24:27 -0700 Message-Id: <20200804002429.3897-1-christopher.j.zurcher@intel.com> X-Mailer: git-send-email 2.28.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 struct, 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 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 inside 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 endings to comply with EDK2 coding standards. The resulting file headers align with the generated .h files which are already included in the EDK2 repository. 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 | 656 +++ 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/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 + 20 files changed, 26698 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/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