summaryrefslogtreecommitdiff
path: root/sosemanuk.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2015-08-03 19:06:18 -0400
committerJeffrey Walton <noloader@gmail.com>2015-08-03 19:06:18 -0400
commit7e6c9438da8787b6ea202dcaaea8aee0eff6e158 (patch)
treeaa542e7fb0efe6a51d7d7271ae634dade9359fb3 /sosemanuk.cpp
parent572506de3d00f1280c89b1168384178a988c4486 (diff)
downloadcryptopp-git-7e6c9438da8787b6ea202dcaaea8aee0eff6e158.tar.gz
Companion checkin to 572506de3d00f1280c89b1168384178a988c4486. Salsa and Sosemanuk can no longer reach into a SecBlock for and touch its private members
Diffstat (limited to 'sosemanuk.cpp')
-rw-r--r--sosemanuk.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/sosemanuk.cpp b/sosemanuk.cpp
index 52dd24b1..a642ac71 100644
--- a/sosemanuk.cpp
+++ b/sosemanuk.cpp
@@ -326,8 +326,11 @@ void SosemanukPolicy::OperateKeystream(KeystreamOperation operation, byte *outpu
{
#endif // #ifdef CRYPTOPP_GENERATE_X64_MASM
+ // m_state.m_ptr was used below. Fetch it through data() member so we can make SecBlock's members private
+ word32* state = m_state.data();
+
#ifdef CRYPTOPP_X64_MASM_AVAILABLE
- Sosemanuk_OperateKeystream(iterationCount, input, output, m_state.data());
+ Sosemanuk_OperateKeystream(iterationCount, input, output, state);
return;
#endif
@@ -353,6 +356,7 @@ void SosemanukPolicy::OperateKeystream(KeystreamOperation operation, byte *outpu
#ifdef __GNUC__
#if CRYPTOPP_BOOL_X64
FixedSizeAlignedSecBlock<byte, 80*4*2+12*4+8*WORD_SZ> workspace;
+ const byte* space = workspace.data();
#endif
__asm__ __volatile__
(
@@ -598,9 +602,9 @@ void SosemanukPolicy::OperateKeystream(KeystreamOperation operation, byte *outpu
AS_POP_IF86( bx)
GNU_AS_ATT_SYNTAX
:
- : "a" (m_state.m_ptr), "c" (iterationCount), "S" (s_sosemanukMulTables), "D" (output), "d" (input)
+ : "a" (state), "c" (iterationCount), "S" (s_sosemanukMulTables), "D" (output), "d" (input)
#if CRYPTOPP_BOOL_X64
- , "r" (workspace.m_ptr)
+ , "r" (space)
: "memory", "cc", "%r9", "%r10", "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7"
#else
: "memory", "cc"