[edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native instruction support for X64

Christopher Zurcher posted 2 patches 2 years, 10 months ago
Only 0 patches received!
There is a newer version of this series
BaseTools/Scripts/GccBase.lds                                        |    1 -
CryptoPkg/CryptoPkg.ci.yaml                                          |   21 +-
CryptoPkg/Library/Include/CrtLibSupport.h                            |    2 +
CryptoPkg/Library/Include/openssl/opensslconf.h                      |    3 -
CryptoPkg/Library/OpensslLib/OpensslLib.inf                          |    2 +-
CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c                 |   44 +
CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf                    |    2 +-
CryptoPkg/Library/OpensslLib/OpensslLibX64.inf                       |  653 +++
CryptoPkg/Library/OpensslLib/OpensslLibX64Gcc.inf                    |  653 +++
CryptoPkg/Library/OpensslLib/UefiAsm.conf                            |   30 +
CryptoPkg/Library/OpensslLib/X64/ApiHooks.c                          |   22 +
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/X64Gcc/crypto/aes/aesni-mb-x86_64.S     |  552 +++
CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha1-x86_64.S   | 1719 +++++++
CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha256-x86_64.S |   69 +
CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-x86_64.S        | 4484 +++++++++++++++++
CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/vpaes-x86_64.S        |  863 ++++
CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/aesni-gcm-x86_64.S  |   29 +
CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/ghash-x86_64.S      | 1386 ++++++
CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-mb-x86_64.S      | 2962 ++++++++++++
CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-x86_64.S         | 2631 ++++++++++
CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-mb-x86_64.S    | 3286 +++++++++++++
CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-x86_64.S       | 3097 ++++++++++++
CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha512-x86_64.S       | 1811 +++++++
CryptoPkg/Library/OpensslLib/X64Gcc/crypto/x86_64cpuid.S             |  491 ++
CryptoPkg/Library/OpensslLib/process_files.pl                        |  241 +-
38 files changed, 50828 insertions(+), 55 deletions(-)
create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c
create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibX64.inf
create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibX64Gcc.inf
create mode 100644 CryptoPkg/Library/OpensslLib/UefiAsm.conf
create mode 100644 CryptoPkg/Library/OpensslLib/X64/ApiHooks.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/X64Gcc/crypto/aes/aesni-mb-x86_64.S
create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha1-x86_64.S
create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha256-x86_64.S
create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-x86_64.S
create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/vpaes-x86_64.S
create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/aesni-gcm-x86_64.S
create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/ghash-x86_64.S
create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-mb-x86_64.S
create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-x86_64.S
create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-mb-x86_64.S
create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-x86_64.S
create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha512-x86_64.S
create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/x86_64cpuid.S
[edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native instruction support for X64
Posted by Christopher Zurcher 2 years, 10 months ago
From: Christopher Zurcher <christopher.zurcher@microsoft.com>

V6 Changes:
  Add GCC-compatible version of these modifications. Supporting GCC build of
    native OpenSSL .S files requires removal of *(COMMON) from the /DISCARD/
    section of the GCC linker script.
  The VS/CLANG portion of the patch is unchanged from the previously-approved
    patchset.

V5 Changes:
  Move ApiHooks.c into X64 folder
  Update process_files.pl to clean architecture-specific subfolders without
    removing them
  Rebased INF file to merge latest changes regarding RngLib vs. TimerLib

V4 Changes:
  Add copyright header to uefi-asm.conf
  Move [Sources.X64] block to cover entire X64-specific config

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 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 <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Cc: Mike Kinney <michael.d.kinney@intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>

Christopher Zurcher (2):
  CryptoPkg/OpensslLib: Add native instruction support for X64
  CryptoPkg/OpensslLib: Commit the auto-generated assembly files for X64

 BaseTools/Scripts/GccBase.lds                                        |    1 -
 CryptoPkg/CryptoPkg.ci.yaml                                          |   21 +-
 CryptoPkg/Library/Include/CrtLibSupport.h                            |    2 +
 CryptoPkg/Library/Include/openssl/opensslconf.h                      |    3 -
 CryptoPkg/Library/OpensslLib/OpensslLib.inf                          |    2 +-
 CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c                 |   44 +
 CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf                    |    2 +-
 CryptoPkg/Library/OpensslLib/OpensslLibX64.inf                       |  653 +++
 CryptoPkg/Library/OpensslLib/OpensslLibX64Gcc.inf                    |  653 +++
 CryptoPkg/Library/OpensslLib/UefiAsm.conf                            |   30 +
 CryptoPkg/Library/OpensslLib/X64/ApiHooks.c                          |   22 +
 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/X64Gcc/crypto/aes/aesni-mb-x86_64.S     |  552 +++
 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha1-x86_64.S   | 1719 +++++++
 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha256-x86_64.S |   69 +
 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-x86_64.S        | 4484 +++++++++++++++++
 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/vpaes-x86_64.S        |  863 ++++
 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/aesni-gcm-x86_64.S  |   29 +
 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/ghash-x86_64.S      | 1386 ++++++
 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-mb-x86_64.S      | 2962 ++++++++++++
 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-x86_64.S         | 2631 ++++++++++
 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-mb-x86_64.S    | 3286 +++++++++++++
 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-x86_64.S       | 3097 ++++++++++++
 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha512-x86_64.S       | 1811 +++++++
 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/x86_64cpuid.S             |  491 ++
 CryptoPkg/Library/OpensslLib/process_files.pl                        |  241 +-
 38 files changed, 50828 insertions(+), 55 deletions(-)
 create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c
 create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibX64.inf
 create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibX64Gcc.inf
 create mode 100644 CryptoPkg/Library/OpensslLib/UefiAsm.conf
 create mode 100644 CryptoPkg/Library/OpensslLib/X64/ApiHooks.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/X64Gcc/crypto/aes/aesni-mb-x86_64.S
 create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha1-x86_64.S
 create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha256-x86_64.S
 create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-x86_64.S
 create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/vpaes-x86_64.S
 create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/aesni-gcm-x86_64.S
 create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/ghash-x86_64.S
 create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-mb-x86_64.S
 create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-x86_64.S
 create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-mb-x86_64.S
 create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-x86_64.S
 create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha512-x86_64.S
 create mode 100644 CryptoPkg/Library/OpensslLib/X64Gcc/crypto/x86_64cpuid.S

-- 
2.32.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76789): https://edk2.groups.io/g/devel/message/76789
Mute This Topic: https://groups.io/mt/83671979/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


回复: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native instruction support for X64
Posted by gaoliming 2 years, 10 months ago
Christopher:
  Nasm should support GCC tool chain. Do you meet with the problem on nasm
version assembly code?
  So, you have to add GAS assembly code. This topic may be discussed last
year. Can you give some detail for it?

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Christopher
> Zurcher
> 发送时间: 2021年6月19日 10:09
> 收件人: devel@edk2.groups.io
> 抄送: Jiewen Yao <jiewen.yao@intel.com>; Jian J Wang
> <jian.j.wang@intel.com>; Xiaoyu Lu <xiaoyux.lu@intel.com>; Mike Kinney
> <michael.d.kinney@intel.com>; Ard Biesheuvel <ard.biesheuvel@arm.com>
> 主题: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native
> instruction support for X64
> 
> From: Christopher Zurcher <christopher.zurcher@microsoft.com>
> 
> V6 Changes:
>   Add GCC-compatible version of these modifications. Supporting GCC build
of
>     native OpenSSL .S files requires removal of *(COMMON) from the
> /DISCARD/
>     section of the GCC linker script.
>   The VS/CLANG portion of the patch is unchanged from the
> previously-approved
>     patchset.
> 
> V5 Changes:
>   Move ApiHooks.c into X64 folder
>   Update process_files.pl to clean architecture-specific subfolders
without
>     removing them
>   Rebased INF file to merge latest changes regarding RngLib vs. TimerLib
> 
> V4 Changes:
>   Add copyright header to uefi-asm.conf
>   Move [Sources.X64] block to cover entire X64-specific config
> 
> 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 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 <jiewen.yao@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
> Cc: Mike Kinney <michael.d.kinney@intel.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
> 
> Christopher Zurcher (2):
>   CryptoPkg/OpensslLib: Add native instruction support for X64
>   CryptoPkg/OpensslLib: Commit the auto-generated assembly files for X64
> 
>  BaseTools/Scripts/GccBase.lds
> |    1 -
>  CryptoPkg/CryptoPkg.ci.yaml
> |   21 +-
>  CryptoPkg/Library/Include/CrtLibSupport.h
> |    2 +
>  CryptoPkg/Library/Include/openssl/opensslconf.h
> |    3 -
>  CryptoPkg/Library/OpensslLib/OpensslLib.inf
> |    2 +-
>  CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c
> |   44 +
>  CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> |    2 +-
>  CryptoPkg/Library/OpensslLib/OpensslLibX64.inf
> |  653 +++
>  CryptoPkg/Library/OpensslLib/OpensslLibX64Gcc.inf
> |  653 +++
>  CryptoPkg/Library/OpensslLib/UefiAsm.conf
> |   30 +
>  CryptoPkg/Library/OpensslLib/X64/ApiHooks.c
> |   22 +
>  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/X64Gcc/crypto/aes/aesni-mb-x86_64.S
> |  552 +++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha1-x86_64.S
> | 1719 +++++++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha256-x86_64.S |
> 69 +
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-x86_64.S
> | 4484 +++++++++++++++++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/vpaes-x86_64.S
> |  863 ++++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/aesni-gcm-x86_64.S
> |   29 +
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/ghash-x86_64.S
> | 1386 ++++++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-mb-x86_64.S
> | 2962 ++++++++++++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-x86_64.S
> | 2631 ++++++++++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-mb-x86_64.S
> | 3286 +++++++++++++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-x86_64.S
> | 3097 ++++++++++++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha512-x86_64.S
> | 1811 +++++++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/x86_64cpuid.S
> |  491 ++
>  CryptoPkg/Library/OpensslLib/process_files.pl
> |  241 +-
>  38 files changed, 50828 insertions(+), 55 deletions(-)
>  create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c
>  create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibX64.inf
>  create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibX64Gcc.inf
>  create mode 100644 CryptoPkg/Library/OpensslLib/UefiAsm.conf
>  create mode 100644 CryptoPkg/Library/OpensslLib/X64/ApiHooks.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/X64Gcc/crypto/aes/aesni-mb-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha1-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha256-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/vpaes-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/aesni-gcm-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/ghash-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-mb-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-mb-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha512-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/x86_64cpuid.S
> 
> --
> 2.32.0.windows.1
> 
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76796): https://edk2.groups.io/g/devel/message/76796
Mute This Topic: https://groups.io/mt/83679604/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native instruction support for X64
Posted by Christopher Zurcher 2 years, 10 months ago
Yes this was discussed last year, sorry for the delay in follow-up, I was changing jobs.
The problem is that the assembly code provided by OpenSSL uses "wrt ..imagebase" which is only supported by win64, not elf64. It was requested at the time that I include the OpenSSL-provided .S files as a GCC tool chain alternative.

