diff options
author | Martin Willi <martin@revosec.ch> | 2012-07-10 09:07:13 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-07-16 14:55:07 +0200 |
commit | 73264a81b8280a142209cb73ad7d442f4e580bc3 (patch) | |
tree | ab512ec0185f42e556d37783c91c1135a50bfc4d /src/libstrongswan | |
parent | 3aca89c8e6c5d8a697c3158f54fbc69c54715e5a (diff) | |
download | strongswan-73264a81b8280a142209cb73ad7d442f4e580bc3.tar.bz2 strongswan-73264a81b8280a142209cb73ad7d442f4e580bc3.tar.xz |
Set a key before benching PRFs
Diffstat (limited to 'src/libstrongswan')
-rw-r--r-- | src/libstrongswan/crypto/crypto_tester.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libstrongswan/crypto/crypto_tester.c b/src/libstrongswan/crypto/crypto_tester.c index 046222279..948d30618 100644 --- a/src/libstrongswan/crypto/crypto_tester.c +++ b/src/libstrongswan/crypto/crypto_tester.c @@ -815,11 +815,18 @@ static u_int bench_prf(private_crypto_tester_t *this, prf = create(alg); if (prf) { - char bytes[prf->get_block_size(prf)]; + char bytes[prf->get_block_size(prf)], key[prf->get_block_size(prf)]; chunk_t buf; struct timespec start; u_int runs; + memset(key, 0x56, prf->get_block_size(prf)); + if (!prf->set_key(prf, chunk_create(key, prf->get_block_size(prf)))) + { + prf->destroy(prf); + return 0; + } + buf = chunk_alloc(this->bench_size); memset(buf.ptr, 0x34, buf.len); |