diff options
author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2019-12-24 02:32:17 +0300 |
---|---|---|
committer | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2019-12-27 11:59:42 +0300 |
commit | afae0d3ab3d4530375d003babcf12743d9209f97 (patch) | |
tree | 6ec2edf7478a4c6738cc9ccf66c9bfd16f03a55e /src | |
parent | 6037706541616cfd2d4b49f6f5939ce6dddd1a53 (diff) | |
download | gnutls-afae0d3ab3d4530375d003babcf12743d9209f97.tar.gz |
benchmark: use mac key size instead of block size
Use newly added gnutls_hmac_get_key_size() to get key size instead of
assuming that key size = block size (incorrect for GOST 28147 IMIT).
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/benchmark-cipher.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/benchmark-cipher.c b/src/benchmark-cipher.c index b6945a2920..2d2bc30a66 100644 --- a/src/benchmark-cipher.c +++ b/src/benchmark-cipher.c @@ -231,7 +231,7 @@ static void cipher_bench(int algo, int size, int aead) static void mac_bench(int algo, int size) { void *_key; - int blocksize = gnutls_hmac_get_len(algo); + int key_size = gnutls_hmac_get_key_size(algo); int step = size * 1024; struct benchmark_st st; void *input; @@ -240,10 +240,10 @@ static void mac_bench(int algo, int size) ALLOCM(input, MAX_MEM); i = input; - _key = malloc(blocksize); + _key = malloc(key_size); if (_key == NULL) return; - memset(_key, 0xf0, blocksize); + memset(_key, 0xf0, key_size); printf("%16s ", gnutls_mac_get_name(algo)); fflush(stdout); @@ -253,7 +253,7 @@ static void mac_bench(int algo, int size) start_benchmark(&st); do { - gnutls_hmac_fast(algo, _key, blocksize, i, step, _key); + gnutls_hmac_fast(algo, _key, key_size, i, step, _key); st.size += step; INC(input, i, step); } |