summaryrefslogtreecommitdiff
path: root/tiger.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-08-24 08:13:23 -0400
committerGitHub <noreply@github.com>2018-08-24 08:13:23 -0400
commit1bbbfb6b7538e88f979c68aa70d6427ce2e98cc0 (patch)
treed96a2f70a7a526e09e42458593089d4429675052 /tiger.cpp
parent243673c32acee63a7b0b23aeebac9b2ccfd80e7d (diff)
downloadcryptopp-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.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/tiger.cpp b/tiger.cpp
index 03d2ddb0..9b35a8c7 100644
--- a/tiger.cpp
+++ b/tiger.cpp
@@ -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];
}
}