Apple "fat binaries" are back!

This commit is contained in:
Adam Ierymenko 2020-11-16 16:30:15 -05:00
parent 6b67cb0e2a
commit 31d8758ad9
No known key found for this signature in database
GPG Key ID: C8877CF2D7A5D7F3
3 changed files with 12 additions and 7 deletions

View File

@ -3,7 +3,8 @@ CXX=clang++
INCLUDES=
DEFS=
LIBS=
ARCH_FLAGS=-msse -msse2 -mssse3 -msse4 -msse4.1 -maes -mpclmul
ARCH_FLAGS=-msse -msse2 -arch x86_64 -arch arm64e
CODESIGN=echo
PRODUCTSIGN=echo
CODESIGN_APP_CERT=
@ -91,7 +92,7 @@ CXXFLAGS=$(CFLAGS) -std=c++11 -stdlib=libc++
all: one macui
ext/x64-salsa2012-asm/salsa2012.o:
$(CC) $(CFLAGS) -c ext/x64-salsa2012-asm/salsa2012.s -o ext/x64-salsa2012-asm/salsa2012.o
as -o ext/x64-salsa2012-asm/salsa2012.o ext/x64-salsa2012-asm/salsa2012.s
mac-agent: FORCE
$(CC) -Ofast -o MacEthernetTapAgent osdep/MacEthernetTapAgent.c

View File

@ -19,7 +19,7 @@
#include "Packet.hpp"
#ifdef ZT_USE_X64_ASM_SALSA2012
#if defined(ZT_USE_X64_ASM_SALSA2012) && defined(ZT_ARCH_X64)
#include "../ext/x64-salsa2012-asm/salsa2012.h"
#endif
#ifdef ZT_USE_ARM32_NEON_ASM_SALSA2012
@ -42,7 +42,7 @@ namespace ZeroTier {
/* Set up macros for fast single-pass ASM Salsa20/12 crypto, if we have it */
// x64 SSE crypto
#ifdef ZT_USE_X64_ASM_SALSA2012
#if defined(ZT_USE_X64_ASM_SALSA2012) && defined(ZT_ARCH_X64)
#define ZT_HAS_FAST_CRYPTO() (true)
#define ZT_FAST_SINGLE_PASS_SALSA2012(b,l,n,k) zt_salsa2012_amd64_xmm6(reinterpret_cast<unsigned char *>(b),(l),reinterpret_cast<const unsigned char *>(n),reinterpret_cast<const unsigned char *>(k))
#endif
@ -880,7 +880,7 @@ void Packet::armor(const void *key,bool encryptPayload,const AES aesKeys[2])
{
uint8_t *const data = reinterpret_cast<uint8_t *>(unsafeData());
if ((aesKeys) && (encryptPayload)) {
char tmp0[16],tmp1[16];
//char tmp0[16],tmp1[16];
setCipher(ZT_PROTO_CIPHER_SUITE__AES_GMAC_SIV);
uint8_t *const payload = data + ZT_PACKET_IDX_VERB;

View File

@ -96,13 +96,16 @@ const char Utils::HEXCHARS[16] = { '0','1','2','3','4','5','6','7','8','9','a','
#ifdef ZT_ARCH_ARM_HAS_NEON
Utils::ARMCapabilities::ARMCapabilities() noexcept
{
#if TARGET_OS_IPHONE
#ifdef __APPLE__
this->aes = true;
this->crc32 = true;
this->pmull = true;
this->sha1 = true;
this->sha2 = true;
#else
#ifdef HWCAP2_AES
if (sizeof(void *) == 4) {
const long hwcaps2 = getauxval(AT_HWCAP2);
@ -122,7 +125,8 @@ Utils::ARMCapabilities::ARMCapabilities() noexcept
#ifdef HWCAP2_AES
}
#endif
#endif // TARGET_OS_IPHONE
#endif // __APPLE__
}
const Utils::ARMCapabilities Utils::ARMCAP;