@@ -47,7 +47,7 @@ ZT_INLINE uint8x16_t s_clmul_armneon_crypto(uint8x16_t a8, const uint8x16_t y, c
return vrbitq_u8(veorq_u8(r0, t0));
}
-#endif
+#endif // ZT_AES_NEON
#ifdef ZT_HAVE_UINT128
@@ -149,6 +149,22 @@ public:
friend class GMACSIVDecryptor;
public:
+ /**
+ * @return True if this system has hardware GMAC acceleration
+ */
+ static ZT_INLINE bool accelerated()
+ {
+#ifdef ZT_AES_AESNI
+ return Utils::CPUID.aes;
+#else
+#ifdef ZT_AES_NEON
+ return Utils::ARMCAP.pmull;
+ return false;
+#endif
+ }
+
/**
* Create a new instance of GMAC (must be initialized with init() before use)
*
@@ -1115,7 +1115,7 @@ extern "C" const char *ZTT_crypto()
{
uint8_t tag[16];
- ZT_T_PRINTF("[crypto] Testing AES-GMAC (hardware acceleration: %s)... ", AES::accelerated() ? "enabled" : "disabled");
+ ZT_T_PRINTF("[crypto] Testing AES-GMAC (hardware acceleration: %s)... ", AES::GMAC::accelerated() ? "enabled" : "disabled");
AES aes(AES_GMAC_VECTOR_0_KEY);
AES::GMAC gmac(aes);