mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 08:30:46 +00: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
 | 
			
		||||
 | 
			
		||||
ifeq ($(USE_AESNI),yes)
 | 
			
		||||
#check if AES-NI is supported by CPU
 | 
			
		||||
ifneq ($(shell $(GREP) -c aes /proc/cpuinfo),0)
 | 
			
		||||
	machine := $(shell uname -m)
 | 
			
		||||
	ifeq ($(machine), aarch64)
 | 
			
		||||
		CXXFLAGS += -DARM64AES
 | 
			
		||||
	else
 | 
			
		||||
ifneq (, $(findstring aarch64, $(SYS)))
 | 
			
		||||
	CXXFLAGS += -DARM64AES
 | 
			
		||||
else
 | 
			
		||||
	ifeq (, $(findstring arm, $(SYS))) # no arm in dumpmachine
 | 
			
		||||
	# check if AES-NI is supported by CPU
 | 
			
		||||
	ifeq ($(shell $(GREP) -c aes /proc/cpuinfo),0)
 | 
			
		||||
		CPU_FLAGS += -maes
 | 
			
		||||
	endif
 | 
			
		||||
	endif
 | 
			
		||||
endif
 | 
			
		||||
endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -631,10 +631,6 @@ namespace crypto
 | 
			
		|||
	static const uint64_t ipads[] = { IPAD, IPAD, IPAD, IPAD };
 | 
			
		||||
	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)
 | 
			
		||||
	// key is 32 bytes
 | 
			
		||||
	// digest is 16 bytes
 | 
			
		||||
| 
						 | 
				
			
			@ -642,6 +638,9 @@ namespace crypto
 | 
			
		|||
	{
 | 
			
		||||
		uint64_t buf[256];
 | 
			
		||||
		uint64_t hash[12]; // 96 bytes
 | 
			
		||||
#if defined(__x86_64__) || defined(__i386__)
 | 
			
		||||
#pragma GCC push_options
 | 
			
		||||
#pragma GCC target("avx")
 | 
			
		||||
		if(i2p::cpu::avx)
 | 
			
		||||
		{
 | 
			
		||||
			__asm__
 | 
			
		||||
| 
						 | 
				
			
			@ -664,6 +663,8 @@ namespace crypto
 | 
			
		|||
					);
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
#pragma GCC pop_options
 | 
			
		||||
#endif
 | 
			
		||||
		{
 | 
			
		||||
			// ikeypad
 | 
			
		||||
			buf[0] = key.GetLL ()[0] ^ IPAD;
 | 
			
		||||
| 
						 | 
				
			
			@ -695,9 +696,6 @@ namespace crypto
 | 
			
		|||
		// calculate digest
 | 
			
		||||
		MD5((uint8_t *)hash, 96, digest);
 | 
			
		||||
	}
 | 
			
		||||
#if defined(__x86_64__) || defined(__i386__)
 | 
			
		||||
#pragma GCC pop_options
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// AES
 | 
			
		||||
#ifdef __AES__
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -825,13 +825,12 @@ namespace data
 | 
			
		|||
		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 m;
 | 
			
		||||
#if defined(__x86_64__) || defined(__i386__)
 | 
			
		||||
#pragma GCC push_options
 | 
			
		||||
#pragma GCC target("avx")
 | 
			
		||||
		if(i2p::cpu::avx)
 | 
			
		||||
		{
 | 
			
		||||
			__asm__
 | 
			
		||||
| 
						 | 
				
			
			@ -846,6 +845,8 @@ namespace data
 | 
			
		|||
			);
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
#pragma GCC pop_options
 | 
			
		||||
#endif
 | 
			
		||||
		{
 | 
			
		||||
			const uint64_t * hash1 = key1.GetLL (), * hash2 = key2.GetLL ();
 | 
			
		||||
			m.metric_ll[0] = hash1[0] ^ hash2[0];
 | 
			
		||||
| 
						 | 
				
			
			@ -856,9 +857,5 @@ namespace data
 | 
			
		|||
 | 
			
		||||
		return m;
 | 
			
		||||
	}
 | 
			
		||||
#if defined(__x86_64__) || defined(__i386__)
 | 
			
		||||
#pragma GCC pop_options
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue