On Thu, Sep 16, 2021 at 8:42 PM austin clifton <austin.clif...@otoy.com> wrote:
>
> Hi all,
>
> I have an issue which I believe may be a bug. I followed the instructions 
> from the "Bug Report" page on the cryptopp wiki and all tests in cryptest.exe 
> are passing, so figured I should post here first and make sure it isn't a 
> build related issue.
>
> I built cryptopp 8.5.0 as a static library, x64 multi-threaded debug (\MTd) 
> using Visual Studio 2019 v16.10.0, on Windows 10 Pro v10.0.19043, using the 
> .sln file provided with the cryptopp source code.
>
> I used two different machines for this test. One is the machine I built the 
> cryptopp library with. Both are running the same version of Windows 10. One 
> machine has a Ryzen 3700X, the other has an i7-990X. The Ryzen supports AVX, 
> the i7 does not.
>
> I am VERY rarely finding that files encrypted with the chacha cipher by these 
> two machines have differing sha256 hashes. If I do a hex diff against the 
> files, there is a single flipped bit at 0x1EBB4 (0xD8 vs 0xD9).
>
> I am able to reproduce this consistently with a specific key, nonce, and 
> input file, after test encrypting ~50GB of 1MB garbage files on each machine.
>
> If I disable AVX when building cryptlib by defining CRYPTOPP_DISABLE_AVX and 
> CRYPTOPP_DISABLE_AVX2, the machine with the Ryzen will encrypt the file the 
> same as the i7.
>
> Source code for a minimal reproducible example is here:
> https://github.com/austin-clifton/cryptopp-chacha-asm-test/blob/main/src/main.cpp#L208
>
> That repository includes a ready-to-build test case with Visual Studio, minus 
> a built cryptlib.lib which should be added to libs/debug/ before building.

Ugh, I dislike these reports.

I've seen a similar problem on a Ryzen with SHA. It is GCC67, which is
Ryzen 5 2400G, at https://cfarm.tetaneutral.net/machines/list/. One
self test failed but no others. The one test that failed is one with a
very long input string. I believe it is/was the last test at
https://github.com/weidai11/cryptopp/blob/master/TestVectors/sha2_256_fips_180.txt.

I am thinking the problem is with either GCC's AMD target code or the
Ryzen CPU itself. The problem eventually cleared itself.

With that said, can you give Master a try? We cleared a bug at
https://github.com/weidai11/cryptopp/issues/1010 that may affect GCC's
code generation. It was a bug related to GCC alias violations, and GCC
would remove code on occasion.

Something else to try... Update the firmware on the machine in case a
firmware or microcode update addressed the issue.

Jeff

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/CAH8yC8nz5iMi5JbVVDBZQM%3D-uYZe_C8EEq7S%2B62V2bSqQg3dwQ%40mail.gmail.com.

Reply via email to