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

Yao, Jiewen jiewen.yao at intel.com
Tue Nov 3 01:07:33 UTC 2020


Hi Zurcher
The general guideline for EDKII is that if a file is arch specific (not required for other), then it should be under Arch folder. (no matter it is ASM or C).

In this case, ApiHooks.c seems a workaround only for X64 NASM build. That is why I recommend to move it under X64.

I don't think we have rule that "The architecture-specific folders from this patch are maintained by process_files.pl". You can delete *.nasm and regenerate *.nasm, but keep others.

Thank you
Yao Jiewen

> -----Original Message-----
> From: Zurcher, Christopher J <christopher.j.zurcher at intel.com>
> Sent: Tuesday, November 3, 2020 4:49 AM
> To: Yao, Jiewen <jiewen.yao at intel.com>; devel at edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang at intel.com>; Lu, XiaoyuX
> <xiaoyux.lu at intel.com>; Kinney, Michael D <michael.d.kinney at intel.com>;
> Ard Biesheuvel <ard.biesheuvel at arm.com>
> Subject: RE: [PATCH v4 0/2] CryptoPkg/OpensslLib: Add native instruction
> support for X64
> 
> I may have misunderstood the recommendation; the file is under
> [Sources.X64] in the INF file.
> The X64 folder is automatically deleted and re-generated when
> process_files.pl is run, so no standard file can go there. The architecture-
> specific folders from this patch are maintained by process_files.pl so that
> any changes to uefi-asm.conf can take effect in the auto-generated assembly
> files.
> 
> Thanks,
> Christopher Zurcher
> 
> > -----Original Message-----
> > From: Yao, Jiewen <jiewen.yao at intel.com>
> > Sent: Friday, October 30, 2020 18:15
> > To: Zurcher, Christopher J <christopher.j.zurcher at intel.com>;
> > devel at edk2.groups.io
> > Cc: Wang, Jian J <jian.j.wang at intel.com>; Lu, XiaoyuX
> <xiaoyux.lu at intel.com>;
> > Kinney, Michael D <michael.d.kinney at intel.com>; Ard Biesheuvel
> > <ard.biesheuvel at arm.com>
> > Subject: RE: [PATCH v4 0/2] CryptoPkg/OpensslLib: Add native instruction
> > support for X64
> >
> > Hi Zurcher
> > I have given the feedback to move ApiHooks.c to X64 dir.
> >
> > But I do not see your response, and I do not see you are following the
> > recommendation.
> >
> > =================
> > > ApiHooks.c is for any compiler building the assembly files, not only Visual
> > > Studio.
> > [Jiewen] Got it. Thanks for the clarification.
> > It is only needed for X64 assembly. Right?
> > If so, I recommend to put it to [Source.X64]
> > =================
> >
> >
> >
> > > -----Original Message-----
> > > From: Christopher J Zurcher <christopher.j.zurcher at intel.com>
> > > Sent: Thursday, October 29, 2020 2:16 AM
> > > To: devel at edk2.groups.io
> > > Cc: Yao, Jiewen <jiewen.yao at intel.com>; Wang, Jian J
> > > <jian.j.wang at intel.com>; Lu, XiaoyuX <xiaoyux.lu at intel.com>; Kinney,
> > > Michael D <michael.d.kinney at intel.com>; Ard Biesheuvel
> > > <ard.biesheuvel at arm.com>
> > > Subject: [PATCH v4 0/2] CryptoPkg/OpensslLib: Add native instruction
> > > support for X64
> > >
> > > 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 at intel.com>
> > > Cc: Jian J Wang <jian.j.wang at intel.com>
> > > Cc: Xiaoyu Lu <xiaoyux.lu at intel.com>
> > > Cc: Mike Kinney <michael.d.kinney at intel.com>
> > > Cc: Ard Biesheuvel <ard.biesheuvel at arm.com>
> > >
> > > Christopher J Zurcher (2):
> > >   CryptoPkg/OpensslLib: Add native instruction support for X64
> > >   CryptoPkg/OpensslLib: Commit the auto-generated assembly files for
> X64
> > >
> > >  CryptoPkg/Library/OpensslLib/OpensslLib.inf                          |
> > 2 +-
> > >  CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf                    |
> > 2 +-
> > >  CryptoPkg/Library/OpensslLib/OpensslLibX64.inf                       |
> > 655 +++
> > >  CryptoPkg/Library/Include/CrtLibSupport.h                            |
> > 2 +
> > >  CryptoPkg/Library/Include/openssl/opensslconf.h                      |
> > 3 -
> > >  CryptoPkg/Library/OpensslLib/ApiHooks.c                              |
> > 18 +
> > >  CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c                 |
> > 34 +
> > >  CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-mb-x86_64.nasm
> |
> > > 732 +++
> > >  CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha1-x86_64.nasm
> |
> > > 1916 ++++++++
> > >  CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha256-
> x86_64.nasm |
> > > 78 +
> > >  CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-x86_64.nasm        |
> > > 5103 ++++++++++++++++++++
> > >  CryptoPkg/Library/OpensslLib/X64/crypto/aes/vpaes-x86_64.nasm        |
> > > 1173 +++++
> > >  CryptoPkg/Library/OpensslLib/X64/crypto/modes/aesni-gcm-
> x86_64.nasm  |
> > > 34 +
> > >  CryptoPkg/Library/OpensslLib/X64/crypto/modes/ghash-x86_64.nasm
> |
> > > 1569 ++++++
> > >  CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha1-mb-x86_64.nasm
> |
> > > 3137 ++++++++++++
> > >  CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha1-x86_64.nasm         |
> > > 2884 +++++++++++
> > >  CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha256-mb-x86_64.nasm
> |
> > > 3461 +++++++++++++
> > >  CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha256-x86_64.nasm       |
> > > 3313 +++++++++++++
> > >  CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha512-x86_64.nasm       |
> > > 1938 ++++++++
> > >  CryptoPkg/Library/OpensslLib/X64/crypto/x86_64cpuid.nasm             |
> > 491
> > > ++
> > >  CryptoPkg/Library/OpensslLib/process_files.pl                        |
> > 223 +-
> > >  CryptoPkg/Library/OpensslLib/uefi-asm.conf                           |
> > 21 +
> > >  22 files changed, 26739 insertions(+), 50 deletions(-)
> > >  create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibX64.inf
> > >  create mode 100644 CryptoPkg/Library/OpensslLib/ApiHooks.c
> > >  create mode 100644
> CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c
> > >  create mode 100644
> CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-
> > > mb-x86_64.nasm
> > >  create mode 100644
> CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-
> > > sha1-x86_64.nasm
> > >  create mode 100644
> CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-
> > > sha256-x86_64.nasm
> > >  create mode 100644
> CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-
> > > x86_64.nasm
> > >  create mode 100644
> CryptoPkg/Library/OpensslLib/X64/crypto/aes/vpaes-
> > > x86_64.nasm
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64/crypto/modes/aesni-gcm-x86_64.nasm
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64/crypto/modes/ghash-x86_64.nasm
> > >  create mode 100644 CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha1-
> > > mb-x86_64.nasm
> > >  create mode 100644 CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha1-
> > > x86_64.nasm
> > >  create mode 100644
> CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha256-
> > > mb-x86_64.nasm
> > >  create mode 100644
> CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha256-
> > > x86_64.nasm
> > >  create mode 100644
> CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha512-
> > > x86_64.nasm
> > >  create mode 100644
> > > CryptoPkg/Library/OpensslLib/X64/crypto/x86_64cpuid.nasm
> > >  create mode 100644 CryptoPkg/Library/OpensslLib/uefi-asm.conf
> > >
> > > --
> > > 2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#66890): https://edk2.groups.io/g/devel/message/66890
Mute This Topic: https://groups.io/mt/77869586/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list