From 83f3fc0d772d1137b225a9c9bacec084177f2e70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Wed, 4 Sep 2013 12:07:24 +0200 Subject: [PATCH] Add AES-192-GCM --- include/polarssl/cipher.h | 1 + include/polarssl/cipher_wrap.h | 1 + library/cipher.c | 10 ++++++++++ library/cipher_wrap.c | 11 +++++++++++ 4 files changed, 23 insertions(+) diff --git a/include/polarssl/cipher.h b/include/polarssl/cipher.h index b7d449210..cc692089a 100644 --- a/include/polarssl/cipher.h +++ b/include/polarssl/cipher.h @@ -80,6 +80,7 @@ typedef enum { POLARSSL_CIPHER_AES_192_CTR, POLARSSL_CIPHER_AES_256_CTR, POLARSSL_CIPHER_AES_128_GCM, + POLARSSL_CIPHER_AES_192_GCM, POLARSSL_CIPHER_AES_256_GCM, POLARSSL_CIPHER_CAMELLIA_128_CBC, POLARSSL_CIPHER_CAMELLIA_192_CBC, diff --git a/include/polarssl/cipher_wrap.h b/include/polarssl/cipher_wrap.h index 4dabb44ee..84852561f 100644 --- a/include/polarssl/cipher_wrap.h +++ b/include/polarssl/cipher_wrap.h @@ -56,6 +56,7 @@ extern const cipher_info_t aes_256_ctr_info; #if defined(POLARSSL_GCM_C) extern const cipher_info_t aes_128_gcm_info; +extern const cipher_info_t aes_192_gcm_info; extern const cipher_info_t aes_256_gcm_info; #endif /* POLARSSL_GCM_C */ diff --git a/library/cipher.c b/library/cipher.c index 160f4bcad..a014eca5e 100644 --- a/library/cipher.c +++ b/library/cipher.c @@ -67,6 +67,12 @@ static const int supported_ciphers[] = { POLARSSL_CIPHER_AES_256_CTR, #endif /* defined(POLARSSL_CIPHER_MODE_CTR) */ +#if defined(POLARSSL_GCM_C) + POLARSSL_CIPHER_AES_128_GCM, + POLARSSL_CIPHER_AES_192_GCM, + POLARSSL_CIPHER_AES_256_GCM, +#endif /* defined(POLARSSL_GCM_C) */ + #endif /* defined(POLARSSL_AES_C) */ #if defined(POLARSSL_ARC4_C) @@ -157,6 +163,8 @@ const cipher_info_t *cipher_info_from_type( const cipher_type_t cipher_type ) #if defined(POLARSSL_GCM_C) case POLARSSL_CIPHER_AES_128_GCM: return &aes_128_gcm_info; + case POLARSSL_CIPHER_AES_192_GCM: + return &aes_192_gcm_info; case POLARSSL_CIPHER_AES_256_GCM: return &aes_256_gcm_info; #endif /* defined(POLARSSL_GCM_C) */ @@ -293,6 +301,8 @@ const cipher_info_t *cipher_info_from_string( const char *cipher_name ) #if defined(POLARSSL_GCM_C) if( !strcasecmp( "AES-128-GCM", cipher_name ) ) return cipher_info_from_type( POLARSSL_CIPHER_AES_128_GCM ); + if( !strcasecmp( "AES-192-GCM", cipher_name ) ) + return cipher_info_from_type( POLARSSL_CIPHER_AES_192_GCM ); if( !strcasecmp( "AES-256-GCM", cipher_name ) ) return cipher_info_from_type( POLARSSL_CIPHER_AES_256_GCM ); #endif diff --git a/library/cipher_wrap.c b/library/cipher_wrap.c index ebe60cf20..79daaf987 100644 --- a/library/cipher_wrap.c +++ b/library/cipher_wrap.c @@ -286,6 +286,17 @@ const cipher_info_t aes_128_gcm_info = { &gcm_aes_info }; +const cipher_info_t aes_192_gcm_info = { + POLARSSL_CIPHER_AES_192_GCM, + POLARSSL_MODE_GCM, + 192, + "AES-192-GCM", + 12, + 1, + 16, + &gcm_aes_info +}; + const cipher_info_t aes_256_gcm_info = { POLARSSL_CIPHER_AES_256_GCM, POLARSSL_MODE_GCM,