On Monday, December 3, 2018 at 6:13:40 PM UTC-5, Jeffrey Walton wrote: > > > On Monday, December 3, 2018 at 11:58:54 AM UTC-5, rums.da...@gmail.com > wrote: >> >> Hi, >> when decrypting using pipelines I would normally do something like: >> >> StringSource ss(cipher_hex, true, new HexDecoder(new >> StreamTransformationFilter(dec, new StringSink(recover)))); >> >> Now i ran into a problem using the Panama Stream Cipher: >> >> AutoSeededRandomPool prng; >> std::string plain("High-school students – who have been protesting >> against changes to colleges and the university system – also seized on the >> mood of protest and stepped up their blockades."); >> std::string cipher_hex, recover1, recover2, cipher_bin; >> >> SecByteBlock key(32), iv(32); >> prng.GenerateBlock(key, key.size()); >> prng.GenerateBlock(iv, iv.size()); >> >> PanamaCipher<LittleEndian>::Encryption enc; >> enc.SetKeyWithIV(key, key.size(), iv, iv.size()); >> PanamaCipher<LittleEndian>::Decryption dec; >> dec.SetKeyWithIV(key, key.size(), iv, iv.size()); >> >> StringSource (plain, true, new StreamTransformationFilter(enc, new >> HexEncoder(new StringSink(cipher_hex)))); >> >> // works fine, recover1 = plain >> StringSource (cipher_hex, true, new HexDecoder(new StringSink( >> cipher_bin))); >> StringSource (cipher_bin, true, new StreamTransformationFilter(dec, >> new StringSink(recover1))); >> >> dec.Resynchronize(iv, iv.size()); >> >> // does not work, recover2 = "High-school students – who have been >> protesting against changes –Ö)‘à« ç›áS` ¥¨~]Šm Qÿö:Û (...) " >> StringSource (cipher_hex, true, new HexDecoder(new >> StreamTransformationFilter(dec, new StringSink(recover2)))); >> >> Is this expected behaviour? Is it not possible to use a Decoder inside >> the decryption pipeline of a stream cipher? >> > > No, its not expected behavior. > > I can duplicate it with GCC 8.2.1 on Fedora 29. Clang 6.0.1 is OK on > Fedora 29. > > GCC 6 and Clang 6 are OK on OS X. > > Let me see if I can find a workaround in the code. >
I'm still looking for a solution. The unusual thing I'm seeing is, it is happening at character 70. I would expect something unusual to happen on a simd-word or block boundary. $ echo 'Two: High-school students – who have been protesting against change' | wc -c 70 For the moment you can work around the issue by opening panama.h, and defining CRYPTOPP_DISABLE_PANAMA_ASM. It is a safety for X32 and Clang, but it works for GCC as well. Jeff -- You received this message because you are subscribed to "Crypto++ Users". More information about Crypto++ and this group is available at http://www.cryptopp.com and http://groups.google.com/forum/#!forum/cryptopp-users. --- 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 cryptopp-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.