mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-05-02 08:43:20 +00:00
Apply @marning suggested SSE auto-detect to make builds easier on non-x86 platforms: aa2fd044cb
This commit is contained in:
parent
d7344871e6
commit
a9a390a930
@ -8,27 +8,6 @@ LIBS=
|
|||||||
include objects.mk
|
include objects.mk
|
||||||
OBJS+=osdep/BSDEthernetTap.o
|
OBJS+=osdep/BSDEthernetTap.o
|
||||||
|
|
||||||
# Enable SSE-optimized Salsa20 on x86 and x86_64 machines
|
|
||||||
MACHINE=$(shell uname -m)
|
|
||||||
ifeq ($(MACHINE),x86_64)
|
|
||||||
DEFS+=-DZT_SALSA20_SSE
|
|
||||||
endif
|
|
||||||
ifeq ($(MACHINE),amd64)
|
|
||||||
DEFS+=-DZT_SALSA20_SSE
|
|
||||||
endif
|
|
||||||
ifeq ($(MACHINE),i686)
|
|
||||||
DEFS+=-DZT_SALSA20_SSE
|
|
||||||
endif
|
|
||||||
ifeq ($(MACHINE),i586)
|
|
||||||
DEFS+=-DZT_SALSA20_SSE
|
|
||||||
endif
|
|
||||||
ifeq ($(MACHINE),i386)
|
|
||||||
DEFS+=-DZT_SALSA20_SSE
|
|
||||||
endif
|
|
||||||
ifeq ($(MACHINE),x86)
|
|
||||||
DEFS+=-DZT_SALSA20_SSE
|
|
||||||
endif
|
|
||||||
|
|
||||||
# "make official" is a shortcut for this
|
# "make official" is a shortcut for this
|
||||||
ifeq ($(ZT_OFFICIAL_RELEASE),1)
|
ifeq ($(ZT_OFFICIAL_RELEASE),1)
|
||||||
ZT_AUTO_UPDATE=1
|
ZT_AUTO_UPDATE=1
|
||||||
|
@ -9,27 +9,6 @@ LIBS=
|
|||||||
include objects.mk
|
include objects.mk
|
||||||
OBJS+=osdep/LinuxEthernetTap.o
|
OBJS+=osdep/LinuxEthernetTap.o
|
||||||
|
|
||||||
# Enable SSE-optimized Salsa20 on x86 and x86_64 machines
|
|
||||||
MACHINE=$(shell uname -m)
|
|
||||||
ifeq ($(MACHINE),x86_64)
|
|
||||||
DEFS+=-DZT_SALSA20_SSE
|
|
||||||
endif
|
|
||||||
ifeq ($(MACHINE),amd64)
|
|
||||||
DEFS+=-DZT_SALSA20_SSE
|
|
||||||
endif
|
|
||||||
ifeq ($(MACHINE),i686)
|
|
||||||
DEFS+=-DZT_SALSA20_SSE
|
|
||||||
endif
|
|
||||||
ifeq ($(MACHINE),i586)
|
|
||||||
DEFS+=-DZT_SALSA20_SSE
|
|
||||||
endif
|
|
||||||
ifeq ($(MACHINE),i386)
|
|
||||||
DEFS+=-DZT_SALSA20_SSE
|
|
||||||
endif
|
|
||||||
ifeq ($(MACHINE),x86)
|
|
||||||
DEFS+=-DZT_SALSA20_SSE
|
|
||||||
endif
|
|
||||||
|
|
||||||
# "make official" is a shortcut for this
|
# "make official" is a shortcut for this
|
||||||
ifeq ($(ZT_OFFICIAL_RELEASE),1)
|
ifeq ($(ZT_OFFICIAL_RELEASE),1)
|
||||||
ZT_AUTO_UPDATE=1
|
ZT_AUTO_UPDATE=1
|
||||||
|
@ -31,9 +31,6 @@ ifeq ($(ZT_ENABLE_NETWORK_CONTROLLER),1)
|
|||||||
OBJS+=controller/SqliteNetworkController.o
|
OBJS+=controller/SqliteNetworkController.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Enable SSE-optimized Salsa20 -- all Intel macs support SSE2
|
|
||||||
DEFS+=-DZT_SALSA20_SSE
|
|
||||||
|
|
||||||
# Debug mode -- dump trace output, build binary with -g
|
# Debug mode -- dump trace output, build binary with -g
|
||||||
ifeq ($(ZT_DEBUG),1)
|
ifeq ($(ZT_DEBUG),1)
|
||||||
DEFS+=-DZT_TRACE
|
DEFS+=-DZT_TRACE
|
||||||
|
@ -7,10 +7,16 @@
|
|||||||
#ifndef ZT_SALSA20_HPP
|
#ifndef ZT_SALSA20_HPP
|
||||||
#define ZT_SALSA20_HPP
|
#define ZT_SALSA20_HPP
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "Constants.hpp"
|
#include "Constants.hpp"
|
||||||
|
|
||||||
|
#if (!defined(ZT_SALSA20_SSE)) && (defined(__SSE2__) || defined(__WINDOWS__))
|
||||||
|
#define ZT_SALSA20_SSE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ZT_SALSA20_SSE
|
#ifdef ZT_SALSA20_SSE
|
||||||
#include <emmintrin.h>
|
#include <emmintrin.h>
|
||||||
#endif // ZT_SALSA20_SSE
|
#endif // ZT_SALSA20_SSE
|
||||||
|
@ -187,6 +187,12 @@ static int testCrypto()
|
|||||||
}
|
}
|
||||||
std::cout << "PASS" << std::endl;
|
std::cout << "PASS" << std::endl;
|
||||||
|
|
||||||
|
#ifdef ZT_SALSA20_SSE
|
||||||
|
std::cout << "[crypto] Salsa20 SSE: ENABLED" << std::endl;
|
||||||
|
#else
|
||||||
|
std::cout << "[crypto] Salsa20 SSE: DISABLED" << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
std::cout << "[crypto] Benchmarking Salsa20/12... "; std::cout.flush();
|
std::cout << "[crypto] Benchmarking Salsa20/12... "; std::cout.flush();
|
||||||
{
|
{
|
||||||
unsigned char *bb = (unsigned char *)::malloc(1234567);
|
unsigned char *bb = (unsigned char *)::malloc(1234567);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user