diff options
author | Jack Lloyd <[email protected]> | 2019-06-15 10:59:16 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-06-15 11:17:07 -0400 |
commit | 4e82b87cf944a9e709030e2b7c02a7ac0d368013 (patch) | |
tree | 1abfd3d9afd18b2c0cb898a96be6072d85ec44e6 /src/lib/stream | |
parent | d10292e88c272921c3866135a8ddff14601ee2de (diff) |
Add a compatability shim for libsodium
Not complete, just trying to hit the most commonly used APIs plus the
ones that are easy to do.
Diffstat (limited to 'src/lib/stream')
-rw-r--r-- | src/lib/stream/salsa20/salsa20.cpp | 7 | ||||
-rw-r--r-- | src/lib/stream/salsa20/salsa20.h | 1 |
2 files changed, 3 insertions, 5 deletions
diff --git a/src/lib/stream/salsa20/salsa20.cpp b/src/lib/stream/salsa20/salsa20.cpp index 407a3183e..1e30391d2 100644 --- a/src/lib/stream/salsa20/salsa20.cpp +++ b/src/lib/stream/salsa20/salsa20.cpp @@ -12,8 +12,6 @@ namespace Botan { -namespace { - #define SALSA20_QUARTER_ROUND(x1, x2, x3, x4) \ do { \ x2 ^= rotl<7>(x1 + x4); \ @@ -25,7 +23,8 @@ namespace { /* * Generate HSalsa20 cipher stream (for XSalsa20 IV setup) */ -void hsalsa20(uint32_t output[8], const uint32_t input[16]) +//static +void Salsa20::hsalsa20(uint32_t output[8], const uint32_t input[16]) { uint32_t x00 = input[ 0], x01 = input[ 1], x02 = input[ 2], x03 = input[ 3], x04 = input[ 4], x05 = input[ 5], x06 = input[ 6], x07 = input[ 7], @@ -55,8 +54,6 @@ void hsalsa20(uint32_t output[8], const uint32_t input[16]) output[7] = x09; } -} - /* * Generate Salsa20 cipher stream */ diff --git a/src/lib/stream/salsa20/salsa20.h b/src/lib/stream/salsa20/salsa20.h index 60143f8e0..0870c9fd2 100644 --- a/src/lib/stream/salsa20/salsa20.h +++ b/src/lib/stream/salsa20/salsa20.h @@ -33,6 +33,7 @@ class BOTAN_PUBLIC_API(2,0) Salsa20 final : public StreamCipher StreamCipher* clone() const override; static void salsa_core(uint8_t output[64], const uint32_t input[16], size_t rounds); + static void hsalsa20(uint32_t output[8], const uint32_t input[16]); void seek(uint64_t offset) override; private: |