diff --git a/ssh.h b/ssh.h index 013f4eb2..c64053df 100644 --- a/ssh.h +++ b/ssh.h @@ -512,7 +512,7 @@ void SHATransform(word32 * digest, word32 * data); #ifdef _FORCE_SHA_NI # define COMPILER_SUPPORTS_SHA_NI #elif defined(__clang__) -# if (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 8)) && (defined(__x86_64__) || defined(__i386)) +# if __has_attribute(target) && __has_include() && (defined(__x86_64__) || defined(__i386)) # define COMPILER_SUPPORTS_SHA_NI # endif #elif defined(__GNUC__) @@ -529,14 +529,6 @@ void SHATransform(word32 * digest, word32 * data); # undef COMPILER_SUPPORTS_SHA_NI #endif -#if defined(__clang__) -# if !__has_attribute(target) -/* If clang is old enough not to support __attribute__((target(...))) - * as used below, then we can't use this code after all. */ -# undef COMPILER_SUPPORTS_SHA_NI -# endif -#endif - int random_byte(void); void random_add_noise(void *noise, int length); void random_add_heavynoise(void *noise, int length); diff --git a/sshaes.c b/sshaes.c index 50879913..7b9eacb7 100644 --- a/sshaes.c +++ b/sshaes.c @@ -1134,7 +1134,7 @@ const struct ssh2_ciphers ssh2_aes = { #ifdef _FORCE_AES_NI # define COMPILER_SUPPORTS_AES_NI #elif defined(__clang__) -# if (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 8)) && (defined(__x86_64__) || defined(__i386)) +# if __has_attribute(target) && __has_include() && (defined(__x86_64__) || defined(__i386)) # define COMPILER_SUPPORTS_AES_NI # endif #elif defined(__GNUC__) @@ -1151,14 +1151,6 @@ const struct ssh2_ciphers ssh2_aes = { # undef COMPILER_SUPPORTS_AES_NI #endif -#if defined(__clang__) -# if !__has_attribute(target) -/* If clang is old enough not to support __attribute__((target(...))) - * as used below, then we can't use this code after all. */ -# undef COMPILER_SUPPORTS_AES_NI -# endif -#endif - #ifdef COMPILER_SUPPORTS_AES_NI /*