Skip to content

Commit

Permalink
Adjust AES hardware detection
Browse files Browse the repository at this point in the history
  • Loading branch information
utelle committed Dec 19, 2024
1 parent 51f8e00 commit 398558f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/aegis/aegis128l/aegis128l.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,21 +266,21 @@ aegis128l_pick_best_implementation(void)
{
implementation_128l = &aegis128l_soft_implementation;

#if defined(__aarch64__) || defined(_M_ARM64)
#if HAS_AEGIS_AES_HARDWARE == AEGIS_AES_HARDWARE_NEON
if (aegis_runtime_has_armcrypto()) {
implementation_128l = &aegis128l_armcrypto_implementation;
return 0;
}
#endif

#if defined(__x86_64__) || defined(_M_AMD64) || defined(__i386__) || defined(_M_IX86)
#if HAS_AEGIS_AES_HARDWARE == AEGIS_AES_HARDWARE_NI
if (aegis_runtime_has_aesni() && aegis_runtime_has_avx()) {
implementation_128l = &aegis128l_aesni_implementation;
return 0;
}
#endif

#if defined(__ALTIVEC__) && defined(__CRYPTO__)
#if HAS_AEGIS_AES_HARDWARE == AEGIS_AES_HARDWARE_ALTIVEC
if (aegis_runtime_has_altivec()) {
implementation_128l = &aegis128l_altivec_implementation;
return 0;
Expand Down
2 changes: 2 additions & 0 deletions src/aegis/common/aeshardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) && (defined(__x86_64__) || defined(__i386))
#define HAS_AEGIS_AES_HARDWARE AEGIS_AES_HARDWARE_NI
#elif defined(__aarch64__) || (defined(__arm__) && defined(__ARM_NEON))
#define HAS_AEGIS_AES_HARDWARE AEGIS_AES_HARDWARE_NEON
#endif


Expand Down

0 comments on commit 398558f

Please sign in to comment.