Crypto benchmark is a tool for benchmarking modern AEAD algorithms.
Due to the use of the old AES-128-OCB algorithm and its slow implementation in Mumble, we decided to determine the best cipher and library for the VoIP communicator.
$ ./build/crypto_benchmark
[NSS] running AES-256-GCM benchmark...
nss_encrypt(): PK11_Encrypt() failed with error -8190
[NSS] encryption failed!
[NSS] decrypted message doesn't match original, encryption/decryption failure!
[NSS] running ChaCha20-Poly1305 benchmark...
[NSS] 7.172393 seconds for 1000000 iterations, 4096 bytes message
[OpenSSL] running AES-256-GCM benchmark...
[OpenSSL] 2.525026 seconds for 1000000 iterations, 4096 bytes message
[OpenSSL] running AES-256-OCB benchmark...
[OpenSSL] 1.819613 seconds for 1000000 iterations, 4096 bytes message
[OpenSSL] running ChaCha20-Poly1305 benchmark...
[OpenSSL] 4.273006 seconds for 1000000 iterations, 4096 bytes message
[libsodium] running AEGIS-128L benchmark...
[libsodium] 0.647157 seconds for 1000000 iterations, 4096 bytes message
[libsodium] running AEGIS-256 benchmark...
[libsodium] 1.020494 seconds for 1000000 iterations, 4096 bytes message
[libsodium] running AES-256-GCM benchmark...
[libsodium] 4.991140 seconds for 1000000 iterations, 4096 bytes message
[libsodium] running ChaCha20-Poly1305 benchmark...
[libsodium] 6.304524 seconds for 1000000 iterations, 4096 bytes message
[wolfCrypt] running AES-256-GCM benchmark...
[wolfCrypt] Iteration 154518/1000000 (15%), elapsed time: 10.001149
[wolfCrypt] Iteration 309435/1000000 (30%), elapsed time: 20.002294
[wolfCrypt] Iteration 463682/1000000 (46%), elapsed time: 30.003333
[wolfCrypt] Iteration 617833/1000000 (61%), elapsed time: 40.004157
[wolfCrypt] Iteration 772525/1000000 (77%), elapsed time: 50.005194
[wolfCrypt] Iteration 926175/1000000 (92%), elapsed time: 60.006379
[wolfCrypt] 64.802514 seconds for 1000000 iterations, 4096 bytes message
[wolfCrypt] running ChaCha20-Poly1305 benchmark...
[wolfCrypt] Iteration 369566/1000000 (36%), elapsed time: 10.001228
[wolfCrypt] Iteration 739908/1000000 (73%), elapsed time: 20.002314
[wolfCrypt] 27.040796 seconds for 1000000 iterations, 4096 bytes message
Error: Process completed with exit code 1.
We build the project using Travis CI, on Ubuntu 18.04, using GCC and Clang compilers, on AMD64 and ARM64 platforms. Current status:
$ ./crypto_benchmark
[NSS] running AES-256-GCM benchmark...
[NSS] 4.007687 seconds for 1000000 iterations, 4096 bytes message
[NSS] running ChaCha20-Poly1305 benchmark...
[NSS] 32.563270 seconds for 1000000 iterations, 4096 bytes message
[OpenSSL] running AES-256-GCM benchmark...
[OpenSSL] 2.398911 seconds for 1000000 iterations, 4096 bytes message
[OpenSSL] running AES-256-OCB benchmark...
[OpenSSL] 2.441164 seconds for 1000000 iterations, 4096 bytes message
[OpenSSL] running ChaCha20-Poly1305 benchmark...
[OpenSSL] 4.500481 seconds for 1000000 iterations, 4096 bytes message
[libsodium] running AEGIS-128L benchmark...
[libsodium] 0.753556 seconds for 1000000 iterations, 4096 bytes message
[libsodium] running AEGIS-256 benchmark...
[libsodium] 1.144947 seconds for 1000000 iterations, 4096 bytes message
[libsodium] running AES-256-GCM benchmark...
[libsodium] 4.243719 seconds for 1000000 iterations, 4096 bytes message
[libsodium] running ChaCha20-Poly1305 benchmark...
[libsodium] 5.813727 seconds for 1000000 iterations, 4096 bytes message
[wolfCrypt] running AES-256-GCM benchmark...
[wolfCrypt] 122.332474 seconds for 1000000 iterations, 4096 bytes message
[wolfCrypt] running ChaCha20-Poly1305 benchmark...
[wolfCrypt] 29.525731 seconds for 1000000 iterations, 4096 bytes message
The benchmark is written in C language.
NSS, OpenSSL, libsodium (custom build from the master branch, due to AEGIS availability), wolfCrypt
Algorithm | Library | License | Limitations |
---|---|---|---|
AES-256-GCM | NSS | MPL 2 | |
ChaCha20-Poly1305 | NSS | MPL 2 | |
AES-128-OCB | OpenSSL | Apache | Patented |
AES-256-GCM | OpenSSL | Apache | |
ChaCha20-Poly1305 | OpenSSL | Apache | |
AEGIS-128L | libsodium | ISC | |
AEGIS-256 | libsodium | ISC | |
AES-256-GCM | libsodium | ISC | Requires SSSE3 + aesni and pclmul instructions |
ChaCha20-Poly1305 | libsodium | ISC | |
AES-256-GCM | wolfCrypt | GPLv2 | Optimizations disabled by default |
ChaCha20-Poly1305 | wolfCrypt | GPLv2 | Optimizations disabled by default |
We welcome contributions. See also our website Contribute page.