Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This deals with incompatibilities between clang and gcc regarding names of function target attribute isas for arm targets #3491

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/lib/block/aes/aes_armv8/aes_armv8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ namespace Botan {
/*
* AES-128 Encryption
*/
#if defined(BOTAN_BUILD_COMPILER_IS_CLANG)
BOTAN_FUNC_ISA("crypto")
#else
BOTAN_FUNC_ISA("+crypto")
#endif
void AES_128::hw_aes_encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const
{
const uint8_t *skey = reinterpret_cast<const uint8_t*>(m_EK.data());
Expand Down Expand Up @@ -119,7 +123,11 @@ void AES_128::hw_aes_encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks)
/*
* AES-128 Decryption
*/
#if defined(BOTAN_BUILD_COMPILER_IS_CLANG)
BOTAN_FUNC_ISA("crypto")
#else
BOTAN_FUNC_ISA("+crypto")
#endif
void AES_128::hw_aes_decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const
{
const uint8_t *skey = reinterpret_cast<const uint8_t*>(m_DK.data());
Expand Down Expand Up @@ -184,7 +192,11 @@ void AES_128::hw_aes_decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks)
/*
* AES-192 Encryption
*/
#if defined(BOTAN_BUILD_COMPILER_IS_CLANG)
BOTAN_FUNC_ISA("crypto")
#else
BOTAN_FUNC_ISA("+crypto")
#endif
void AES_192::hw_aes_encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const
{
const uint8_t *skey = reinterpret_cast<const uint8_t*>(m_EK.data());
Expand Down Expand Up @@ -255,7 +267,11 @@ void AES_192::hw_aes_encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks)
/*
* AES-192 Decryption
*/
#if defined(BOTAN_BUILD_COMPILER_IS_CLANG)
BOTAN_FUNC_ISA("crypto")
#else
BOTAN_FUNC_ISA("+crypto")
#endif
void AES_192::hw_aes_decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const
{
const uint8_t *skey = reinterpret_cast<const uint8_t*>(m_DK.data());
Expand Down Expand Up @@ -326,7 +342,11 @@ void AES_192::hw_aes_decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks)
/*
* AES-256 Encryption
*/
#if defined(BOTAN_BUILD_COMPILER_IS_CLANG)
BOTAN_FUNC_ISA("crypto")
#else
BOTAN_FUNC_ISA("+crypto")
#endif
void AES_256::hw_aes_encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const
{
const uint8_t *skey = reinterpret_cast<const uint8_t*>(m_EK.data());
Expand Down Expand Up @@ -403,7 +423,11 @@ void AES_256::hw_aes_encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks)
/*
* AES-256 Decryption
*/
#if defined(BOTAN_BUILD_COMPILER_IS_CLANG)
BOTAN_FUNC_ISA("crypto")
#else
BOTAN_FUNC_ISA("+crypto")
#endif
void AES_256::hw_aes_decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const
{
const uint8_t *skey = reinterpret_cast<const uint8_t*>(m_DK.data());
Expand Down
4 changes: 4 additions & 0 deletions src/lib/block/shacal2/shacal2_armv8/shacal2_arvm8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ namespace Botan {
Only encryption is supported since the inverse round function would
require a different instruction
*/
#if defined(BOTAN_BUILD_COMPILER_IS_CLANG)
BOTAN_FUNC_ISA("crypto")
#else
BOTAN_FUNC_ISA("+crypto")
#endif
void SHACAL2::armv8_encrypt_blocks(const uint8_t in[], uint8_t out[], size_t blocks) const
{
const uint32_t* input32 = reinterpret_cast<const uint32_t*>(in);
Expand Down
4 changes: 4 additions & 0 deletions src/lib/hash/sha1/sha1_armv8/sha1_armv8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ namespace Botan {
* SHA-1 using CPU instructions in ARMv8
*/
//static
#if defined(BOTAN_BUILD_COMPILER_IS_CLANG)
BOTAN_FUNC_ISA("crypto")
#else
BOTAN_FUNC_ISA("+crypto")
#endif
void SHA_1::sha1_armv8_compress_n(secure_vector<uint32_t>& digest, const uint8_t input8[], size_t blocks)
{
uint32x4_t ABCD;
Expand Down
4 changes: 4 additions & 0 deletions src/lib/hash/sha2_32/sha2_32_armv8/sha2_32_armv8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ namespace Botan {
* SHA-256 using CPU instructions in ARMv8
*/
//static
#if defined(BOTAN_BUILD_COMPILER_IS_CLANG)
BOTAN_FUNC_ISA("crypto")
#else
BOTAN_FUNC_ISA("+crypto")
#endif
void SHA_256::compress_digest_armv8(secure_vector<uint32_t>& digest, const uint8_t input8[], size_t blocks)
{
alignas(64) static const uint32_t K[] = {
Expand Down
15 changes: 12 additions & 3 deletions src/lib/utils/simd/simd_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,19 @@
#define BOTAN_CLMUL_ISA "pclmul"
#elif defined(BOTAN_SIMD_USE_NEON)
#if defined(BOTAN_TARGET_ARCH_IS_ARM64)
#define BOTAN_SIMD_ISA "+simd"
#define BOTAN_CLMUL_ISA "+crypto"
#if defined(BOTAN_BUILD_COMPILER_IS_CLANG)
#define BOTAN_SIMD_ISA "neon"
#define BOTAN_CLMUL_ISA "crypto"
#else
#define BOTAN_SIMD_ISA "+simd"
#define BOTAN_CLMUL_ISA "+crypto"
#endif
#else
#define BOTAN_SIMD_ISA "fpu=neon"
#if defined(BOTAN_BUILD_COMPILER_IS_CLANG)
#define BOTAN_SIMD_ISA "neon"
#else
#define BOTAN_SIMD_ISA "fpu=neon"
#endif
#endif
#define BOTAN_VPERM_ISA BOTAN_SIMD_ISA
#elif defined(BOTAN_SIMD_USE_ALTIVEC)
Expand Down