summaryrefslogtreecommitdiff
path: root/siv-cmac.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2019-05-15 10:11:22 +0200
committerNiels Möller <nisse@lysator.liu.se>2019-05-15 10:11:22 +0200
commit2b5dcfed94d66a3207f8bbd6d043e17532a88db8 (patch)
tree6a098be22eafdbf9658c1cc6c5a55fa4bdbc3011 /siv-cmac.c
parentef82f2281f7c2459cd8fafa1e50598069c6a3732 (diff)
downloadnettle-2b5dcfed94d66a3207f8bbd6d043e17532a88db8.tar.gz
Require non-empty nonce for SIV mode.
Diffstat (limited to 'siv-cmac.c')
-rw-r--r--siv-cmac.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/siv-cmac.c b/siv-cmac.c
index 13bdbff4..1debdc4b 100644
--- a/siv-cmac.c
+++ b/siv-cmac.c
@@ -60,6 +60,8 @@ _siv_s2v (const struct nettle_cipher *nc,
union nettle_block16 D, S, T;
static const union nettle_block16 const_zero = {.b = 0 };
+ assert (nlength >= SIV_MIN_NONCE_SIZE);
+
cmac128_update (siv_cmac_ctx, cmac_cipher_ctx, nc->encrypt, 16, const_zero.b);
cmac128_digest (siv_cmac_ctx, cmac_cipher_ctx, nc->encrypt, 16, D.b);