summaryrefslogtreecommitdiff
path: root/sha.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2016-09-13 20:44:14 -0400
committerJeffrey Walton <noloader@gmail.com>2016-09-13 20:44:14 -0400
commitff67abdec52b6412842c05dded4c3e2ba203d817 (patch)
treec20ef57ef1e1932f87d636aa68561aee560fbb01 /sha.cpp
parentdf7e07e75e302f34d8968f65ab8126333b006ae5 (diff)
downloadcryptopp-git-ff67abdec52b6412842c05dded4c3e2ba203d817.tar.gz
Add virtual dtor for IteratedHash and ClonableImpl due to non-trivial data members
Solaris is showing unusual signs with SunCC 5.13 and 5.14. One user is experiencing a SIGBUS in SHA512::Transform due to data alignment of 'data', which was only 2-byte aligned. The project experienced an exception "Coneable not implemented" during the hashing test after building with Cmake. Its not clear how much Cmake influenced the project's results.
Diffstat (limited to 'sha.cpp')
-rw-r--r--sha.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/sha.cpp b/sha.cpp
index bbde30a3..4e847501 100644
--- a/sha.cpp
+++ b/sha.cpp
@@ -643,7 +643,7 @@ void SHA512::InitState(HashWordType *state)
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32)
CRYPTOPP_ALIGN_DATA(16) static const word64 SHA512_K[80] CRYPTOPP_SECTION_ALIGN16 = {
#else
-static const word64 SHA512_K[80] = {
+CRYPTOPP_ALIGN_DATA(16) static const word64 SHA512_K[80] CRYPTOPP_SECTION_ALIGN16 = {
#endif
W64LIT(0x428a2f98d728ae22), W64LIT(0x7137449123ef65cd),
W64LIT(0xb5c0fbcfec4d3b2f), W64LIT(0xe9b5dba58189dbbc),
@@ -886,6 +886,9 @@ CRYPTOPP_NAKED static void CRYPTOPP_FASTCALL SHA512_SSE2_Transform(word64 *state
void SHA512::Transform(word64 *state, const word64 *data)
{
+ assert(IsAlignedOn(state, GetAlignmentOf<word64>()));
+ assert(IsAlignedOn(data, GetAlignmentOf<word64>()));
+
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32)
if (HasSSE2())
{