summaryrefslogtreecommitdiff
path: root/vmac.cpp
diff options
context:
space:
mode:
authorAnton Gorev <kvirund@gmail.com>2017-04-21 15:26:16 -0500
committerAnton Gorev <kvirund@gmail.com>2017-04-21 15:26:16 -0500
commit72d8cbe9177bade320b51c149aac1c67c4dd13ec (patch)
tree456f1c7c0f405141c89eb4887891c6b9fa5054e5 /vmac.cpp
parentcede0f3fb147e1fed37a914c37d2d31a4e1f99a9 (diff)
downloadcryptopp-git-72d8cbe9177bade320b51c149aac1c67c4dd13ec.tar.gz
Some fixes related to SunCC compiler bugs.
Fixes for "invalid address alignment" errors. See https://groups.google.com/d/topic/cryptopp-users/OYaByDEbSI0/discussion for details. Changed config.h in accordance to Jeffrey Walton's request;
Diffstat (limited to 'vmac.cpp')
-rw-r--r--vmac.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/vmac.cpp b/vmac.cpp
index 30eee34d..82b4bf12 100644
--- a/vmac.cpp
+++ b/vmac.cpp
@@ -546,9 +546,23 @@ void VMAC_Base::VHASH_Update_Template(const word64 *data, size_t blocksRemaining
CRYPTOPP_ASSERT(IsAlignedOn(m_polyState(),GetAlignmentOf<word64>()));
CRYPTOPP_ASSERT(IsAlignedOn(m_nhKey(),GetAlignmentOf<word64>()));
- #define INNER_LOOP_ITERATION(j) {\
+#if defined(__SUNPRO_CC)
+ #define PREPARE_D0_D1(j) \
+ word64 d0_original = 0;\
+ memcpy(&d0_original, data + i + 2*j + 0, sizeof(d0_original));\
+ word64 d1_original = 0;\
+ memcpy(&d1_original, data + i + 2*j + 1, sizeof(d1_original));\
+ \
+ word64 d0 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, d0_original);\
+ word64 d1 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, d1_original)
+#else
+ #define PREPARE_D0_D1(j) \
word64 d0 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, data[i+2*j+0]);\
- word64 d1 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, data[i+2*j+1]);\
+ word64 d1 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, data[i+2*j+1])
+#endif
+
+ #define INNER_LOOP_ITERATION(j) {\
+ PREPARE_D0_D1(j);\
AccumulateNH(nhA, d0+nhK[i+2*j+0], d1+nhK[i+2*j+1]);\
if (T_128BitTag)\
AccumulateNH(nhB, d0+nhK[i+2*j+2], d1+nhK[i+2*j+3]);\