summaryrefslogtreecommitdiff
path: root/lib/nettle/mac.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2013-05-19 19:02:54 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-05-19 19:02:54 +0200
commit39e6de6aa13428afff1dc8309af46d9a93591aaa (patch)
tree6d5b77b3e3af708ccccc5e52b1c0bb9989c13360 /lib/nettle/mac.c
parent1a0130608a651c8a98816be809b346fa8aa40353 (diff)
downloadgnutls-39e6de6aa13428afff1dc8309af46d9a93591aaa.tar.gz
fail on wrong key sizes
Diffstat (limited to 'lib/nettle/mac.c')
-rw-r--r--lib/nettle/mac.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/nettle/mac.c b/lib/nettle/mac.c
index c394e60d2f..ae73256b1b 100644
--- a/lib/nettle/mac.c
+++ b/lib/nettle/mac.c
@@ -84,13 +84,17 @@ struct nettle_mac_ctx
static void
_wrap_umac96_set_key(void* ctx, unsigned len, const uint8_t* key)
{
- return umac96_set_key(ctx, key);
+ if (unlikely(len != 16))
+ abort();
+ umac96_set_key(ctx, key);
}
static void
_wrap_umac128_set_key(void* ctx, unsigned len, const uint8_t* key)
{
- return umac128_set_key(ctx, key);
+ if (unlikely(len != 16))
+ abort();
+ umac128_set_key(ctx, key);
}
static int _mac_ctx_init(gnutls_mac_algorithm_t algo, struct nettle_mac_ctx *ctx)
@@ -237,8 +241,7 @@ wrap_nettle_mac_set_key (void *_ctx, const void *key, size_t keylen)
struct nettle_mac_ctx *ctx = _ctx;
ctx->set_key (ctx->ctx_ptr, keylen, key);
-
- return GNUTLS_E_SUCCESS;
+ return 0;
}
static int