Thanks,
Christopher Zurcher

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming
Sent: Sunday, June 20, 2021 18:34
To: devel@edk2.groups.io; christopher.zurcher@outlook.com
Cc: 'Jiewen Yao' <jiewen.yao@intel.com>; 'Jian J Wang' <jian.j.wang@intel.com>; 'Xiaoyu Lu' <xiaoyux.lu@intel.com>; 'Mike Kinney' <michael.d.kinney@intel.com>; 'Ard Biesheuvel' <ard.biesheuvel@arm.com>
Subject: 回复: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native instruction support for X64

Christopher:
  Nasm should support GCC tool chain. Do you meet with the problem on nasm version assembly code?
  So, you have to add GAS assembly code. This topic may be discussed last year. Can you give some detail for it?

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Christopher 
> Zurcher
> 发送时间: 2021年6月19日 10:09
> 收件人: devel@edk2.groups.io
> 抄送: Jiewen Yao <jiewen.yao@intel.com>; Jian J Wang 
> <jian.j.wang@intel.com>; Xiaoyu Lu <xiaoyux.lu@intel.com>; Mike Kinney 
> <michael.d.kinney@intel.com>; Ard Biesheuvel <ard.biesheuvel@arm.com>
> 主题: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native 
> instruction support for X64
> 
> From: Christopher Zurcher <christopher.zurcher@microsoft.com>
> 
> V6 Changes:
>   Add GCC-compatible version of these modifications. Supporting GCC 
> build
of
>     native OpenSSL .S files requires removal of *(COMMON) from the 
> /DISCARD/
>     section of the GCC linker script.
>   The VS/CLANG portion of the patch is unchanged from the 
> previously-approved
>     patchset.
> 
> V5 Changes:
>   Move ApiHooks.c into X64 folder
>   Update process_files.pl to clean architecture-specific subfolders
without
>     removing them
>   Rebased INF file to merge latest changes regarding RngLib vs. 
> TimerLib
> 
> V4 Changes:
>   Add copyright header to uefi-asm.conf
>   Move [Sources.X64] block to cover entire X64-specific config
> 
> 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 
> 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 <jiewen.yao@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
> Cc: Mike Kinney <michael.d.kinney@intel.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
> 
> Christopher Zurcher (2):
>   CryptoPkg/OpensslLib: Add native instruction support for X64
>   CryptoPkg/OpensslLib: Commit the auto-generated assembly files for 
> X64
> 
>  BaseTools/Scripts/GccBase.lds
> |    1 -
>  CryptoPkg/CryptoPkg.ci.yaml
> |   21 +-
>  CryptoPkg/Library/Include/CrtLibSupport.h
> |    2 +
>  CryptoPkg/Library/Include/openssl/opensslconf.h
> |    3 -
>  CryptoPkg/Library/OpensslLib/OpensslLib.inf
> |    2 +-
>  CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c
> |   44 +
>  CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> |    2 +-
>  CryptoPkg/Library/OpensslLib/OpensslLibX64.inf
> |  653 +++
>  CryptoPkg/Library/OpensslLib/OpensslLibX64Gcc.inf
> |  653 +++
>  CryptoPkg/Library/OpensslLib/UefiAsm.conf
> |   30 +
>  CryptoPkg/Library/OpensslLib/X64/ApiHooks.c
> |   22 +
>  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/X64Gcc/crypto/aes/aesni-mb-x86_64.S
> |  552 +++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha1-x86_64.S
> | 1719 +++++++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha256-x86_64.S 
> |
> 69 +
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-x86_64.S
> | 4484 +++++++++++++++++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/vpaes-x86_64.S
> |  863 ++++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/aesni-gcm-x86_64.S
> |   29 +
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/ghash-x86_64.S
> | 1386 ++++++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-mb-x86_64.S
> | 2962 ++++++++++++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-x86_64.S
> | 2631 ++++++++++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-mb-x86_64.S
> | 3286 +++++++++++++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-x86_64.S
> | 3097 ++++++++++++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha512-x86_64.S
> | 1811 +++++++
>  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/x86_64cpuid.S
> |  491 ++
>  CryptoPkg/Library/OpensslLib/process_files.pl
> |  241 +-
>  38 files changed, 50828 insertions(+), 55 deletions(-)  create mode 
> 100644 CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c
>  create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibX64.inf
>  create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibX64Gcc.inf
>  create mode 100644 CryptoPkg/Library/OpensslLib/UefiAsm.conf
>  create mode 100644 CryptoPkg/Library/OpensslLib/X64/ApiHooks.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/X64Gcc/crypto/aes/aesni-mb-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha1-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha256-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/vpaes-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/aesni-gcm-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/ghash-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-mb-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-mb-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha512-x86_64.S
>  create mode 100644
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/x86_64cpuid.S
> 
> --
> 2.32.0.windows.1
> 
> 
> 
> 
> 










