Skip to content

Commit 398558f

Browse files
committed
Adjust AES hardware detection
1 parent 51f8e00 commit 398558f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/aegis/aegis128l/aegis128l.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,21 +266,21 @@ aegis128l_pick_best_implementation(void)
266266
{
267267
implementation_128l = &aegis128l_soft_implementation;
268268

269-
#if defined(__aarch64__) || defined(_M_ARM64)
269+
#if HAS_AEGIS_AES_HARDWARE == AEGIS_AES_HARDWARE_NEON
270270
if (aegis_runtime_has_armcrypto()) {
271271
implementation_128l = &aegis128l_armcrypto_implementation;
272272
return 0;
273273
}
274274
#endif
275275

276-
#if defined(__x86_64__) || defined(_M_AMD64) || defined(__i386__) || defined(_M_IX86)
276+
#if HAS_AEGIS_AES_HARDWARE == AEGIS_AES_HARDWARE_NI
277277
if (aegis_runtime_has_aesni() && aegis_runtime_has_avx()) {
278278
implementation_128l = &aegis128l_aesni_implementation;
279279
return 0;
280280
}
281281
#endif
282282

283-
#if defined(__ALTIVEC__) && defined(__CRYPTO__)
283+
#if HAS_AEGIS_AES_HARDWARE == AEGIS_AES_HARDWARE_ALTIVEC
284284
if (aegis_runtime_has_altivec()) {
285285
implementation_128l = &aegis128l_altivec_implementation;
286286
return 0;

src/aegis/common/aeshardware.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636

3737
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) && (defined(__x86_64__) || defined(__i386))
3838
#define HAS_AEGIS_AES_HARDWARE AEGIS_AES_HARDWARE_NI
39+
#elif defined(__aarch64__) || (defined(__arm__) && defined(__ARM_NEON))
40+
#define HAS_AEGIS_AES_HARDWARE AEGIS_AES_HARDWARE_NEON
3941
#endif
4042

4143

0 commit comments

Comments
 (0)