diff options
author | Jack Lloyd <[email protected]> | 2017-05-20 11:18:49 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-05-20 11:18:49 -0400 |
commit | a710540c20081fcef39c7402f9b7cc54aacbfc63 (patch) | |
tree | 99a040f93d17fad863f709e36889ec361684c762 /src/lib/hash | |
parent | 40c3654ffd631924e8517ab12a734b7715de7b6d (diff) |
Change SHA-2 to use a single convention for CPU extn
Diffstat (limited to 'src/lib/hash')
-rw-r--r-- | src/lib/hash/sha2_32/sha2_32.cpp | 2 | ||||
-rw-r--r-- | src/lib/hash/sha2_32/sha2_32.h | 13 | ||||
-rw-r--r-- | src/lib/hash/sha2_32/sha2_32_x86/sha2_32_x86.cpp | 2 |
3 files changed, 8 insertions, 9 deletions
diff --git a/src/lib/hash/sha2_32/sha2_32.cpp b/src/lib/hash/sha2_32/sha2_32.cpp index 77e930699..ab6903fa7 100644 --- a/src/lib/hash/sha2_32/sha2_32.cpp +++ b/src/lib/hash/sha2_32/sha2_32.cpp @@ -37,7 +37,7 @@ void SHA_256::compress_digest(secure_vector<uint32_t>& digest, #if defined(BOTAN_HAS_SHA2_32_X86) if(CPUID::has_intel_sha()) { - return sha2_compress_x86(digest.data(), input, blocks); + return SHA_256::compress_digest_x86(digest, input, blocks); } #endif diff --git a/src/lib/hash/sha2_32/sha2_32.h b/src/lib/hash/sha2_32/sha2_32.h index c65ae449d..ecf2e0ece 100644 --- a/src/lib/hash/sha2_32/sha2_32.h +++ b/src/lib/hash/sha2_32/sha2_32.h @@ -64,19 +64,18 @@ class BOTAN_DLL SHA_256 final : public MDx_HashFunction size_t blocks); #endif +#if defined(BOTAN_HAS_SHA2_32_X86) + static void compress_digest_x86(secure_vector<uint32_t>& digest, + const uint8_t input[], + size_t blocks); +#endif + void compress_n(const uint8_t[], size_t blocks) override; void copy_out(uint8_t[]) override; secure_vector<uint32_t> m_digest; }; -#if defined(BOTAN_HAS_SHA2_32_X86) -/* -* SHA-256 compression using Goldmont x86 extensions. Not for public consumption. -*/ -void sha2_compress_x86(uint32_t digest[8], const uint8_t input[], size_t blocks); -#endif - } #endif diff --git a/src/lib/hash/sha2_32/sha2_32_x86/sha2_32_x86.cpp b/src/lib/hash/sha2_32/sha2_32_x86/sha2_32_x86.cpp index 8f90ec5a9..aadb48710 100644 --- a/src/lib/hash/sha2_32/sha2_32_x86/sha2_32_x86.cpp +++ b/src/lib/hash/sha2_32/sha2_32_x86/sha2_32_x86.cpp @@ -12,7 +12,7 @@ namespace Botan { // called from sha2_32.cpp -void sha2_compress_x86(uint32_t digest[8], const uint8_t input[], size_t blocks) +void SHA_256::compress_digest_x86(secure_vector<uint32_t>& digest, const uint8_t input[], size_t blocks) { __m128i STATE0, STATE1; __m128i MSG, TMP, MASK; |