diff options
author | Jack Lloyd <[email protected]> | 2019-12-12 09:10:34 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-12-12 09:10:34 -0500 |
commit | 8f684a6f533feb54f888639f48c1ac6637a87950 (patch) | |
tree | eec8d73e1d6381a31fa72979fae76f4cfa72652e /src | |
parent | 1b65377689d8522dfd80a34506594414b7d6ab61 (diff) |
Clean up handling of POWER ISA extensions
See #2226
Diffstat (limited to 'src')
-rw-r--r-- | src/build-data/arch/ppc64.txt | 3 | ||||
-rw-r--r-- | src/build-data/cc/gcc.txt | 3 | ||||
-rw-r--r-- | src/lib/block/aes/aes.cpp | 22 | ||||
-rw-r--r-- | src/lib/block/aes/aes_power8/info.txt | 2 | ||||
-rw-r--r-- | src/lib/entropy/p9_darn/info.txt | 4 | ||||
-rw-r--r-- | src/lib/utils/cpuid/cpuid.cpp | 6 | ||||
-rw-r--r-- | src/lib/utils/cpuid/cpuid.h | 6 | ||||
-rw-r--r-- | src/lib/utils/cpuid/cpuid_ppc.cpp | 2 | ||||
-rw-r--r-- | src/tests/data/block/aes.vec | 2 |
9 files changed, 26 insertions, 24 deletions
diff --git a/src/build-data/arch/ppc64.txt b/src/build-data/arch/ppc64.txt index 470bee2db..57a363c04 100644 --- a/src/build-data/arch/ppc64.txt +++ b/src/build-data/arch/ppc64.txt @@ -12,6 +12,5 @@ ppc64el <isa_extensions> altivec -ppccrypto -power9 +powercrypto </isa_extensions> diff --git a/src/build-data/cc/gcc.txt b/src/build-data/cc/gcc.txt index 4ff005bd5..a653fe47e 100644 --- a/src/build-data/cc/gcc.txt +++ b/src/build-data/cc/gcc.txt @@ -64,8 +64,7 @@ rdseed -> "-mrdseed" sha -> "-msha" altivec -> "-maltivec" -ppccrypto -> "-mcrypto" -power9 -> "-mcpu=power9" +powercrypto -> "-mcrypto" arm64:armv8crypto -> "" arm64:armv8sm3 -> "-march=armv8.2-a+sm4" diff --git a/src/lib/block/aes/aes.cpp b/src/lib/block/aes/aes.cpp index 2813a5f5a..af7ec8f46 100644 --- a/src/lib/block/aes/aes.cpp +++ b/src/lib/block/aes/aes.cpp @@ -431,7 +431,7 @@ size_t aes_parallelism() #endif #if defined(BOTAN_HAS_AES_POWER8) - if(CPUID::has_ppc_crypto()) + if(CPUID::has_power_crypto()) { return 4; } @@ -457,7 +457,7 @@ const char* aes_provider() #endif #if defined(BOTAN_HAS_AES_POWER8) - if(CPUID::has_ppc_crypto()) + if(CPUID::has_power_crypto()) { return "power8"; } @@ -509,7 +509,7 @@ void AES_128::encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const #endif #if defined(BOTAN_HAS_AES_POWER8) - if(CPUID::has_ppc_crypto()) + if(CPUID::has_power_crypto()) { return power8_encrypt_n(in, out, blocks); } @@ -544,7 +544,7 @@ void AES_128::decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const #endif #if defined(BOTAN_HAS_AES_POWER8) - if(CPUID::has_ppc_crypto()) + if(CPUID::has_power_crypto()) { return power8_decrypt_n(in, out, blocks); } @@ -577,7 +577,7 @@ void AES_128::key_schedule(const uint8_t key[], size_t length) #endif #if defined(BOTAN_HAS_AES_POWER8) - if(CPUID::has_ppc_crypto()) + if(CPUID::has_power_crypto()) { return aes_key_schedule(key, length, m_EK, m_DK, m_ME, m_MD); } @@ -620,7 +620,7 @@ void AES_192::encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const #endif #if defined(BOTAN_HAS_AES_POWER8) - if(CPUID::has_ppc_crypto()) + if(CPUID::has_power_crypto()) { return power8_encrypt_n(in, out, blocks); } @@ -655,7 +655,7 @@ void AES_192::decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const #endif #if defined(BOTAN_HAS_AES_POWER8) - if(CPUID::has_ppc_crypto()) + if(CPUID::has_power_crypto()) { return power8_decrypt_n(in, out, blocks); } @@ -688,7 +688,7 @@ void AES_192::key_schedule(const uint8_t key[], size_t length) #endif #if defined(BOTAN_HAS_AES_POWER8) - if(CPUID::has_ppc_crypto()) + if(CPUID::has_power_crypto()) { return aes_key_schedule(key, length, m_EK, m_DK, m_ME, m_MD); } @@ -731,7 +731,7 @@ void AES_256::encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const #endif #if defined(BOTAN_HAS_AES_POWER8) - if(CPUID::has_ppc_crypto()) + if(CPUID::has_power_crypto()) { return power8_encrypt_n(in, out, blocks); } @@ -766,7 +766,7 @@ void AES_256::decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const #endif #if defined(BOTAN_HAS_AES_POWER8) - if(CPUID::has_ppc_crypto()) + if(CPUID::has_power_crypto()) { return power8_decrypt_n(in, out, blocks); } @@ -799,7 +799,7 @@ void AES_256::key_schedule(const uint8_t key[], size_t length) #endif #if defined(BOTAN_HAS_AES_POWER8) - if(CPUID::has_ppc_crypto()) + if(CPUID::has_power_crypto()) { return aes_key_schedule(key, length, m_EK, m_DK, m_ME, m_MD); } diff --git a/src/lib/block/aes/aes_power8/info.txt b/src/lib/block/aes/aes_power8/info.txt index d02858bfc..df569edd5 100644 --- a/src/lib/block/aes/aes_power8/info.txt +++ b/src/lib/block/aes/aes_power8/info.txt @@ -7,5 +7,5 @@ ppc64 </arch> <isa> -ppccrypto +powercrypto </isa> diff --git a/src/lib/entropy/p9_darn/info.txt b/src/lib/entropy/p9_darn/info.txt index 47d99aa3d..e703786f4 100644 --- a/src/lib/entropy/p9_darn/info.txt +++ b/src/lib/entropy/p9_darn/info.txt @@ -9,3 +9,7 @@ p9_darn.h <arch> ppc64 </arch> + +<isa> +powercrypto +</isa> diff --git a/src/lib/utils/cpuid/cpuid.cpp b/src/lib/utils/cpuid/cpuid.cpp index 81fabf0a3..199feca66 100644 --- a/src/lib/utils/cpuid/cpuid.cpp +++ b/src/lib/utils/cpuid/cpuid.cpp @@ -55,7 +55,7 @@ std::string CPUID::to_string() #if defined(BOTAN_TARGET_CPU_IS_PPC_FAMILY) CPUID_PRINT(altivec); - CPUID_PRINT(ppc_crypto); + CPUID_PRINT(power_crypto); CPUID_PRINT(darn_rng); #endif @@ -167,8 +167,8 @@ CPUID::bit_from_string(const std::string& tok) #elif defined(BOTAN_TARGET_CPU_IS_PPC_FAMILY) if(tok == "altivec" || tok == "simd") return {Botan::CPUID::CPUID_ALTIVEC_BIT}; - if(tok == "ppc_crypto") - return {Botan::CPUID::CPUID_PPC_CRYPTO_BIT}; + if(tok == "power_crypto") + return {Botan::CPUID::CPUID_POWER_CRYPTO_BIT}; #elif defined(BOTAN_TARGET_CPU_IS_ARM_FAMILY) if(tok == "neon" || tok == "simd") diff --git a/src/lib/utils/cpuid/cpuid.h b/src/lib/utils/cpuid/cpuid.h index 84201b910..77b0c99f6 100644 --- a/src/lib/utils/cpuid/cpuid.h +++ b/src/lib/utils/cpuid/cpuid.h @@ -120,7 +120,7 @@ class BOTAN_PUBLIC_API(2,1) CPUID final #if defined(BOTAN_TARGET_CPU_IS_PPC_FAMILY) CPUID_ALTIVEC_BIT = (1ULL << 0), - CPUID_PPC_CRYPTO_BIT = (1ULL << 1), + CPUID_POWER_CRYPTO_BIT = (1ULL << 1), CPUID_DARN_BIT = (1ULL << 2), #endif @@ -150,8 +150,8 @@ class BOTAN_PUBLIC_API(2,1) CPUID final /** * Check if the processor supports POWER8 crypto extensions */ - static bool has_ppc_crypto() - { return has_cpuid_bit(CPUID_PPC_CRYPTO_BIT); } + static bool has_power_crypto() + { return has_cpuid_bit(CPUID_POWER_CRYPTO_BIT); } /** * Check if the processor supports POWER9 DARN RNG diff --git a/src/lib/utils/cpuid/cpuid_ppc.cpp b/src/lib/utils/cpuid/cpuid_ppc.cpp index 4fb24f24b..604b97947 100644 --- a/src/lib/utils/cpuid/cpuid_ppc.cpp +++ b/src/lib/utils/cpuid/cpuid_ppc.cpp @@ -72,7 +72,7 @@ uint64_t CPUID::CPUID_Data::detect_cpu_features(size_t* cache_line_size) const unsigned long hwcap_crypto = OS::get_auxval(PPC_hwcap_bit::ARCH_hwcap_crypto); if(hwcap_crypto & PPC_hwcap_bit::CRYPTO_bit) - detected_features |= CPUID::CPUID_PPC_CRYPTO_BIT; + detected_features |= CPUID::CPUID_POWER_CRYPTO_BIT; if(hwcap_crypto & PPC_hwcap_bit::DARN_bit) detected_features |= CPUID::CPUID_DARN_BIT; diff --git a/src/tests/data/block/aes.vec b/src/tests/data/block/aes.vec index f65c00b7c..8cd7f4d85 100644 --- a/src/tests/data/block/aes.vec +++ b/src/tests/data/block/aes.vec @@ -1,7 +1,7 @@ # Test vectors from NIST CAVP AESAVS # http://csrc.nist.gov/groups/STM/cavp/documents/aes/AESAVS.pdf -#test cpuid aesni armv8aes ppc_crypto ssse3 neon altivec +#test cpuid aesni armv8aes power_crypto ssse3 neon altivec [AES-128] Key = 000102030405060708090A0B0C0D0E0F |