diff options
author | Jack Lloyd <[email protected]> | 2016-12-11 15:28:38 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-12-18 16:48:24 -0500 |
commit | f3cb3edb512bdcab498d825886c3366c341b3f78 (patch) | |
tree | 645c73ec295a5a34f25d99903b6d9fa9751e86d3 /src/lib/hash/sha1 | |
parent | c1dd21253c1f3188ff45d3ad47698efd08235ae8 (diff) |
Convert to using standard uintN_t integer types
Renames a couple of functions for somewhat better name consistency,
eg make_u32bit becomes make_uint32. The old typedefs remain for now
since probably lots of application code uses them.
Diffstat (limited to 'src/lib/hash/sha1')
-rw-r--r-- | src/lib/hash/sha1/sha160.cpp | 14 | ||||
-rw-r--r-- | src/lib/hash/sha1/sha160.h | 12 | ||||
-rw-r--r-- | src/lib/hash/sha1/sha1_sse2/sha1_sse2.cpp | 14 |
3 files changed, 20 insertions, 20 deletions
diff --git a/src/lib/hash/sha1/sha160.cpp b/src/lib/hash/sha1/sha160.cpp index 87738fb00..735789cab 100644 --- a/src/lib/hash/sha1/sha160.cpp +++ b/src/lib/hash/sha1/sha160.cpp @@ -17,7 +17,7 @@ namespace { /* * SHA-160 F1 Function */ -inline void F1(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) +inline void F1(uint32_t A, uint32_t& B, uint32_t C, uint32_t D, uint32_t& E, uint32_t msg) { E += (D ^ (B & (C ^ D))) + msg + 0x5A827999 + rotate_left(A, 5); B = rotate_left(B, 30); @@ -26,7 +26,7 @@ inline void F1(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) /* * SHA-160 F2 Function */ -inline void F2(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) +inline void F2(uint32_t A, uint32_t& B, uint32_t C, uint32_t D, uint32_t& E, uint32_t msg) { E += (B ^ C ^ D) + msg + 0x6ED9EBA1 + rotate_left(A, 5); B = rotate_left(B, 30); @@ -35,7 +35,7 @@ inline void F2(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) /* * SHA-160 F3 Function */ -inline void F3(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) +inline void F3(uint32_t A, uint32_t& B, uint32_t C, uint32_t D, uint32_t& E, uint32_t msg) { E += ((B & C) | ((B | C) & D)) + msg + 0x8F1BBCDC + rotate_left(A, 5); B = rotate_left(B, 30); @@ -44,7 +44,7 @@ inline void F3(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) /* * SHA-160 F4 Function */ -inline void F4(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) +inline void F4(uint32_t A, uint32_t& B, uint32_t C, uint32_t D, uint32_t& E, uint32_t msg) { E += (B ^ C ^ D) + msg + 0xCA62C1D6 + rotate_left(A, 5); B = rotate_left(B, 30); @@ -57,7 +57,7 @@ inline void F4(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) /* * SHA-160 Compression Function */ -void SHA_160::compress_n(const byte input[], size_t blocks) +void SHA_160::compress_n(const uint8_t input[], size_t blocks) { using namespace SHA1_F; @@ -69,7 +69,7 @@ void SHA_160::compress_n(const byte input[], size_t blocks) #endif - u32bit A = m_digest[0], B = m_digest[1], C = m_digest[2], + uint32_t A = m_digest[0], B = m_digest[1], C = m_digest[2], D = m_digest[3], E = m_digest[4]; m_W.resize(80); @@ -147,7 +147,7 @@ void SHA_160::compress_n(const byte input[], size_t blocks) /* * Copy out the digest */ -void SHA_160::copy_out(byte output[]) +void SHA_160::copy_out(uint8_t output[]) { copy_out_vec_be(output, output_length(), m_digest); } diff --git a/src/lib/hash/sha1/sha160.h b/src/lib/hash/sha1/sha160.h index d7860834f..7ba7257af 100644 --- a/src/lib/hash/sha1/sha160.h +++ b/src/lib/hash/sha1/sha160.h @@ -30,26 +30,26 @@ class BOTAN_DLL SHA_160 final : public MDx_HashFunction } private: - void compress_n(const byte[], size_t blocks) override; + void compress_n(const uint8_t[], size_t blocks) override; #if defined(BOTAN_HAS_SHA1_SSE2) - static void sse2_compress_n(secure_vector<u32bit>& digest, - const byte blocks[], + static void sse2_compress_n(secure_vector<uint32_t>& digest, + const uint8_t blocks[], size_t block_count); #endif - void copy_out(byte[]) override; + void copy_out(uint8_t[]) override; /** * The digest value */ - secure_vector<u32bit> m_digest; + secure_vector<uint32_t> m_digest; /** * The message buffer */ - secure_vector<u32bit> m_W; + secure_vector<uint32_t> m_W; }; typedef SHA_160 SHA_1; diff --git a/src/lib/hash/sha1/sha1_sse2/sha1_sse2.cpp b/src/lib/hash/sha1/sha1_sse2/sha1_sse2.cpp index 0f88bb4c2..8c7785051 100644 --- a/src/lib/hash/sha1/sha1_sse2/sha1_sse2.cpp +++ b/src/lib/hash/sha1/sha1_sse2/sha1_sse2.cpp @@ -111,7 +111,7 @@ W0 = W[t]..W[t+3] /* * SHA-160 F1 Function */ -inline void F1(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) +inline void F1(uint32_t A, uint32_t& B, uint32_t C, uint32_t D, uint32_t& E, uint32_t msg) { E += (D ^ (B & (C ^ D))) + msg + rotate_left(A, 5); B = rotate_left(B, 30); @@ -120,7 +120,7 @@ inline void F1(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) /* * SHA-160 F2 Function */ -inline void F2(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) +inline void F2(uint32_t A, uint32_t& B, uint32_t C, uint32_t D, uint32_t& E, uint32_t msg) { E += (B ^ C ^ D) + msg + rotate_left(A, 5); B = rotate_left(B, 30); @@ -129,7 +129,7 @@ inline void F2(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) /* * SHA-160 F3 Function */ -inline void F3(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) +inline void F3(uint32_t A, uint32_t& B, uint32_t C, uint32_t D, uint32_t& E, uint32_t msg) { E += ((B & C) | ((B | C) & D)) + msg + rotate_left(A, 5); B = rotate_left(B, 30); @@ -138,7 +138,7 @@ inline void F3(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) /* * SHA-160 F4 Function */ -inline void F4(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) +inline void F4(uint32_t A, uint32_t& B, uint32_t C, uint32_t D, uint32_t& E, uint32_t msg) { E += (B ^ C ^ D) + msg + rotate_left(A, 5); B = rotate_left(B, 30); @@ -153,7 +153,7 @@ inline void F4(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) */ //static BOTAN_FUNC_ISA("sse2") -void SHA_160::sse2_compress_n(secure_vector<uint32_t>& digest, const byte input[], size_t blocks) +void SHA_160::sse2_compress_n(secure_vector<uint32_t>& digest, const uint8_t input[], size_t blocks) { using namespace SHA1_SSE2_F; @@ -162,7 +162,7 @@ void SHA_160::sse2_compress_n(secure_vector<uint32_t>& digest, const byte input[ const __m128i K40_59 = _mm_set1_epi32(0x8F1BBCDC); const __m128i K60_79 = _mm_set1_epi32(0xCA62C1D6); - u32bit A = digest[0], + uint32_t A = digest[0], B = digest[1], C = digest[2], D = digest[3], @@ -173,7 +173,7 @@ void SHA_160::sse2_compress_n(secure_vector<uint32_t>& digest, const byte input[ for(size_t i = 0; i != blocks; ++i) { union v4si { - u32bit u32[4]; + uint32_t u32[4]; __m128i u128; }; |