CryptoPkg/OpensslLib: Add native instruction support for AARCH64
Add native instruction support for AARCH64. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This commit is contained in:
parent
1715d67231
commit
952ecf53f9
|
@ -1,10 +1,11 @@
|
||||||
## @file
|
## @file
|
||||||
# This module provides OpenSSL Library implementation with TLS features
|
# This module provides OpenSSL Library implementation with TLS features
|
||||||
# along with performance optimized implementations of SHA1, SHA256, SHA512,
|
# along with performance optimized implementations of SHA1, SHA256, SHA512,
|
||||||
# AESNI, VPAED, and GHASH for IA32 and X64.
|
# AESNI, VPAED, and GHASH for IA32 and X64 and AARCH64.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR>
|
||||||
# (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
|
# (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
|
||||||
|
# Copyright (c) 2023 - 2024, Arm Limited. All rights reserved.<BR>
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
|
@ -24,9 +25,10 @@
|
||||||
DEFINE OPENSSL_FLAGS = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DEDK2_OPENSSL_NOEC=1
|
DEFINE OPENSSL_FLAGS = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DEDK2_OPENSSL_NOEC=1
|
||||||
DEFINE OPENSSL_FLAGS_IA32 = -DAES_ASM -DGHASH_ASM -DMD5_ASM -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DVPAES_ASM
|
DEFINE OPENSSL_FLAGS_IA32 = -DAES_ASM -DGHASH_ASM -DMD5_ASM -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DVPAES_ASM
|
||||||
DEFINE OPENSSL_FLAGS_X64 = -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DVPAES_ASM
|
DEFINE OPENSSL_FLAGS_X64 = -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DVPAES_ASM
|
||||||
|
DEFINE OPENSSL_FLAGS_AARCH64 =
|
||||||
|
|
||||||
#
|
#
|
||||||
# VALID_ARCHITECTURES = IA32 X64
|
# VALID_ARCHITECTURES = IA32 X64 AARCH64
|
||||||
#
|
#
|
||||||
|
|
||||||
[Sources]
|
[Sources]
|
||||||
|
@ -1326,6 +1328,10 @@
|
||||||
$(OPENSSL_GEN_PATH)/X64-GCC/crypto/sha/sha512-x86_64.s | GCC
|
$(OPENSSL_GEN_PATH)/X64-GCC/crypto/sha/sha512-x86_64.s | GCC
|
||||||
# Autogenerated files list ends here
|
# Autogenerated files list ends here
|
||||||
|
|
||||||
|
[Sources.AARCH64]
|
||||||
|
# Autogenerated files list starts here
|
||||||
|
# Autogenerated files list ends here
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
CryptoPkg/CryptoPkg.dec
|
CryptoPkg/CryptoPkg.dec
|
||||||
|
@ -1403,3 +1409,16 @@
|
||||||
# commit d9b8b89bec4480de3a10bdaf9425db371c19145b, and can be dropped then.)
|
# commit d9b8b89bec4480de3a10bdaf9425db371c19145b, and can be dropped then.)
|
||||||
XCODE:*_*_IA32_CC_FLAGS = -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) $(OPENSSL_FLAGS_IA32) -w -std=c99 -Wno-error=uninitialized
|
XCODE:*_*_IA32_CC_FLAGS = -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) $(OPENSSL_FLAGS_IA32) -w -std=c99 -Wno-error=uninitialized
|
||||||
XCODE:*_*_X64_CC_FLAGS = -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) $(OPENSSL_FLAGS_X64) -w -std=c99 -Wno-error=uninitialized
|
XCODE:*_*_X64_CC_FLAGS = -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) $(OPENSSL_FLAGS_X64) -w -std=c99 -Wno-error=uninitialized
|
||||||
|
|
||||||
|
GCC:*_*_AARCH64_CC_FLAGS = $(OPENSSL_FLAGS) $(OPENSSL_FLAGS_AARCH64) -Wno-error=format -Wno-format -D_BITS_STDINT_UINTN_H -D_BITS_STDINT_INTN_H
|
||||||
|
|
||||||
|
#
|
||||||
|
# AARCH64 uses strict alignment and avoids SIMD registers for code that may execute
|
||||||
|
# with the MMU off. This involves SEC, PEI_CORE and PEIM modules as well as BASE
|
||||||
|
# libraries, given that they may be included into such modules.
|
||||||
|
# This library, even though of the BASE type, is never used in such cases, and
|
||||||
|
# avoiding the SIMD register file (which is shared with the FPU) prevents the
|
||||||
|
# compiler from successfully building some of the OpenSSL source files that
|
||||||
|
# use floating point types, so clear the flags here.
|
||||||
|
#
|
||||||
|
GCC:*_*_AARCH64_CC_XIPFLAGS ==
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# This module provides OpenSSL Library implementation with ECC and TLS
|
# This module provides OpenSSL Library implementation with ECC and TLS
|
||||||
# features along with performance optimized implementations of SHA1,
|
# features along with performance optimized implementations of SHA1,
|
||||||
# SHA256, SHA512 AESNI, VPAED, and GHASH for IA32 and X64.
|
# SHA256, SHA512 AESNI, VPAED, and GHASH for IA32 and X64 and AARCH64.
|
||||||
#
|
#
|
||||||
# This library should be used if a module module needs ECC in TLS, or
|
# This library should be used if a module module needs ECC in TLS, or
|
||||||
# asymmetric cryptography services such as X509 certificate or PEM format
|
# asymmetric cryptography services such as X509 certificate or PEM format
|
||||||
|
@ -10,6 +10,7 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR>
|
||||||
# (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
|
# (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
|
||||||
|
# Copyright (c) 2023 - 2024, Arm Limited. All rights reserved.<BR>
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
|
@ -29,9 +30,10 @@
|
||||||
DEFINE OPENSSL_FLAGS = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
|
DEFINE OPENSSL_FLAGS = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
|
||||||
DEFINE OPENSSL_FLAGS_IA32 = -DAES_ASM -DGHASH_ASM -DMD5_ASM -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DVPAES_ASM
|
DEFINE OPENSSL_FLAGS_IA32 = -DAES_ASM -DGHASH_ASM -DMD5_ASM -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DVPAES_ASM
|
||||||
DEFINE OPENSSL_FLAGS_X64 = -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DVPAES_ASM
|
DEFINE OPENSSL_FLAGS_X64 = -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DVPAES_ASM
|
||||||
|
DEFINE OPENSSL_FLAGS_AARCH64 =
|
||||||
|
|
||||||
#
|
#
|
||||||
# VALID_ARCHITECTURES = IA32 X64
|
# VALID_ARCHITECTURES = IA32 X64 AARCH64
|
||||||
#
|
#
|
||||||
|
|
||||||
[Sources]
|
[Sources]
|
||||||
|
@ -1429,6 +1431,10 @@
|
||||||
$(OPENSSL_GEN_PATH)/X64-GCC/crypto/sha/sha512-x86_64.s | GCC
|
$(OPENSSL_GEN_PATH)/X64-GCC/crypto/sha/sha512-x86_64.s | GCC
|
||||||
# Autogenerated files list ends here
|
# Autogenerated files list ends here
|
||||||
|
|
||||||
|
[Sources.AARCH64]
|
||||||
|
# Autogenerated files list starts here
|
||||||
|
# Autogenerated files list ends here
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
CryptoPkg/CryptoPkg.dec
|
CryptoPkg/CryptoPkg.dec
|
||||||
|
@ -1506,3 +1512,16 @@
|
||||||
# commit d9b8b89bec4480de3a10bdaf9425db371c19145b, and can be dropped then.)
|
# commit d9b8b89bec4480de3a10bdaf9425db371c19145b, and can be dropped then.)
|
||||||
XCODE:*_*_IA32_CC_FLAGS = -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) $(OPENSSL_FLAGS_IA32) -w -std=c99 -Wno-error=uninitialized
|
XCODE:*_*_IA32_CC_FLAGS = -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) $(OPENSSL_FLAGS_IA32) -w -std=c99 -Wno-error=uninitialized
|
||||||
XCODE:*_*_X64_CC_FLAGS = -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) $(OPENSSL_FLAGS_X64) -w -std=c99 -Wno-error=uninitialized
|
XCODE:*_*_X64_CC_FLAGS = -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) $(OPENSSL_FLAGS_X64) -w -std=c99 -Wno-error=uninitialized
|
||||||
|
|
||||||
|
GCC:*_*_AARCH64_CC_FLAGS = $(OPENSSL_FLAGS) $(OPENSSL_FLAGS_AARCH64) -Wno-error=format -Wno-format -D_BITS_STDINT_UINTN_H -D_BITS_STDINT_INTN_H
|
||||||
|
|
||||||
|
#
|
||||||
|
# AARCH64 uses strict alignment and avoids SIMD registers for code that may execute
|
||||||
|
# with the MMU off. This involves SEC, PEI_CORE and PEIM modules as well as BASE
|
||||||
|
# libraries, given that they may be included into such modules.
|
||||||
|
# This library, even though of the BASE type, is never used in such cases, and
|
||||||
|
# avoiding the SIMD register file (which is shared with the FPU) prevents the
|
||||||
|
# compiler from successfully building some of the OpenSSL source files that
|
||||||
|
# use floating point types, so clear the flags here.
|
||||||
|
#
|
||||||
|
GCC:*_*_AARCH64_CC_XIPFLAGS ==
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# UEFI assembly openssl configuration targets.
|
# UEFI assembly openssl configuration targets.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
|
||||||
|
# Copyright (c) 2023 - 2024, Arm Limited. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
#
|
#
|
||||||
|
@ -28,4 +29,9 @@ my %targets = (
|
||||||
perlasm_scheme => "elf",
|
perlasm_scheme => "elf",
|
||||||
asm_arch => "x86_64",
|
asm_arch => "x86_64",
|
||||||
},
|
},
|
||||||
|
"UEFI-AARCH64-GCC" => {
|
||||||
|
inherit_from => [ "UEFI" ],
|
||||||
|
asm_arch => "aarch64",
|
||||||
|
perlasm_scheme => "linux64-aarch64",
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -262,6 +262,7 @@ def sources_filter_fn(filename):
|
||||||
'provider_predefined.c',
|
'provider_predefined.c',
|
||||||
'ecp_nistz256.c',
|
'ecp_nistz256.c',
|
||||||
'x86_64-gcc.c',
|
'x86_64-gcc.c',
|
||||||
|
'armcap.c',
|
||||||
]
|
]
|
||||||
for item in exclude:
|
for item in exclude:
|
||||||
if item in filename:
|
if item in filename:
|
||||||
|
@ -353,7 +354,8 @@ def main():
|
||||||
sources = {}
|
sources = {}
|
||||||
defines = {}
|
defines = {}
|
||||||
for asm in [ 'UEFI-IA32-MSFT', 'UEFI-IA32-GCC',
|
for asm in [ 'UEFI-IA32-MSFT', 'UEFI-IA32-GCC',
|
||||||
'UEFI-X64-MSFT', 'UEFI-X64-GCC']:
|
'UEFI-X64-MSFT', 'UEFI-X64-GCC',
|
||||||
|
'UEFI-AARCH64-GCC']:
|
||||||
(uefi, arch, cc) = asm.split('-')
|
(uefi, arch, cc) = asm.split('-')
|
||||||
archcc = f'{arch}-{cc}'
|
archcc = f'{arch}-{cc}'
|
||||||
|
|
||||||
|
@ -375,6 +377,8 @@ def main():
|
||||||
x64accel = sources['X64'] + sources['X64-MSFT'] + sources['X64-GCC']
|
x64accel = sources['X64'] + sources['X64-MSFT'] + sources['X64-GCC']
|
||||||
update_inf(inf, ia32accel, 'IA32', defines['IA32'])
|
update_inf(inf, ia32accel, 'IA32', defines['IA32'])
|
||||||
update_inf(inf, x64accel, 'X64', defines['X64'])
|
update_inf(inf, x64accel, 'X64', defines['X64'])
|
||||||
|
aarch64accel = sources['AARCH64'] + sources['AARCH64-GCC']
|
||||||
|
update_inf(inf, aarch64accel, 'AARCH64', defines['AARCH64'])
|
||||||
|
|
||||||
# noaccel - ec enabled
|
# noaccel - ec enabled
|
||||||
openssl_configure(openssldir, 'UEFI', ec = True);
|
openssl_configure(openssldir, 'UEFI', ec = True);
|
||||||
|
|
Loading…
Reference in New Issue