mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-21 22:46:54 +02:00
Add separate accelerated() function for AES::GMAC.
This commit is contained in:
parent
7efaab2af1
commit
3b773da8bc
3 changed files with 18 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
16
core/AES.hpp
16
core/AES.hpp
|
@ -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;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
#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);
|
||||
|
|
Loading…
Add table
Reference in a new issue