diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2015-07-31 16:59:45 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2015-08-14 06:56:11 +0100 |
commit | 3d3701ea20ca36215e3af5ac090797cfec5fca2a (patch) | |
tree | b28cac593f1d4c213b417070d0828afe6c73f3b4 /ssl | |
parent | e75c5a794e71baa3d76214be3ac8dc6e082e4a1a (diff) | |
download | openssl-3d3701ea20ca36215e3af5ac090797cfec5fca2a.tar.gz |
ccm8 support
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/ssl_ciph.c | 22 | ||||
-rw-r--r-- | ssl/ssl_locl.h | 4 | ||||
-rw-r--r-- | ssl/t1_enc.c | 6 |
3 files changed, 25 insertions, 7 deletions
diff --git a/ssl/ssl_ciph.c b/ssl/ssl_ciph.c index 7f2970b317..c048fc2a8c 100644 --- a/ssl/ssl_ciph.c +++ b/ssl/ssl_ciph.c @@ -166,7 +166,9 @@ #define SSL_ENC_AES256GCM_IDX 13 #define SSL_ENC_AES128CCM_IDX 14 #define SSL_ENC_AES256CCM_IDX 15 -#define SSL_ENC_NUM_IDX 16 +#define SSL_ENC_AES128CCM8_IDX 16 +#define SSL_ENC_AES256CCM8_IDX 17 +#define SSL_ENC_NUM_IDX 18 /* NB: make sure indices in these tables match values above */ @@ -192,7 +194,9 @@ static const ssl_cipher_table ssl_cipher_table_cipher[SSL_ENC_NUM_IDX] = { {SSL_AES128GCM, NID_aes_128_gcm}, /* SSL_ENC_AES128GCM_IDX 12 */ {SSL_AES256GCM, NID_aes_256_gcm}, /* SSL_ENC_AES256GCM_IDX 13 */ {SSL_AES128CCM, NID_aes_128_ccm}, /* SSL_ENC_AES128CCM_IDX 14 */ - {SSL_AES256CCM, NID_aes_256_ccm} /* SSL_ENC_AES256CCM_IDX 15 */ + {SSL_AES256CCM, NID_aes_256_ccm}, /* SSL_ENC_AES256CCM_IDX 15 */ + {SSL_AES128CCM8, NID_aes_128_ccm}, /* SSL_ENC_AES128CCM8_IDX 16 */ + {SSL_AES256CCM8, NID_aes_256_ccm} /* SSL_ENC_AES256CCM8_IDX 17 */ }; static const EVP_CIPHER *ssl_cipher_methods[SSL_ENC_NUM_IDX] = { @@ -359,14 +363,16 @@ static const SSL_CIPHER cipher_aliases[] = { {0, SSL_TXT_IDEA, 0, 0, 0, SSL_IDEA, 0, 0, 0, 0, 0, 0}, {0, SSL_TXT_SEED, 0, 0, 0, SSL_SEED, 0, 0, 0, 0, 0, 0}, {0, SSL_TXT_eNULL, 0, 0, 0, SSL_eNULL, 0, 0, 0, 0, 0, 0}, - {0, SSL_TXT_AES128, 0, 0, 0, SSL_AES128 | SSL_AES128GCM | SSL_AES128CCM, 0, + {0, SSL_TXT_AES128, 0, 0, 0, SSL_AES128 | SSL_AES128GCM | SSL_AES128CCM | SSL_AES128CCM8, 0, 0, 0, 0, 0, 0}, - {0, SSL_TXT_AES256, 0, 0, 0, SSL_AES256 | SSL_AES256GCM | SSL_AES256CCM, 0, + {0, SSL_TXT_AES256, 0, 0, 0, SSL_AES256 | SSL_AES256GCM | SSL_AES256CCM | SSL_AES256CCM8, 0, 0, 0, 0, 0, 0}, {0, SSL_TXT_AES, 0, 0, 0, SSL_AES, 0, 0, 0, 0, 0, 0}, {0, SSL_TXT_AES_GCM, 0, 0, 0, SSL_AES128GCM | SSL_AES256GCM, 0, 0, 0, 0, 0, 0}, - {0, SSL_TXT_AES_CCM, 0, 0, 0, SSL_AES128CCM | SSL_AES256CCM, 0, 0, 0, 0, + {0, SSL_TXT_AES_CCM, 0, 0, 0, SSL_AES128CCM | SSL_AES256CCM | SSL_AES128CCM8 | SSL_AES256CCM8, 0, 0, 0, 0, + 0, 0}, + {0, SSL_TXT_AES_CCM_8, 0, 0, 0, SSL_AES128CCM8 | SSL_AES256CCM8, 0, 0, 0, 0, 0, 0}, {0, SSL_TXT_CAMELLIA128, 0, 0, 0, SSL_CAMELLIA128, 0, 0, 0, 0, 0, 0}, {0, SSL_TXT_CAMELLIA256, 0, 0, 0, SSL_CAMELLIA256, 0, 0, 0, 0, 0, 0}, @@ -1721,6 +1727,12 @@ char *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len) case SSL_AES256CCM: enc = "AESCCM(256)"; break; + case SSL_AES128CCM8: + enc = "AESCCM8(128)"; + break; + case SSL_AES256CCM8: + enc = "AESCCM8(256)"; + break; case SSL_CAMELLIA128: enc = "Camellia(128)"; break; diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h index b30a635e79..79926ff2b0 100644 --- a/ssl/ssl_locl.h +++ b/ssl/ssl_locl.h @@ -361,8 +361,10 @@ # define SSL_AES256GCM 0x00002000L # define SSL_AES128CCM 0x00004000L # define SSL_AES256CCM 0x00008000L +# define SSL_AES128CCM8 0x00010000L +# define SSL_AES256CCM8 0x00020000L -# define SSL_AES (SSL_AES128|SSL_AES256|SSL_AES128GCM|SSL_AES256GCM|SSL_AES128CCM|SSL_AES256CCM) +# define SSL_AES (SSL_AES128|SSL_AES256|SSL_AES128GCM|SSL_AES256GCM|SSL_AES128CCM|SSL_AES256CCM|SSL_AES128CCM8|SSL_AES256CCM8) # define SSL_CAMELLIA (SSL_CAMELLIA128|SSL_CAMELLIA256) /* Bits for algorithm_mac (symmetric authentication) */ diff --git a/ssl/t1_enc.c b/ssl/t1_enc.c index 87de2fe6c5..1f539aa174 100644 --- a/ssl/t1_enc.c +++ b/ssl/t1_enc.c @@ -509,7 +509,11 @@ int tls1_change_cipher_state(SSL *s, int which) goto err2; } } else if (EVP_CIPHER_mode(c) == EVP_CIPH_CCM_MODE) { - int taglen = 16; + int taglen; + if (s->s3->tmp.new_cipher->algorithm_enc & (SSL_AES128CCM8|SSL_AES256CCM8)) + taglen = 8; + else + taglen = 16; if (!EVP_CipherInit_ex(dd, c, NULL, NULL, NULL, (which & SSL3_CC_WRITE)) || !EVP_CIPHER_CTX_ctrl(dd, EVP_CTRL_AEAD_SET_IVLEN, 12, NULL) || !EVP_CIPHER_CTX_ctrl(dd, EVP_CTRL_AEAD_SET_TAG, taglen, NULL) |