randombit / botan

Cryptography Toolkit
https://botan.randombit.net
BSD 2-Clause "Simplified" License
2.58k stars 569 forks source link

CTR mode and Salsa20 speedtests broken #697

Closed neverhub closed 8 years ago

neverhub commented 8 years ago

Due to recent changes the CTR-mode speedtests result in a segfault.

Reading symbols from ./botan...done.
(gdb) set args speed AES-128/CTR-BE
(gdb) run
Starting program: /home/never/build/botan/botan speed AES-128/CTR-BE
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x000000000046a2a0 in Botan_CLI::Speed::bench_cipher_mode (this=0x6e2a90, enc=..., dec=..., runtime=..., buf_size=4096) at ./src/cli/speed.cpp:615
615             iv[0] += 1;
(gdb) bt
#0  0x000000000046a2a0 in Botan_CLI::Speed::bench_cipher_mode (this=0x6e2a90, enc=..., dec=..., runtime=..., buf_size=4096) at ./src/cli/speed.cpp:615
#1  0x0000000000467f2e in Botan_CLI::Speed::go (this=0x6e2a90) at ./src/cli/speed.cpp:353
#2  0x00000000004520d2 in Botan_CLI::Command::run (this=0x6e2a90, params=std::vector of length 1, capacity 1 = {...}) at ./src/cli/cli.h:229
#3  0x00000000004510e1 in main (argc=3, argv=0x7fffffffe1e8) at ./src/cli/main.cpp:60

Besides botan speed Salsa20 results in Error: Invalid argument IV length 0 is invalid for Salsa20

randombit commented 8 years ago

Thanks for the report.

Salsa20 should treat an empty IV as identical to an all-zero IV.

randombit commented 8 years ago

Should be fixed now.

neverhub commented 8 years ago

Can confirm :). Fixed