summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2014-07-07 18:34:02 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2014-07-07 18:34:02 +0200
commit3e557bb09b00278cb39f28887778d201eb6b4d4c (patch)
tree9ec6531999bab3ce4a5eabea8a83a5da3ea15060
parent26dd852f3ee8e5004543fd4d3856070f1856043e (diff)
downloadgnutls-3e557bb09b00278cb39f28887778d201eb6b4d4c.tar.gz
FIPS140-2 mode: enforce the minimum GCM IV size required by SP800-38D (section 8.2)
-rw-r--r--lib/nettle/cipher.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/nettle/cipher.c b/lib/nettle/cipher.c
index 1bc164960b..f367f2f9fa 100644
--- a/lib/nettle/cipher.c
+++ b/lib/nettle/cipher.c
@@ -391,6 +391,8 @@ wrap_nettle_cipher_setiv(void *_ctx, const void *iv, size_t ivsize)
switch (ctx->algo) {
case GNUTLS_CIPHER_AES_128_GCM:
case GNUTLS_CIPHER_AES_256_GCM:
+ if (_gnutls_fips_mode_enabled() != 0 && ivsize < GCM_IV_SIZE)
+ return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
gcm_aes_set_iv(&ctx->ctx.aes_gcm,
ivsize, iv);
break;