summaryrefslogtreecommitdiff
path: root/salsa.cpp
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2009-03-02 02:39:17 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2009-03-02 02:39:17 +0000
commitcaf9e032e6b4ccb114a74a3936c916bcfaba262d (patch)
tree0fecaa7a6728d07549a41864ea2cedfb245f0bd3 /salsa.cpp
parent4e4793cc591e26c788b53c487bee7cab2d377f5e (diff)
downloadcryptopp-caf9e032e6b4ccb114a74a3936c916bcfaba262d.tar.gz
changes for 5.6:
- added AuthenticatedSymmetricCipher interface class and Filter wrappers - added CCM, GCM (with SSE2 assembly), CMAC, and SEED - improved AES speed on x86 and x64 - removed WORD64_AVAILABLE; compiler 64-bit int support is now required git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@433 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'salsa.cpp')
-rwxr-xr-xsalsa.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/salsa.cpp b/salsa.cpp
index 2c3b649..623edc7 100755
--- a/salsa.cpp
+++ b/salsa.cpp
@@ -30,9 +30,9 @@ void Salsa20_Policy::CipherSetKey(const NameValuePairs &params, const byte *key,
throw InvalidRounds(StaticAlgorithmName(), m_rounds);
// m_state is reordered for SSE2
- GetBlock<word32, LittleEndian, false> get1(key);
+ GetBlock<word32, LittleEndian> get1(key);
get1(m_state[13])(m_state[10])(m_state[7])(m_state[4]);
- GetBlock<word32, LittleEndian, false> get2(key + length - 16);
+ GetBlock<word32, LittleEndian> get2(key + length - 16);
get2(m_state[15])(m_state[12])(m_state[9])(m_state[6]);
// "expand 16-byte k" or "expand 32-byte k"
@@ -42,9 +42,10 @@ void Salsa20_Policy::CipherSetKey(const NameValuePairs &params, const byte *key,
m_state[3] = 0x6b206574;
}
-void Salsa20_Policy::CipherResynchronize(byte *keystreamBuffer, const byte *IV)
+void Salsa20_Policy::CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length)
{
- GetBlock<word32, LittleEndian, false> get(IV);
+ assert(length==8);
+ GetBlock<word32, LittleEndian> get(IV);
get(m_state[14])(m_state[11]);
m_state[8] = m_state[5] = 0;
}
@@ -63,7 +64,7 @@ unsigned int Salsa20_Policy::GetAlignment() const
return 16;
else
#endif
- return 1;
+ return GetAlignmentOf<word32>();
}
unsigned int Salsa20_Policy::GetOptimalBlockSize() const