This was flagged by GCC:
nettle-benchmark.c: In function 'time_cipher':
nettle-benchmark.c:504:29: warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
memset(iv, 0, sizeof(iv));
^
nettle-benchmark.c:520:29: warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
memset(iv, 0, sizeof(iv));
^
nettle-benchmark.c:537:29: warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
memset(iv, 0, sizeof(iv));
^
Here's a suggested patch:
--- examples/nettle-benchmark.c~0 2013-05-28 17:21:54.000000000 +0300
+++ examples/nettle-benchmark.c 2014-12-12 17:58:10.670625000 +0200
@@ -501,7 +501,7 @@ time_cipher(const struct nettle_cipher *
info.block_size = cipher->block_size;
info.iv = iv;
- memset(iv, 0, sizeof(iv));
+ memset(iv, 0, sizeof(*iv));
cipher->set_encrypt_key(ctx, cipher->key_size, key);
@@ -517,7 +517,7 @@ time_cipher(const struct nettle_cipher *
info.block_size = cipher->block_size;
info.iv = iv;
- memset(iv, 0, sizeof(iv));
+ memset(iv, 0, sizeof(*iv));
cipher->set_decrypt_key(ctx, cipher->key_size, key);
@@ -534,7 +534,7 @@ time_cipher(const struct nettle_cipher *
info.block_size = cipher->block_size;
info.iv = iv;
- memset(iv, 0, sizeof(iv));
+ memset(iv, 0, sizeof(*iv));
cipher->set_encrypt_key(ctx, cipher->key_size, key);