-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76814): https://edk2.groups.io/g/devel/message/76814
Mute This Topic: https://groups.io/mt/83700667/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native instruction support for X64
Posted by Yao, Jiewen 2 years, 10 months ago
Hi Christopher
Thank you very much to resume this work. :-)

I have no problem to approve CryptoPkg. (I believe I already did that in last year).

But since you updated base tool. We need base tool package maintainer to approve that change.

A good practice is to split the patch from package level. Then we can let each package maintainer approve its own package.

I will be waiting for the response from base tool owner to review " BaseTools/Scripts/GccBase.lds " and give R-B.


Thank you
Yao Jiewen

> -----Original Message-----
> From: Christopher Zurcher <christopher.zurcher@outlook.com>
> Sent: Tuesday, June 22, 2021 6:05 AM
> To: devel@edk2.groups.io; gaoliming@byosoft.com.cn
> Cc: Yao, Jiewen <jiewen.yao@intel.com>; Wang, Jian J <jian.j.wang@intel.com>;
> Lu, XiaoyuX <xiaoyux.lu@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; 'Ard Biesheuvel' <ard.biesheuvel@arm.com>
> Subject: RE: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native
> instruction support for X64
> 
> Yes this was discussed last year, sorry for the delay in follow-up, I was changing
> jobs.
> The problem is that the assembly code provided by OpenSSL uses
> "wrt ..imagebase" which is only supported by win64, not elf64. It was requested
> at the time that I include the OpenSSL-provided .S files as a GCC tool chain
> alternative.
> 
> Thanks,
> Christopher Zurcher
> 
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming
> Sent: Sunday, June 20, 2021 18:34
> To: devel@edk2.groups.io; christopher.zurcher@outlook.com
> Cc: 'Jiewen Yao' <jiewen.yao@intel.com>; 'Jian J Wang'
> <jian.j.wang@intel.com>; 'Xiaoyu Lu' <xiaoyux.lu@intel.com>; 'Mike Kinney'
> <michael.d.kinney@intel.com>; 'Ard Biesheuvel' <ard.biesheuvel@arm.com>
> Subject: 回复: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native
> instruction support for X64
> 
> Christopher:
>   Nasm should support GCC tool chain. Do you meet with the problem on nasm
> version assembly code?
>   So, you have to add GAS assembly code. This topic may be discussed last year.
> Can you give some detail for it?
> 
> Thanks
> Liming
> > -----邮件原件-----
> > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Christopher
> > Zurcher
> > 发送时间: 2021年6月19日 10:09
> > 收件人: devel@edk2.groups.io
> > 抄送: Jiewen Yao <jiewen.yao@intel.com>; Jian J Wang
> > <jian.j.wang@intel.com>; Xiaoyu Lu <xiaoyux.lu@intel.com>; Mike Kinney
> > <michael.d.kinney@intel.com>; Ard Biesheuvel <ard.biesheuvel@arm.com>
> > 主题: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native
> > instruction support for X64
> >
> > From: Christopher Zurcher <christopher.zurcher@microsoft.com>
> >
> > V6 Changes:
> >   Add GCC-compatible version of these modifications. Supporting GCC
> > build
> of
> >     native OpenSSL .S files requires removal of *(COMMON) from the
> > /DISCARD/
> >     section of the GCC linker script.
> >   The VS/CLANG portion of the patch is unchanged from the
> > previously-approved
> >     patchset.
> >
> > V5 Changes:
> >   Move ApiHooks.c into X64 folder
> >   Update process_files.pl to clean architecture-specific subfolders
> without
> >     removing them
> >   Rebased INF file to merge latest changes regarding RngLib vs.
> > TimerLib
> >
> > V4 Changes:
> >   Add copyright header to uefi-asm.conf
> >   Move [Sources.X64] block to cover entire X64-specific config
> >
> > 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
> > 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 <jiewen.yao@intel.com>
> > Cc: Jian J Wang <jian.j.wang@intel.com>
> > Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
> > Cc: Mike Kinney <michael.d.kinney@intel.com>
> > Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
> >
> > Christopher Zurcher (2):
> >   CryptoPkg/OpensslLib: Add native instruction support for X64
> >   CryptoPkg/OpensslLib: Commit the auto-generated assembly files for
> > X64
> >
> >  BaseTools/Scripts/GccBase.lds
> > |    1 -
> >  CryptoPkg/CryptoPkg.ci.yaml
> > |   21 +-
> >  CryptoPkg/Library/Include/CrtLibSupport.h
> > |    2 +
> >  CryptoPkg/Library/Include/openssl/opensslconf.h
> > |    3 -
> >  CryptoPkg/Library/OpensslLib/OpensslLib.inf
> > |    2 +-
> >  CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c
> > |   44 +
> >  CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> > |    2 +-
> >  CryptoPkg/Library/OpensslLib/OpensslLibX64.inf
> > |  653 +++
> >  CryptoPkg/Library/OpensslLib/OpensslLibX64Gcc.inf
> > |  653 +++
> >  CryptoPkg/Library/OpensslLib/UefiAsm.conf
> > |   30 +
> >  CryptoPkg/Library/OpensslLib/X64/ApiHooks.c
> > |   22 +
> >  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/X64Gcc/crypto/aes/aesni-mb-x86_64.S
> > |  552 +++
> >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha1-x86_64.S
> > | 1719 +++++++
> >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha256-x86_64.S
> > |
> > 69 +
> >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-x86_64.S
> > | 4484 +++++++++++++++++
> >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/vpaes-x86_64.S
> > |  863 ++++
> >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/aesni-gcm-x86_64.S
> > |   29 +
> >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/ghash-x86_64.S
> > | 1386 ++++++
> >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-mb-x86_64.S
> > | 2962 ++++++++++++
> >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-x86_64.S
> > | 2631 ++++++++++
> >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-mb-x86_64.S
> > | 3286 +++++++++++++
> >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-x86_64.S
> > | 3097 ++++++++++++
> >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha512-x86_64.S
> > | 1811 +++++++
> >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/x86_64cpuid.S
> > |  491 ++
> >  CryptoPkg/Library/OpensslLib/process_files.pl
> > |  241 +-
> >  38 files changed, 50828 insertions(+), 55 deletions(-)  create mode
> > 100644 CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c
> >  create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibX64.inf
> >  create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibX64Gcc.inf
> >  create mode 100644 CryptoPkg/Library/OpensslLib/UefiAsm.conf
> >  create mode 100644 CryptoPkg/Library/OpensslLib/X64/ApiHooks.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/X64Gcc/crypto/aes/aesni-mb-x86_64.S
> >  create mode 100644
> > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha1-x86_64.S
> >  create mode 100644
> > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha256-x86_64.S
> >  create mode 100644
> > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-x86_64.S
> >  create mode 100644
> > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/vpaes-x86_64.S
> >  create mode 100644
> > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/aesni-gcm-x86_64.S
> >  create mode 100644
> > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/ghash-x86_64.S
> >  create mode 100644
> > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-mb-x86_64.S
> >  create mode 100644
> > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-x86_64.S
> >  create mode 100644
> > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-mb-x86_64.S
> >  create mode 100644
> > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-x86_64.S
> >  create mode 100644
> > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha512-x86_64.S
> >  create mode 100644
> > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/x86_64cpuid.S
> >
> > --
> > 2.32.0.windows.1
> >
> >
> >
> >
> >
> 
> 
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76982): https://edk2.groups.io/g/devel/message/76982
Mute This Topic: https://groups.io/mt/83700667/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


