Initializing crypto for benchmarks

This commit is contained in:
Dennis Schwerdel 2016-02-08 20:12:12 +01:00
parent 23cbbda2b0
commit f860d487e9
1 changed files with 2 additions and 0 deletions

View File

@ -15,6 +15,7 @@ use super::ip::Packet;
#[bench] #[bench]
fn crypto_salsa20(b: &mut Bencher) { fn crypto_salsa20(b: &mut Bencher) {
Crypto::init();
let mut crypto = Crypto::from_shared_key(CryptoMethod::ChaCha20, "test"); let mut crypto = Crypto::from_shared_key(CryptoMethod::ChaCha20, "test");
let mut payload = [0; 1500]; let mut payload = [0; 1500];
let header = [0; 8]; let header = [0; 8];
@ -28,6 +29,7 @@ fn crypto_salsa20(b: &mut Bencher) {
#[bench] #[bench]
fn crypto_aes256(b: &mut Bencher) { fn crypto_aes256(b: &mut Bencher) {
Crypto::init();
if !Crypto::aes256_available() { if !Crypto::aes256_available() {
return return
} }