diff options
author | Jeffrey Walton <noloader@gmail.com> | 2018-08-24 08:13:23 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-24 08:13:23 -0400 |
commit | 1bbbfb6b7538e88f979c68aa70d6427ce2e98cc0 (patch) | |
tree | d96a2f70a7a526e09e42458593089d4429675052 /tiger.cpp | |
parent | 243673c32acee63a7b0b23aeebac9b2ccfd80e7d (diff) | |
download | cryptopp-git-1bbbfb6b7538e88f979c68aa70d6427ce2e98cc0.tar.gz |
Fix partial specializations for FixedSizeAllocatorWithCleanup (PR #710)
Commit afbd3e60f68f effectively treated a symptom and not the underlying problem. The problem was linkers on 32-bit systems ignore CRYPTOPP_ALIGN_DAT(16) passed down by the compiler and align to 8-bytes or less. We have to use Wei's original code in some places. It is not a bad thing, but the bit fiddling is something we would like to contain a little more by depending more on language or platform features.
This commit keeps the original changes which improve partial specializations; but fixes 32-bit linker behavior by effectively reverting afbd3e60f68f and e054d36dc88d00. We also add more comments so the next person has understands why things are done they way they are.
Diffstat (limited to 'tiger.cpp')
-rw-r--r-- | tiger.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -51,7 +51,7 @@ void Tiger::TruncatedFinal(byte *hash, size_t size) Restart(); // reinit for next use
}
-void Tiger::Transform (word64 *digest, const word64 *X)
+void Tiger::Transform (word64 *state, const word64 *data)
{
#if CRYPTOPP_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86
if (HasSSE2())
@@ -63,8 +63,8 @@ void Tiger::Transform (word64 *digest, const word64 *X) AS_PUSH_IF86(bx)
#else
AS2( lea edx, [table])
- AS2( mov eax, digest)
- AS2( mov esi, X)
+ AS2( mov eax, state)
+ AS2( mov esi, data)
#endif
AS2( movq mm0, [eax])
AS2( movq mm1, [eax+1*8])
@@ -213,7 +213,7 @@ void Tiger::Transform (word64 *digest, const word64 *X) AS_POP_IF86(bx)
ATT_PREFIX
:
- : "a" (digest), "S" (X), "d" (table)
+ : "a" (state), "S" (data), "d" (table)
: "%ecx", "%edi", "memory", "cc"
);
#endif
@@ -221,9 +221,9 @@ void Tiger::Transform (word64 *digest, const word64 *X) else
#endif
{
- word64 a = digest[0];
- word64 b = digest[1];
- word64 c = digest[2];
+ word64 a = state[0];
+ word64 b = state[1];
+ word64 c = state[2];
word64 Y[8];
#define t1 (table)
@@ -267,15 +267,15 @@ void Tiger::Transform (word64 *digest, const word64 *X) Y[6] += Y[5]; \
Y[7] -= Y[6] ^ W64LIT(0x0123456789ABCDEF)
- pass(a,b,c,5,X);
- key_schedule(Y,X);
+ pass(a,b,c,5,data);
+ key_schedule(Y,data);
pass(c,a,b,7,Y);
key_schedule(Y,Y);
pass(b,c,a,9,Y);
- digest[0] = a ^ digest[0];
- digest[1] = b - digest[1];
- digest[2] = c + digest[2];
+ state[0] = a ^ state[0];
+ state[1] = b - state[1];
+ state[2] = c + state[2];
}
}
|