回复: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native instruction support for X64
Posted by gaoliming 2 years, 10 months ago
Christopher:
  Discard COMMON section is added by edk2 commit 214a3b79417f64bf2faae74af42c1b9d23f50dc8. Please help evaluate its impact. 

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Yao, Jiewen
> 发送时间: 2021年6月23日 20:42
> 收件人: Christopher Zurcher <christopher.zurcher@outlook.com>;
> devel@edk2.groups.io; gaoliming@byosoft.com.cn
> 抄送: Wang, Jian J <jian.j.wang@intel.com>; Lu, XiaoyuX
> <xiaoyux.lu@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>;
> 'Ard Biesheuvel' <ard.biesheuvel@arm.com>; Yao, Jiewen
> <jiewen.yao@intel.com>
> 主题: Re: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native
> instruction support for X64
> 
> Hi Christopher
> Thank you very much to resume this work. :-)
> 
> I have no problem to approve CryptoPkg. (I believe I already did that in last
> year).
> 
> But since you updated base tool. We need base tool package maintainer to
> approve that change.
> 
> A good practice is to split the patch from package level. Then we can let each
> package maintainer approve its own package.
> 
> I will be waiting for the response from base tool owner to review "
> BaseTools/Scripts/GccBase.lds " and give R-B.
> 
> 
> Thank you
> Yao Jiewen
> 
> > -----Original Message-----
> > From: Christopher Zurcher <christopher.zurcher@outlook.com>
> > Sent: Tuesday, June 22, 2021 6:05 AM
> > To: devel@edk2.groups.io; gaoliming@byosoft.com.cn
> > Cc: Yao, Jiewen <jiewen.yao@intel.com>; Wang, Jian J
> <jian.j.wang@intel.com>;
> > Lu, XiaoyuX <xiaoyux.lu@intel.com>; Kinney, Michael D
> > <michael.d.kinney@intel.com>; 'Ard Biesheuvel'
> <ard.biesheuvel@arm.com>
> > Subject: RE: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native
> > instruction support for X64
> >
> > Yes this was discussed last year, sorry for the delay in follow-up, I was
> changing
> > jobs.
> > The problem is that the assembly code provided by OpenSSL uses
> > "wrt ..imagebase" which is only supported by win64, not elf64. It was
> requested
> > at the time that I include the OpenSSL-provided .S files as a GCC tool chain
> > alternative.
> >
> > Thanks,
> > Christopher Zurcher
> >
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> gaoliming
> > Sent: Sunday, June 20, 2021 18:34
> > To: devel@edk2.groups.io; christopher.zurcher@outlook.com
> > Cc: 'Jiewen Yao' <jiewen.yao@intel.com>; 'Jian J Wang'
> > <jian.j.wang@intel.com>; 'Xiaoyu Lu' <xiaoyux.lu@intel.com>; 'Mike Kinney'
> > <michael.d.kinney@intel.com>; 'Ard Biesheuvel'
> <ard.biesheuvel@arm.com>
> > Subject: 回复: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add
> native
> > instruction support for X64
> >
> > Christopher:
> >   Nasm should support GCC tool chain. Do you meet with the problem on
> nasm
> > version assembly code?
> >   So, you have to add GAS assembly code. This topic may be discussed last
> year.
> > Can you give some detail for it?
> >
> > Thanks
> > Liming
> > > -----邮件原件-----
> > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表
> Christopher
> > > Zurcher
> > > 发送时间: 2021年6月19日 10:09
> > > 收件人: devel@edk2.groups.io
> > > 抄送: Jiewen Yao <jiewen.yao@intel.com>; Jian J Wang
> > > <jian.j.wang@intel.com>; Xiaoyu Lu <xiaoyux.lu@intel.com>; Mike Kinney
> > > <michael.d.kinney@intel.com>; Ard Biesheuvel
> <ard.biesheuvel@arm.com>
> > > 主题: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native
> > > instruction support for X64
> > >
> > > From: Christopher Zurcher <christopher.zurcher@microsoft.com>
> > >
> > > V6 Changes:
> > >   Add GCC-compatible version of these modifications. Supporting GCC
> > > build
> > of
> > >     native OpenSSL .S files requires removal of *(COMMON) from the
> > > /DISCARD/
> > >     section of the GCC linker script.
> > >   The VS/CLANG portion of the patch is unchanged from the
> > > previously-approved
> > >     patchset.
> > >
> > > V5 Changes:
> > >   Move ApiHooks.c into X64 folder
> > >   Update process_files.pl to clean architecture-specific subfolders
> > without
> > >     removing them
> > >   Rebased INF file to merge latest changes regarding RngLib vs.
> > > TimerLib
> > >
> > > V4 Changes:
> > >   Add copyright header to uefi-asm.conf
> > >   Move [Sources.X64] block to cover entire X64-specific config
> > >
> > > 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
> > > 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 <jiewen.yao@intel.com>
> > > Cc: Jian J Wang <jian.j.wang@intel.com>
> > > Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
> > > Cc: Mike Kinney <michael.d.kinney@intel.com>
> > > Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
> > >
> > > Christopher Zurcher (2):
> > >   CryptoPkg/OpensslLib: Add native instruction support for X64
> > >   CryptoPkg/OpensslLib: Commit the auto-generated assembly files for
> > > X64
> > >
> > >  BaseTools/Scripts/GccBase.lds
> > > |    1 -
> > >  CryptoPkg/CryptoPkg.ci.yaml
> > > |   21 +-
> > >  CryptoPkg/Library/Include/CrtLibSupport.h
> > > |    2 +
> > >  CryptoPkg/Library/Include/openssl/opensslconf.h
> > > |    3 -
> > >  CryptoPkg/Library/OpensslLib/OpensslLib.inf
> > > |    2 +-
> > >  CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c
> > > |   44 +
> > >  CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> > > |    2 +-
> > >  CryptoPkg/Library/OpensslLib/OpensslLibX64.inf
> > > |  653 +++
> > >  CryptoPkg/Library/OpensslLib/OpensslLibX64Gcc.inf
> > > |  653 +++
> > >  CryptoPkg/Library/OpensslLib/UefiAsm.conf
> > > |   30 +
> > >  CryptoPkg/Library/OpensslLib/X64/ApiHooks.c
> > > |   22 +
> > >  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/X64Gcc/crypto/aes/aesni-mb-x86_64.S
> > > |  552 +++
> > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha1-x86_64.S
> > > | 1719 +++++++
> > >
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha256-x86_64.S
> > > |
> > > 69 +
> > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-x86_64.S
> > > | 4484 +++++++++++++++++
> > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/vpaes-x86_64.S
> > > |  863 ++++
> > >
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/aesni-gcm-x86_64.S
> > > |   29 +
> > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/ghash-x86_64.S
> > > | 1386 ++++++
> > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-mb-x86_64.S
> > > | 2962 ++++++++++++
> > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-x86_64.S
> > > | 2631 ++++++++++
> > >
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-mb-x86_64.S
> > > | 3286 +++++++++++++
> > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-x86_64.S
> > > | 3097 ++++++++++++
> > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha512-x86_64.S
> > > | 1811 +++++++
> > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/x86_64cpuid.S
> > > |  491 ++
> > >  CryptoPkg/Library/OpensslLib/process_files.pl
> > > |  241 +-
> > >  38 files changed, 50828 insertions(+), 55 deletions(-)  create mode
> > > 100644 CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c
> > >  create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibX64.inf
> > >  create mode 100644
> CryptoPkg/Library/OpensslLib/OpensslLibX64Gcc.inf
> > >  create mode 100644 CryptoPkg/Library/OpensslLib/UefiAsm.conf
> > >  create mode 100644 CryptoPkg/Library/OpensslLib/X64/ApiHooks.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/X64Gcc/crypto/aes/aesni-mb-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha1-x86_64.S
> > >  create mode 100644
> > >
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha256-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/vpaes-x86_64.S
> > >  create mode 100644
> > >
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/aesni-gcm-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/ghash-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-mb-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-mb-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha512-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/x86_64cpuid.S
> > >
> > > --
> > > 2.32.0.windows.1
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> >
> >
> 
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77541): https://edk2.groups.io/g/devel/message/77541
Mute This Topic: https://groups.io/mt/84035919/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native instruction support for X64
Posted by Christopher Zurcher 2 years, 9 months ago
The -fno-common addition to compiler flags should prevent variables being emitted into the COMMON section. Discarding the COMMON section prevents usage of the section even if a driver specifies -fcommon or otherwise utilizes the COMMON section.
I do not think that this change should introduce any issues with other drivers as long as -fno-common remains in the default command line.
The only alternative to removing COMMON from the discards is to drop GCC support from the assembly-accelerated OpenSSL patch.

