> I looked at the crash in the sample that you gave, and started > by assuming there was something in HashVerificationFilter that > made it send the wrong data to CBC_Encryption; I followed the > data through all the hoops all the way down to > AESNI_AdvancedProcessBlocks(), until I realized it was on its > subkeys parameter that the read violation was occurring. Turns > out the key wasn't set: > CBC_Mode<AES>::Encryption encryptor; > encryptor.SetKeyWithIV(keys. data() + 0 /*key*/, 16, keys.data() + 16 /*iv*/, 16); > CBC_Mode<AES>::Decryption decryptor; > encryptor.SetKeyWithIV(keys. data() + 0 /*key*/, 16, keys.data() + 16 /*iv*/, 16);
Dooh... thank you very much. I'm glad I put "modulo my dumb mistake" in there :) It makes it a little more palatable. When I looked at it under GDB, I thought I was actually getting what looked like a good subkey address (0x7ffffff...). I thought the culprit was the verification filter smashing some memory due to channel confusion. Jeff On Sunday, April 5, 2015 at 11:20:16 PM UTC-4, Maricel Gregoraschko wrote: > > Jeffrey, > Thank you very much for your insights and details. > I was indeed looking to do HMAC on cipher text, not directly on clear > text. I asked the question wrong. > Your code using putMessage=true was what I needed, but it's also good to > know that ChannelSwitch is the equivalent of Fork. > I looked at the crash in the sample that you gave, and started by assuming > there was something in HashVerificationFilter that made it send the wrong > data to CBC_Encryption; I followed the data through all the hoops all the > way down to AESNI_AdvancedProcessBlocks(), until I realized it was on its > subkeys parameter that the read violation was occurring. Turns out the key > wasn't set: > CBC_Mode<AES>::Encryption encryptor; > encryptor.SetKeyWithIV(keys. data() + 0 /*key*/, 16, keys.data() + 16 > /*iv*/, 16); > CBC_Mode<AES>::Decryption decryptor; > encryptor.SetKeyWithIV(keys. data() + 0 /*key*/, 16, keys.data() + 16 > /*iv*/, 16); //needs to be decryptor.SetKeyWithIV.... > > Quite an easy mistake to make with boilerplate code, and it's a bit > disconcerting that the decryption class wouldn't at a minimum make a basic > check that the key was set by the client, before proceeding to use it. > -- -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [email protected]. More information about Crypto++ and this group is available at http://www.cryptopp.com. --- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
