$OpenBSD: patch-rijndael_cpp,v 1.1 2011/06/24 07:55:18 dcoppa Exp $ Fix an infinite recursion on amd64 (upstream rev 523). Fix use of uninitialised value in CryptoPP::Rijndael_Enc_AdvancedProcessBlocks (upstream rev 525). --- rijndael.cpp.orig Fri Aug 6 18:46:22 2010 +++ rijndael.cpp Wed Jun 8 16:42:01 2011 @@ -349,7 +349,11 @@ void Rijndael::Base::UncheckedSetKey(const byte *userK void Rijndael::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const { #if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE) || CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE) if (HasSSE2()) +#else + if (HasAESNI()) +#endif { Rijndael::Enc::AdvancedProcessBlocks(inBlock, xorBlock, outBlock, 16, 0); return; @@ -522,7 +526,7 @@ CRYPTOPP_NAKED void CRYPTOPP_FASTCALL Rijndael_Enc_Adv #if CRYPTOPP_BOOL_X86 #define L_REG esp -#define L_INDEX(i) (L_REG+512+i) +#define L_INDEX(i) (L_REG+768+i) #define L_INXORBLOCKS L_INBLOCKS+4 #define L_OUTXORBLOCKS L_INBLOCKS+8 #define L_OUTBLOCKS L_INBLOCKS+12 @@ -621,7 +625,7 @@ CRYPTOPP_NAKED void CRYPTOPP_FASTCALL Rijndael_Enc_Adv #if CRYPTOPP_BOOL_X86 AS2( mov [ecx+16*12+16*4], esp) // save esp to L_SP - AS2( lea esp, [ecx-512]) + AS2( lea esp, [ecx-768]) #endif // copy subkeys to stack