From a0558e048419968c33e0c6d1a06e5118a08d1cfb Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Tue, 10 Sep 2013 14:25:51 +0200
Subject: [PATCH] Check that the cipher GCM receives is a 128-bit-based cipher
---
library/gcm.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/library/gcm.c b/library/gcm.c
index e041647d3..1dfc1999d 100644
--- a/library/gcm.c
+++ b/library/gcm.c
@@ -117,6 +117,9 @@ int gcm_init( gcm_context *ctx, cipher_id_t cipher, const unsigned char *key,
if( cipher_info == NULL )
return( POLARSSL_ERR_GCM_BAD_INPUT );
+ if( cipher_info->block_size != 16 )
+ return( POLARSSL_ERR_GCM_BAD_INPUT );
+
if( ( ret = cipher_init_ctx( &ctx->cipher_ctx, cipher_info ) ) != 0 )
return( ret );