If this is OK for you, I will send a new patch set with the BaseTools change in a separate commit.

Thanks,
Christopher Zurcher

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming
Sent: Tuesday, July 6, 2021 18:41
To: devel@edk2.groups.io; jiewen.yao@intel.com; 'Christopher Zurcher' <christopher.zurcher@outlook.com>
Cc: 'Wang, Jian J' <jian.j.wang@intel.com>; 'Lu, XiaoyuX' <xiaoyux.lu@intel.com>; 'Kinney, Michael D' <michael.d.kinney@intel.com>; 'Ard Biesheuvel' <ard.biesheuvel@arm.com>
Subject: 回复: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native instruction support for X64

Christopher:
  Discard COMMON section is added by edk2 commit 214a3b79417f64bf2faae74af42c1b9d23f50dc8. Please help evaluate its impact. 

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Yao, Jiewen
> 发送时间: 2021年6月23日 20:42
> 收件人: Christopher Zurcher <christopher.zurcher@outlook.com>;
> devel@edk2.groups.io; gaoliming@byosoft.com.cn
> 抄送: Wang, Jian J <jian.j.wang@intel.com>; Lu, XiaoyuX 
> <xiaoyux.lu@intel.com>; Kinney, Michael D 
> <michael.d.kinney@intel.com>; 'Ard Biesheuvel' 
> <ard.biesheuvel@arm.com>; Yao, Jiewen <jiewen.yao@intel.com>
> 主题: Re: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native 
> instruction support for X64
> 
> Hi Christopher
> Thank you very much to resume this work. :-)
> 
> I have no problem to approve CryptoPkg. (I believe I already did that 
> in last year).
> 
> But since you updated base tool. We need base tool package maintainer 
> to approve that change.
> 
> A good practice is to split the patch from package level. Then we can 
> let each package maintainer approve its own package.
> 
> I will be waiting for the response from base tool owner to review "
> BaseTools/Scripts/GccBase.lds " and give R-B.
> 
> 
> Thank you
> Yao Jiewen
> 
> > -----Original Message-----
> > From: Christopher Zurcher <christopher.zurcher@outlook.com>
> > Sent: Tuesday, June 22, 2021 6:05 AM
> > To: devel@edk2.groups.io; gaoliming@byosoft.com.cn
> > Cc: Yao, Jiewen <jiewen.yao@intel.com>; Wang, Jian J
> <jian.j.wang@intel.com>;
> > Lu, XiaoyuX <xiaoyux.lu@intel.com>; Kinney, Michael D 
> > <michael.d.kinney@intel.com>; 'Ard Biesheuvel'
> <ard.biesheuvel@arm.com>
> > Subject: RE: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add 
> > native instruction support for X64
> >
> > Yes this was discussed last year, sorry for the delay in follow-up, 
> > I was
> changing
> > jobs.
> > The problem is that the assembly code provided by OpenSSL uses "wrt 
> > ..imagebase" which is only supported by win64, not elf64. It was
> requested
> > at the time that I include the OpenSSL-provided .S files as a GCC 
> > tool chain alternative.
> >
> > Thanks,
> > Christopher Zurcher
> >
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> gaoliming
> > Sent: Sunday, June 20, 2021 18:34
> > To: devel@edk2.groups.io; christopher.zurcher@outlook.com
> > Cc: 'Jiewen Yao' <jiewen.yao@intel.com>; 'Jian J Wang'
> > <jian.j.wang@intel.com>; 'Xiaoyu Lu' <xiaoyux.lu@intel.com>; 'Mike Kinney'
> > <michael.d.kinney@intel.com>; 'Ard Biesheuvel'
> <ard.biesheuvel@arm.com>
> > Subject: 回复: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add
> native
> > instruction support for X64
> >
> > Christopher:
> >   Nasm should support GCC tool chain. Do you meet with the problem 
> > on
> nasm
> > version assembly code?
> >   So, you have to add GAS assembly code. This topic may be discussed 
> > last
> year.
> > Can you give some detail for it?
> >
> > Thanks
> > Liming
> > > -----邮件原件-----
> > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表
> Christopher
> > > Zurcher
> > > 发送时间: 2021年6月19日 10:09
> > > 收件人: devel@edk2.groups.io
> > > 抄送: Jiewen Yao <jiewen.yao@intel.com>; Jian J Wang 
> > > <jian.j.wang@intel.com>; Xiaoyu Lu <xiaoyux.lu@intel.com>; Mike 
> > > Kinney <michael.d.kinney@intel.com>; Ard Biesheuvel
> <ard.biesheuvel@arm.com>
> > > 主题: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native 
> > > instruction support for X64
> > >
> > > From: Christopher Zurcher <christopher.zurcher@microsoft.com>
> > >
> > > V6 Changes:
> > >   Add GCC-compatible version of these modifications. Supporting 
> > > GCC build
> > of
> > >     native OpenSSL .S files requires removal of *(COMMON) from the 
> > > /DISCARD/
> > >     section of the GCC linker script.
> > >   The VS/CLANG portion of the patch is unchanged from the 
> > > previously-approved
> > >     patchset.
> > >
> > > V5 Changes:
> > >   Move ApiHooks.c into X64 folder
> > >   Update process_files.pl to clean architecture-specific 
> > > subfolders
> > without
> > >     removing them
> > >   Rebased INF file to merge latest changes regarding RngLib vs.
> > > TimerLib
> > >
> > > V4 Changes:
> > >   Add copyright header to uefi-asm.conf
> > >   Move [Sources.X64] block to cover entire X64-specific config
> > >
> > > 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 
> > > 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 <jiewen.yao@intel.com>
> > > Cc: Jian J Wang <jian.j.wang@intel.com>
> > > Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
> > > Cc: Mike Kinney <michael.d.kinney@intel.com>
> > > Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
> > >
> > > Christopher Zurcher (2):
> > >   CryptoPkg/OpensslLib: Add native instruction support for X64
> > >   CryptoPkg/OpensslLib: Commit the auto-generated assembly files 
> > > for
> > > X64
> > >
> > >  BaseTools/Scripts/GccBase.lds
> > > |    1 -
> > >  CryptoPkg/CryptoPkg.ci.yaml
> > > |   21 +-
> > >  CryptoPkg/Library/Include/CrtLibSupport.h
> > > |    2 +
> > >  CryptoPkg/Library/Include/openssl/opensslconf.h
> > > |    3 -
> > >  CryptoPkg/Library/OpensslLib/OpensslLib.inf
> > > |    2 +-
> > >  CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c
> > > |   44 +
> > >  CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> > > |    2 +-
> > >  CryptoPkg/Library/OpensslLib/OpensslLibX64.inf
> > > |  653 +++
> > >  CryptoPkg/Library/OpensslLib/OpensslLibX64Gcc.inf
> > > |  653 +++
> > >  CryptoPkg/Library/OpensslLib/UefiAsm.conf
> > > |   30 +
> > >  CryptoPkg/Library/OpensslLib/X64/ApiHooks.c
> > > |   22 +
> > >  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/X64Gcc/crypto/aes/aesni-mb-x86_64.S
> > > |  552 +++
> > >  
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha1-x86_64.S
> > > | 1719 +++++++
> > >
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha256-x86_64.S
> > > |
> > > 69 +
> > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-x86_64.S
> > > | 4484 +++++++++++++++++
> > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/vpaes-x86_64.S
> > > |  863 ++++
> > >
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/aesni-gcm-x86_64.S
> > > |   29 +
> > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/ghash-x86_64.S
> > > | 1386 ++++++
> > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-mb-x86_64.S
> > > | 2962 ++++++++++++
> > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-x86_64.S
> > > | 2631 ++++++++++
> > >
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-mb-x86_64.S
> > > | 3286 +++++++++++++
> > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-x86_64.S
> > > | 3097 ++++++++++++
> > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha512-x86_64.S
> > > | 1811 +++++++
> > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/x86_64cpuid.S
> > > |  491 ++
> > >  CryptoPkg/Library/OpensslLib/process_files.pl
> > > |  241 +-
> > >  38 files changed, 50828 insertions(+), 55 deletions(-)  create 
> > > mode
> > > 100644 CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c
> > >  create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibX64.inf
> > >  create mode 100644
> CryptoPkg/Library/OpensslLib/OpensslLibX64Gcc.inf
> > >  create mode 100644 CryptoPkg/Library/OpensslLib/UefiAsm.conf
> > >  create mode 100644 CryptoPkg/Library/OpensslLib/X64/ApiHooks.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/X64Gcc/crypto/aes/aesni-mb-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha1-x86_64.S
> > >  create mode 100644
> > >
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha256-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/vpaes-x86_64.S
> > >  create mode 100644
> > >
> CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/aesni-gcm-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/ghash-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-mb-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-mb-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha512-x86_64.S
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/x86_64cpuid.S
> > >
> > > --
> > > 2.32.0.windows.1
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> >
> >
> 
> 
> 
> 
> 










