From 1a093ca23da0481e4509dc1c4bf324118adf64b5 Mon Sep 17 00:00:00 2001 From: lloyd Date: Fri, 3 Jun 2011 13:05:18 +0000 Subject: Fix building with --via-amalgamation; it wouldn't generate the amalgamation properly, but would happen to work if a previously written amalgamation was around. Also make changes allowing using the SIMD optimized versions of SHA-1 and Serpent to be used in the amalgamation. --- src/hash/sha1/sha160.cpp | 8 +++++++- src/hash/sha1_sse2/sha1_sse2.cpp | 11 ++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src/hash') diff --git a/src/hash/sha1/sha160.cpp b/src/hash/sha1/sha160.cpp index 7a42ca867..f5daaadb2 100644 --- a/src/hash/sha1/sha160.cpp +++ b/src/hash/sha1/sha160.cpp @@ -1,6 +1,6 @@ /* * SHA-160 -* (C) 1999-2008 Jack Lloyd +* (C) 1999-2008,2011 Jack Lloyd * * Distributed under the terms of the Botan license */ @@ -11,6 +11,8 @@ namespace Botan { +namespace SHA1_F { + namespace { /* @@ -51,11 +53,15 @@ 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) { + using namespace SHA1_F; + u32bit A = digest[0], B = digest[1], C = digest[2], D = digest[3], E = digest[4]; diff --git a/src/hash/sha1_sse2/sha1_sse2.cpp b/src/hash/sha1_sse2/sha1_sse2.cpp index e890967c6..f96afd9ce 100644 --- a/src/hash/sha1_sse2/sha1_sse2.cpp +++ b/src/hash/sha1_sse2/sha1_sse2.cpp @@ -1,6 +1,6 @@ /* * SHA-1 using SSE2 -* (C) 2009-2010 Jack Lloyd +* (C) 2009-2011 Jack Lloyd * * Distributed under the terms of the Botan license * @@ -14,6 +14,8 @@ namespace Botan { +namespace SHA1_SSE2_F { + namespace { /* @@ -146,11 +148,15 @@ inline void F4(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) } +} + /* * SHA-160 Compression Function using SSE for message expansion */ void SHA_160_SSE2::compress_n(const byte input_bytes[], size_t blocks) { + using namespace SHA1_SSE2_F; + const __m128i K00_19 = _mm_set1_epi32(0x5A827999); const __m128i K20_39 = _mm_set1_epi32(0x6ED9EBA1); const __m128i K40_59 = _mm_set1_epi32(0x8F1BBCDC); @@ -323,4 +329,7 @@ void SHA_160_SSE2::compress_n(const byte input_bytes[], size_t blocks) #undef GET_P_32 } +#undef prep00_15 +#undef prep + } -- cgit v1.2.3