diff options
author | cynecx <[email protected]> | 2016-01-27 21:12:19 +0100 |
---|---|---|
committer | cynecx <[email protected]> | 2016-01-27 21:12:19 +0100 |
commit | 6c2b155b02584de1023d27a748d3307a1bcd858a (patch) | |
tree | 1a63a256ffdd9ebbdfd01970a5402f005a9d59e2 /src | |
parent | f7cf7ba37fe57ea5996f7f05861f8648a024354f (diff) |
Blake2b: use rotate_right instead of a macro
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/hash/blake2/blake2b.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/lib/hash/blake2/blake2b.cpp b/src/lib/hash/blake2/blake2b.cpp index 14788bcd5..85d2ad1e7 100644 --- a/src/lib/hash/blake2/blake2b.cpp +++ b/src/lib/hash/blake2/blake2b.cpp @@ -9,6 +9,7 @@ #include <botan/exceptn.h> #include <botan/mem_ops.h> #include <botan/loadstor.h> +#include <botan/rotate.h> #include <algorithm> namespace Botan { @@ -85,18 +86,16 @@ void Blake2b::compress(bool lastblock) { v[14] ^= m_F[0]; v[15] ^= m_F[1]; -#define rotr64(w, c) (((w) >> c) ^ ((w) << (64 - c))) - #define G(r, i, a, b, c, d) \ do { \ a = a + b + m[blake2b_sigma[r][2 * i + 0]]; \ - d = rotr64(d ^ a, 32); \ + d = rotate_right<u64bit>(d ^ a, 32); \ c = c + d; \ - b = rotr64(b ^ c, 24); \ + b = rotate_right<u64bit>(b ^ c, 24); \ a = a + b + m[blake2b_sigma[r][2 * i + 1]]; \ - d = rotr64(d ^ a, 16); \ + d = rotate_right<u64bit>(d ^ a, 16); \ c = c + d; \ - b = rotr64(b ^ c, 63); \ + b = rotate_right<u64bit>(b ^ c, 63); \ } while(0) #define ROUND(r) \ @@ -130,7 +129,6 @@ void Blake2b::compress(bool lastblock) { #undef G #undef ROUND -#undef rotr64 } inline void Blake2b::increment_counter(const u64bit inc) { |