This issue is potentially more widespread than I thought. I found if I 
added "#define CRYPTOPP_DISABLE_SSSE3 1" on Windows, then the same stack 
overflow occurred. This is kinda bad because it means we don't have a 
reference implementation that works on Linux, OS X or Windows to observe 
what expected results are.

Does anyone know AliasedWithTable is supposed to do for SSE2? I'm not 
following this logic, and the code comments don't really discuss it:

 1016 static inline bool AliasedWithTable(const byte *begin, const byte *end)
 1017 {
 1018     size_t s0 = size_t(begin)%4096, s1 = size_t(end)%4096;
 1019     size_t t0 = size_t(Te)%4096, t1 = (size_t(Te)+sizeof(Te))%4096;
 1020     if (t1 > t0)
 1021         return (s0 >= t0 && s0 < t1) || (s1 > t0 && s1 <= t1);
 1022     else
 1023         return (s0 < t1 || s1 <= t1) || (s0 >= t0 || s1 > t0);
 1024 }


The true branch of the "if (t1 > t0)" might be trying to keep the table 
(begin,end) in the same memory page and ensure the either "table == Te" or 
table and Te don't overlap. if that's the case, then I think the test needs 
to be "if (t1 >= t0)". (And this could be completely wrong, since I'm not 
sure what requirement its trying to meet).

The brief context can be found at 
http://github.com/weidai11/cryptopp/issues/132; and the source code is at 
http://github.com/weidai11/cryptopp/blob/master/rijndael.cpp.

Jeff

On Saturday, February 6, 2016 at 10:51:21 PM UTC-5, Jeffrey Walton wrote:
>
> ...
> Previously, CRYPTOPP_ALLOW_RIJNDAEL_UNALIGNED_DATA_ACCESS was 
> unconditionally set in rijndael.cpp because of a missing symbol under 
> Microsoft SSE2 non-AESNI X64 builds. The define was removed and the issue 
> was cleared with:
>
>   * 
> http://github.com/weidai11/cryptopp/commit/58ed2fcd370523ed101715f57b0926d7dd8ac622
>   * 
> http://github.com/weidai11/cryptopp/commit/c8de423ab5a1eda7c6b5bd36aa323f1996486547
>
> The remediations brought another issue to light, and it is a hang in 
> Rijndael's Enc::AdvancedProcessBlocks and AliasedWithTable. This issue 
> always existed, but the recent commit and testing with 
> CRYPTOPP_NO_UNALIGNED_DATA_ACCESS defined and 
> CRYPTOPP_ALLOW_RIJNDAEL_UNALIGNED_DATA_ACCESS removed brought it back 
> again. For completeness, CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS is OK. The 
> issue is being tracked at:
>
>   * http://github.com/weidai11/cryptopp/issues/132
>
> The bug report has some initial findings around the 132 issue. I know how 
> to clear it when CRYPTOPP_NO_UNALIGNED_DATA_ACCESS is defined, but it 
> causes another failure in the self tests. The failure is an Invalid PKCS #7 
> Padding in AES/CBC mode.
>
... 

-- 
-- 
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.

Reply via email to