From 719233617ca9f26c3309d608a38aadf701bb5648 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 14 Oct 2015 10:14:07 -0700 Subject: Add uint16_t key to Hashtable, and make Salsa20 zero its keyspace on destruction. --- node/Hashtable.hpp | 5 ++++- node/Salsa20.hpp | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'node') diff --git a/node/Hashtable.hpp b/node/Hashtable.hpp index beef1468..1d8d9e5d 100644 --- a/node/Hashtable.hpp +++ b/node/Hashtable.hpp @@ -382,7 +382,10 @@ private: } 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); } diff --git a/node/Salsa20.hpp b/node/Salsa20.hpp index a2082bea..7e4c1e53 100644 --- a/node/Salsa20.hpp +++ b/node/Salsa20.hpp @@ -12,6 +12,7 @@ #include #include "Constants.hpp" +#include "Utils.hpp" #if (!defined(ZT_SALSA20_SSE)) && (defined(__SSE2__) || defined(__WINDOWS__)) #define ZT_SALSA20_SSE 1 @@ -31,6 +32,8 @@ class Salsa20 public: Salsa20() throw() {} + ~Salsa20() { Utils::burn(&_state,sizeof(_state)); } + /** * @param key Key bits * @param kbits Number of key bits: 128 or 256 (recommended) -- cgit v1.2.3