mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
fix compilation on arm64
This commit is contained in:
parent
6f91e3988c
commit
f588af834d
3 changed files with 17 additions and 21 deletions
|
@ -58,13 +58,14 @@ endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(USE_AESNI),yes)
|
ifeq ($(USE_AESNI),yes)
|
||||||
#check if AES-NI is supported by CPU
|
ifneq (, $(findstring aarch64, $(SYS)))
|
||||||
ifneq ($(shell $(GREP) -c aes /proc/cpuinfo),0)
|
CXXFLAGS += -DARM64AES
|
||||||
machine := $(shell uname -m)
|
else
|
||||||
ifeq ($(machine), aarch64)
|
ifeq (, $(findstring arm, $(SYS))) # no arm in dumpmachine
|
||||||
CXXFLAGS += -DARM64AES
|
# check if AES-NI is supported by CPU
|
||||||
else
|
ifeq ($(shell $(GREP) -c aes /proc/cpuinfo),0)
|
||||||
CPU_FLAGS += -maes
|
CPU_FLAGS += -maes
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -631,10 +631,6 @@ namespace crypto
|
||||||
static const uint64_t ipads[] = { IPAD, IPAD, IPAD, IPAD };
|
static const uint64_t ipads[] = { IPAD, IPAD, IPAD, IPAD };
|
||||||
static const uint64_t opads[] = { OPAD, OPAD, OPAD, OPAD };
|
static const uint64_t opads[] = { OPAD, OPAD, OPAD, OPAD };
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
|
||||||
#pragma GCC push_options
|
|
||||||
#pragma GCC target("avx")
|
|
||||||
#endif
|
|
||||||
void HMACMD5Digest (uint8_t * msg, size_t len, const MACKey& key, uint8_t * digest)
|
void HMACMD5Digest (uint8_t * msg, size_t len, const MACKey& key, uint8_t * digest)
|
||||||
// key is 32 bytes
|
// key is 32 bytes
|
||||||
// digest is 16 bytes
|
// digest is 16 bytes
|
||||||
|
@ -642,6 +638,9 @@ namespace crypto
|
||||||
{
|
{
|
||||||
uint64_t buf[256];
|
uint64_t buf[256];
|
||||||
uint64_t hash[12]; // 96 bytes
|
uint64_t hash[12]; // 96 bytes
|
||||||
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
|
#pragma GCC push_options
|
||||||
|
#pragma GCC target("avx")
|
||||||
if(i2p::cpu::avx)
|
if(i2p::cpu::avx)
|
||||||
{
|
{
|
||||||
__asm__
|
__asm__
|
||||||
|
@ -664,6 +663,8 @@ namespace crypto
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#pragma GCC pop_options
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// ikeypad
|
// ikeypad
|
||||||
buf[0] = key.GetLL ()[0] ^ IPAD;
|
buf[0] = key.GetLL ()[0] ^ IPAD;
|
||||||
|
@ -695,9 +696,6 @@ namespace crypto
|
||||||
// calculate digest
|
// calculate digest
|
||||||
MD5((uint8_t *)hash, 96, digest);
|
MD5((uint8_t *)hash, 96, digest);
|
||||||
}
|
}
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
|
||||||
#pragma GCC pop_options
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// AES
|
// AES
|
||||||
#ifdef __AES__
|
#ifdef __AES__
|
||||||
|
|
|
@ -825,13 +825,12 @@ namespace data
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
|
||||||
#pragma GCC push_options
|
|
||||||
#pragma GCC target("avx")
|
|
||||||
#endif
|
|
||||||
XORMetric operator^(const IdentHash& key1, const IdentHash& key2)
|
XORMetric operator^(const IdentHash& key1, const IdentHash& key2)
|
||||||
{
|
{
|
||||||
XORMetric m;
|
XORMetric m;
|
||||||
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
|
#pragma GCC push_options
|
||||||
|
#pragma GCC target("avx")
|
||||||
if(i2p::cpu::avx)
|
if(i2p::cpu::avx)
|
||||||
{
|
{
|
||||||
__asm__
|
__asm__
|
||||||
|
@ -846,6 +845,8 @@ namespace data
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#pragma GCC pop_options
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
const uint64_t * hash1 = key1.GetLL (), * hash2 = key2.GetLL ();
|
const uint64_t * hash1 = key1.GetLL (), * hash2 = key2.GetLL ();
|
||||||
m.metric_ll[0] = hash1[0] ^ hash2[0];
|
m.metric_ll[0] = hash1[0] ^ hash2[0];
|
||||||
|
@ -856,9 +857,5 @@ namespace data
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
|
||||||
#pragma GCC pop_options
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue