crocs-muni / CryptoStreams

Tool for generation of data from cryptoprimitives (block and stream ciphers, hash functions). Cryptoprimitives are round-reduced and the data can be configured for multiple testing scenarios.
MIT License
13 stars 9 forks source link

Inspect statefulness of stream ciphers' `encrypt_bytes` #79

Open Bender250 opened 6 years ago

Bender250 commented 6 years ago

I added a test for generating ciphertext in byte-by-byte manner and found bugs in 6 functions.

[ FAILED ] 5 tests, listed below: [ FAILED ] chacha.test_vectors [ FAILED ] hermes.test_vectors [ FAILED ] lex.test_vectors [ FAILED ] salsa20.test_vectors [ FAILED ] trivium.test_vectors Fubuki fails even with segmentation fault.

I suggest to inspire from implementation in crypto-libraries. The easiest possible fix is to generate keystream into a buffer. However, it is still a task to inspect, if some other variable's state is not discarded by end of function. (Please, C++, give us yield keyword and generators).