[PATCH 1/2] tests/bench-slope: add missing cipher context reset
Jussi Kivilinna
jussi.kivilinna at iki.fi
Mon Jan 21 21:59:11 CET 2019
* tests/bench-slope.c (bench_encrypt_do_bench)
(bench_decrypt_do_bench): Add call to 'gcry_cipher_reset'.
--
Some non-AEAD results were negativily affected by missing state
reset (~1% for aesni-ctr and chacha20-stream).
Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
0 files changed
diff --git a/tests/bench-slope.c b/tests/bench-slope.c
index 5c64f229d..07282b786 100644
--- a/tests/bench-slope.c
+++ b/tests/bench-slope.c
@@ -859,7 +859,9 @@ bench_encrypt_do_bench (struct bench_obj *obj, void *buf, size_t buflen)
gcry_cipher_hd_t hd = obj->hd;
int err;
- err = gcry_cipher_encrypt (hd, buf, buflen, buf, buflen);
+ err = gcry_cipher_reset (hd);
+ if (!err)
+ err = gcry_cipher_encrypt (hd, buf, buflen, buf, buflen);
if (err)
{
fprintf (stderr, PGM ": gcry_cipher_encrypt failed: %s\n",
@@ -875,7 +877,9 @@ bench_decrypt_do_bench (struct bench_obj *obj, void *buf, size_t buflen)
gcry_cipher_hd_t hd = obj->hd;
int err;
- err = gcry_cipher_decrypt (hd, buf, buflen, buf, buflen);
+ err = gcry_cipher_reset (hd);
+ if (!err)
+ err = gcry_cipher_decrypt (hd, buf, buflen, buf, buflen);
if (err)
{
fprintf (stderr, PGM ": gcry_cipher_encrypt failed: %s\n",
More information about the Gcrypt-devel
mailing list