We tweaked ChaCha to arrive at the IETF's implementation specified by RFC 7539. We are not sure how to handle block counter wrap. At the moment the caller is responsible for managing it. We were not able to find a reference implementation so we disable SIMD implementations like SSE, AVX, NEON and Power4. We need the wide block tests for corner cases to ensure our implementation is correct.
This switches to line oriented parsing for the test files. Previously we we using streams for names, and lines for values. We can now use whitespace and make the tests a bit more readable by grouping similar tests. AlgorithmType will clear the current accumlated values.
Throughout the library the message "FAILED" (not "failed") is used to signal failures. It makes it easy to grep for them. This change makes the message consistent.
The strategy of "cleanup under-aligned buffers" is not scaling well. Corner cases are still turing up. The library has some corner-case breaks, like old 32-bit Intels. And it still has not solved the AltiVec and Power8 alignment problems.
For now we are backing out the changes and investigating other strategies
This reverts commit eb3b27a6a5. The change broke GCC 4.8 and unknown version of Clang on OS X. UB reported the OS X break, and JW found duplicated the break on a ARM CubieTruck with GCC 4.8.
We also add a helper to PutDecodedDatumInto which reverses the little-endian values from the Threefish test vectors. Test vectors will follow at next check-in.
Formatting of data for a failed self test was still off a bit. It was due to retaining a whitespace character from the test vector file. The problem was, the whitespace was a tab on occasion.
This was introduced at Commit e456cd2275, and affected Uri during his rounds of testing.
We also took the opportunity to write it in modern C++ (and remove the VC++ 6.0 bug workaround)
Previously the parsed string would look as follows. You would get this on a failed self test.
Key: 0000000000000000
0000000000000000
0000000000000000
0000000000000000
The new behavior eats the leading whitespace, so the key is reported as:
Key: 0000000000000000000000000000000000000000000000000000000000000000
CRYPTOPP_COVERAGE was added at 9614307ab7 to increase code coverage support. This commit enables additional validation routines when CRYPTOPP_COVERAGE is in effect.