From d8a644fc4ee2af9dc62f2a8c167b023d0c71d13b Mon Sep 17 00:00:00 2001 From: weidai Date: Mon, 2 Mar 2009 02:39:17 +0000 Subject: 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 --- sosemanuk.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'sosemanuk.cpp') diff --git a/sosemanuk.cpp b/sosemanuk.cpp index 1f9bde41..e0e411f1 100755 --- a/sosemanuk.cpp +++ b/sosemanuk.cpp @@ -23,8 +23,10 @@ void SosemanukPolicy::CipherSetKey(const NameValuePairs ¶ms, const byte *use Serpent_KeySchedule(m_key, 24, userKey, keylen); } -void SosemanukPolicy::CipherResynchronize(byte *keystreamBuffer, const byte *iv) +void SosemanukPolicy::CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length) { + assert(length==16); + word32 a, b, c, d, e; typedef BlockGetAndPut Block; @@ -295,7 +297,7 @@ unsigned int SosemanukPolicy::GetAlignment() const return 16; else #endif - return 1; + return GetAlignmentOf(); } unsigned int SosemanukPolicy::GetOptimalBlockSize() const @@ -418,12 +420,15 @@ void SosemanukPolicy::OperateKeystream(KeystreamOperation operation, byte *outpu #define R11 edx #define R20 edx #define R21 ecx +// workaround bug in GAS 2.15 +#define R20r WORD_REG(dx) +#define R21r WORD_REG(cx) #define SSE2_STEP(i, j) \ AS2( mov eax, [s(i+0)])\ AS2( mov [v(i)], eax)\ AS2( rol eax, 8)\ - AS2( lea AS_REG_7d, [AS_REG_6d + R2##j])\ + AS2( lea AS_REG_7, [AS_REG_6 + R2##j##r])\ AS2( xor AS_REG_7d, R1##j)\ AS2( mov [u(i)], AS_REG_7d)\ AS2( mov AS_REG_7d, 1)\ -- cgit v1.2.1