-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77662): https://edk2.groups.io/g/devel/message/77662
Mute This Topic: https://groups.io/mt/84106216/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


回复: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native instruction support for X64
Posted by gaoliming 2 years, 9 months ago
Include Ard who made this change to discard COMMON section (edk2 214a3b79417f64bf2faae74af42c1b9d23f50dc8). 

Ard: can you help confirm this change to add back COMMON section?
Christopher adds back COMMON section for GCC support from the assembly-accelerated OpenSSL patch.
Because -fno-common option is still kept, COMMON section can be added. 

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Christopher
> Zurcher
> 发送时间: 2021年7月10日 11:00
> 收件人: devel@edk2.groups.io; gaoliming@byosoft.com.cn;
> jiewen.yao@intel.com
> 抄送: 'Wang, Jian J' <jian.j.wang@intel.com>; 'Lu, XiaoyuX'
> <xiaoyux.lu@intel.com>; 'Kinney, Michael D' <michael.d.kinney@intel.com>;
> 'Ard Biesheuvel' <ard.biesheuvel@arm.com>
> 主题: Re: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native
> instruction support for X64
> 
> The -fno-common addition to compiler flags should prevent variables being
> emitted into the COMMON section. Discarding the COMMON section
> prevents usage of the section even if a driver specifies -fcommon or otherwise
> utilizes the COMMON section.
> I do not think that this change should introduce any issues with other drivers
> as long as -fno-common remains in the default command line.
> The only alternative to removing COMMON from the discards is to drop GCC
> support from the assembly-accelerated OpenSSL patch.
> 
> If this is OK for you, I will send a new patch set with the BaseTools change in a
> separate commit.
> 
> Thanks,
> Christopher Zurcher
> 
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming
> Sent: Tuesday, July 6, 2021 18:41
> To: devel@edk2.groups.io; jiewen.yao@intel.com; 'Christopher Zurcher'
> <christopher.zurcher@outlook.com>
> Cc: 'Wang, Jian J' <jian.j.wang@intel.com>; 'Lu, XiaoyuX'
> <xiaoyux.lu@intel.com>; 'Kinney, Michael D' <michael.d.kinney@intel.com>;
> 'Ard Biesheuvel' <ard.biesheuvel@arm.com>
> Subject: 回复: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add
> native instruction support for X64
> 
> Christopher:
>   Discard COMMON section is added by edk2 commit
> 214a3b79417f64bf2faae74af42c1b9d23f50dc8. Please help evaluate its
> impact.
> 
> Thanks
> Liming
> > -----邮件原件-----
> > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Yao,
> Jiewen
> > 发送时间: 2021年6月23日 20:42
> > 收件人: Christopher Zurcher <christopher.zurcher@outlook.com>;
> > devel@edk2.groups.io; gaoliming@byosoft.com.cn
> > 抄送: Wang, Jian J <jian.j.wang@intel.com>; Lu, XiaoyuX
> > <xiaoyux.lu@intel.com>; Kinney, Michael D
> > <michael.d.kinney@intel.com>; 'Ard Biesheuvel'
> > <ard.biesheuvel@arm.com>; Yao, Jiewen <jiewen.yao@intel.com>
> > 主题: Re: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native
> > instruction support for X64
> >
> > Hi Christopher
> > Thank you very much to resume this work. :-)
> >
> > I have no problem to approve CryptoPkg. (I believe I already did that
> > in last year).
> >
> > But since you updated base tool. We need base tool package maintainer
> > to approve that change.
> >
> > A good practice is to split the patch from package level. Then we can
> > let each package maintainer approve its own package.
> >
> > I will be waiting for the response from base tool owner to review "
> > BaseTools/Scripts/GccBase.lds " and give R-B.
> >
> >
> > Thank you
> > Yao Jiewen
> >
> > > -----Original Message-----
> > > From: Christopher Zurcher <christopher.zurcher@outlook.com>
> > > Sent: Tuesday, June 22, 2021 6:05 AM
> > > To: devel@edk2.groups.io; gaoliming@byosoft.com.cn
> > > Cc: Yao, Jiewen <jiewen.yao@intel.com>; Wang, Jian J
> > <jian.j.wang@intel.com>;
> > > Lu, XiaoyuX <xiaoyux.lu@intel.com>; Kinney, Michael D
> > > <michael.d.kinney@intel.com>; 'Ard Biesheuvel'
> > <ard.biesheuvel@arm.com>
> > > Subject: RE: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add
> > > native instruction support for X64
> > >
> > > Yes this was discussed last year, sorry for the delay in follow-up,
> > > I was
> > changing
> > > jobs.
> > > The problem is that the assembly code provided by OpenSSL uses "wrt
> > > ..imagebase" which is only supported by win64, not elf64. It was
> > requested
> > > at the time that I include the OpenSSL-provided .S files as a GCC
> > > tool chain alternative.
> > >
> > > Thanks,
> > > Christopher Zurcher
> > >
> > > -----Original Message-----
> > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> > gaoliming
> > > Sent: Sunday, June 20, 2021 18:34
> > > To: devel@edk2.groups.io; christopher.zurcher@outlook.com
> > > Cc: 'Jiewen Yao' <jiewen.yao@intel.com>; 'Jian J Wang'
> > > <jian.j.wang@intel.com>; 'Xiaoyu Lu' <xiaoyux.lu@intel.com>; 'Mike
> Kinney'
> > > <michael.d.kinney@intel.com>; 'Ard Biesheuvel'
> > <ard.biesheuvel@arm.com>
> > > Subject: 回复: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add
> > native
> > > instruction support for X64
> > >
> > > Christopher:
> > >   Nasm should support GCC tool chain. Do you meet with the problem
> > > on
> > nasm
> > > version assembly code?
> > >   So, you have to add GAS assembly code. This topic may be discussed
> > > last
> > year.
> > > Can you give some detail for it?
> > >
> > > Thanks
> > > Liming
> > > > -----邮件原件-----
> > > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表
> > Christopher
> > > > Zurcher
> > > > 发送时间: 2021年6月19日 10:09
> > > > 收件人: devel@edk2.groups.io
> > > > 抄送: Jiewen Yao <jiewen.yao@intel.com>; Jian J Wang
> > > > <jian.j.wang@intel.com>; Xiaoyu Lu <xiaoyux.lu@intel.com>; Mike
> > > > Kinney <michael.d.kinney@intel.com>; Ard Biesheuvel
> > <ard.biesheuvel@arm.com>
> > > > 主题: [edk2-devel] [PATCH v6 0/2] CryptoPkg/OpensslLib: Add native
> > > > instruction support for X64
> > > >
> > > > From: Christopher Zurcher <christopher.zurcher@microsoft.com>
> > > >
> > > > V6 Changes:
> > > >   Add GCC-compatible version of these modifications. Supporting
> > > > GCC build
> > > of
> > > >     native OpenSSL .S files requires removal of *(COMMON) from the
> > > > /DISCARD/
> > > >     section of the GCC linker script.
> > > >   The VS/CLANG portion of the patch is unchanged from the
> > > > previously-approved
> > > >     patchset.
> > > >
> > > > V5 Changes:
> > > >   Move ApiHooks.c into X64 folder
> > > >   Update process_files.pl to clean architecture-specific
> > > > subfolders
> > > without
> > > >     removing them
> > > >   Rebased INF file to merge latest changes regarding RngLib vs.
> > > > TimerLib
> > > >
> > > > V4 Changes:
> > > >   Add copyright header to uefi-asm.conf
> > > >   Move [Sources.X64] block to cover entire X64-specific config
> > > >
> > > > 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
> > > > 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 <jiewen.yao@intel.com>
> > > > Cc: Jian J Wang <jian.j.wang@intel.com>
> > > > Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
> > > > Cc: Mike Kinney <michael.d.kinney@intel.com>
> > > > Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
> > > >
> > > > Christopher Zurcher (2):
> > > >   CryptoPkg/OpensslLib: Add native instruction support for X64
> > > >   CryptoPkg/OpensslLib: Commit the auto-generated assembly files
> > > > for
> > > > X64
> > > >
> > > >  BaseTools/Scripts/GccBase.lds
> > > > |    1 -
> > > >  CryptoPkg/CryptoPkg.ci.yaml
> > > > |   21 +-
> > > >  CryptoPkg/Library/Include/CrtLibSupport.h
> > > > |    2 +
> > > >  CryptoPkg/Library/Include/openssl/opensslconf.h
> > > > |    3 -
> > > >  CryptoPkg/Library/OpensslLib/OpensslLib.inf
> > > > |    2 +-
> > > >  CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c
> > > > |   44 +
> > > >  CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> > > > |    2 +-
> > > >  CryptoPkg/Library/OpensslLib/OpensslLibX64.inf
> > > > |  653 +++
> > > >  CryptoPkg/Library/OpensslLib/OpensslLibX64Gcc.inf
> > > > |  653 +++
> > > >  CryptoPkg/Library/OpensslLib/UefiAsm.conf
> > > > |   30 +
> > > >  CryptoPkg/Library/OpensslLib/X64/ApiHooks.c
> > > > |   22 +
> > > >
> 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/X64Gcc/crypto/aes/aesni-mb-x86_64.S
> > > > |  552 +++
> > > >
> > > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha1-x86_64.S
> > > > | 1719 +++++++
> > > >
> > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha256-x86_64.S
> > > > |
> > > > 69 +
> > > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-x86_64.S
> > > > | 4484 +++++++++++++++++
> > > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/vpaes-x86_64.S
> > > > |  863 ++++
> > > >
> > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/aesni-gcm-x86_64.S
> > > > |   29 +
> > > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/ghash-x86_64.S
> > > > | 1386 ++++++
> > > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-mb-x86_64.S
> > > > | 2962 ++++++++++++
> > > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-x86_64.S
> > > > | 2631 ++++++++++
> > > >
> > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-mb-x86_64.S
> > > > | 3286 +++++++++++++
> > > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-x86_64.S
> > > > | 3097 ++++++++++++
> > > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha512-x86_64.S
> > > > | 1811 +++++++
> > > >  CryptoPkg/Library/OpensslLib/X64Gcc/crypto/x86_64cpuid.S
> > > > |  491 ++
> > > >  CryptoPkg/Library/OpensslLib/process_files.pl
> > > > |  241 +-
> > > >  38 files changed, 50828 insertions(+), 55 deletions(-)  create
> > > > mode
> > > > 100644 CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c
> > > >  create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibX64.inf
> > > >  create mode 100644
> > CryptoPkg/Library/OpensslLib/OpensslLibX64Gcc.inf
> > > >  create mode 100644 CryptoPkg/Library/OpensslLib/UefiAsm.conf
> > > >  create mode 100644 CryptoPkg/Library/OpensslLib/X64/ApiHooks.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/X64Gcc/crypto/aes/aesni-mb-x86_64.S
> > > >  create mode 100644
> > > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha1-x86_64.S
> > > >  create mode 100644
> > > >
> > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-sha256-x86_64.S
> > > >  create mode 100644
> > > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/aesni-x86_64.S
> > > >  create mode 100644
> > > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/aes/vpaes-x86_64.S
> > > >  create mode 100644
> > > >
> > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/aesni-gcm-x86_64.S
> > > >  create mode 100644
> > > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/modes/ghash-x86_64.S
> > > >  create mode 100644
> > > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-mb-x86_64.S
> > > >  create mode 100644
> > > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha1-x86_64.S
> > > >  create mode 100644
> > > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-mb-x86_64.S
> > > >  create mode 100644
> > > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha256-x86_64.S
> > > >  create mode 100644
> > > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/sha/sha512-x86_64.S
> > > >  create mode 100644
> > > > CryptoPkg/Library/OpensslLib/X64Gcc/crypto/x86_64cpuid.S
> > > >
> > > > --
> > > > 2.32.0.windows.1
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77698): https://edk2.groups.io/g/devel/message/77698
Mute This Topic: https://groups.io/mt/84153382/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-