mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-01 15:00:54 +00:00
Ensure SSE is enabled for Salsa20 on x64
This commit is contained in:
parent
0db4151492
commit
063a16fcd6
@ -15,13 +15,12 @@
|
|||||||
#include "Constants.hpp"
|
#include "Constants.hpp"
|
||||||
#include "Utils.hpp"
|
#include "Utils.hpp"
|
||||||
|
|
||||||
#if (!defined(ZT_SALSA20_SSE)) && (defined(__SSE2__) || defined(__WINDOWS__))
|
#ifndef ZT_SALSA20_SSE
|
||||||
|
#if (defined(__amd64) || defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || defined(__AMD64) || defined(__AMD64__) || defined(_M_X64))
|
||||||
|
#include <emmintrin.h>
|
||||||
#define ZT_SALSA20_SSE 1
|
#define ZT_SALSA20_SSE 1
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#ifdef ZT_SALSA20_SSE
|
|
||||||
#include <emmintrin.h>
|
|
||||||
#endif // ZT_SALSA20_SSE
|
|
||||||
|
|
||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
|
|
||||||
@ -31,14 +30,14 @@ namespace ZeroTier {
|
|||||||
class Salsa20
|
class Salsa20
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline Salsa20() {}
|
ZT_ALWAYS_INLINE Salsa20() {}
|
||||||
inline ~Salsa20() { Utils::burn(&_state,sizeof(_state)); }
|
ZT_ALWAYS_INLINE ~Salsa20() { Utils::burn(&_state,sizeof(_state)); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param key 256-bit (32 byte) key
|
* @param key 256-bit (32 byte) key
|
||||||
* @param iv 64-bit initialization vector
|
* @param iv 64-bit initialization vector
|
||||||
*/
|
*/
|
||||||
inline Salsa20(const void *key,const void *iv) { init(key,iv); }
|
ZT_ALWAYS_INLINE Salsa20(const void *key,const void *iv) { init(key,iv); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize cipher
|
* Initialize cipher
|
||||||
|
Loading…
x
Reference in New Issue
Block a user