mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-18 02:40:13 +00:00
Add uint16_t key to Hashtable, and make Salsa20 zero its keyspace on destruction.
This commit is contained in:
parent
489e1a5b83
commit
719233617c
@ -382,7 +382,10 @@ private:
|
|||||||
}
|
}
|
||||||
static inline unsigned long _hc(const uint32_t i)
|
static inline unsigned long _hc(const uint32_t i)
|
||||||
{
|
{
|
||||||
// In the uint32_t case we use a simple multiplier for hashing to ensure coverage
|
return ((unsigned long)i * (unsigned long)0x9e3779b1);
|
||||||
|
}
|
||||||
|
static inline unsigned long _hc(const uint16_t i)
|
||||||
|
{
|
||||||
return ((unsigned long)i * (unsigned long)0x9e3779b1);
|
return ((unsigned long)i * (unsigned long)0x9e3779b1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "Constants.hpp"
|
#include "Constants.hpp"
|
||||||
|
#include "Utils.hpp"
|
||||||
|
|
||||||
#if (!defined(ZT_SALSA20_SSE)) && (defined(__SSE2__) || defined(__WINDOWS__))
|
#if (!defined(ZT_SALSA20_SSE)) && (defined(__SSE2__) || defined(__WINDOWS__))
|
||||||
#define ZT_SALSA20_SSE 1
|
#define ZT_SALSA20_SSE 1
|
||||||
@ -31,6 +32,8 @@ class Salsa20
|
|||||||
public:
|
public:
|
||||||
Salsa20() throw() {}
|
Salsa20() throw() {}
|
||||||
|
|
||||||
|
~Salsa20() { Utils::burn(&_state,sizeof(_state)); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param key Key bits
|
* @param key Key bits
|
||||||
* @param kbits Number of key bits: 128 or 256 (recommended)
|
* @param kbits Number of key bits: 128 or 256 (recommended)
|
||||||
|
Loading…
Reference in New Issue
Block a user