Allow ChaCha20-Poly1305 in DTLS
authorRich Salz <rsalz@akamai.com>
Fri, 11 Dec 2015 19:48:09 +0000 (14:48 -0500)
committerRich Salz <rsalz@akamai.com>
Fri, 11 Dec 2015 19:48:09 +0000 (14:48 -0500)
GCM and CCM are modes of operation for block ciphers only. ChaCha20-Poly1305
operates in neither of them but it is AEAD. This change also enables future
AEAD ciphers to be available for use with DTLS.

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
ssl/statem/statem_dtls.c

index 5194c7308e448a19d62f59d32a6e04c38e6c9f33..258c6fc077d1297f49f8e6ba32402ec6621eced0 100644 (file)
@@ -235,8 +235,8 @@ int dtls1_do_write(SSL *s, int type)
 
     if (s->write_hash) {
         if (s->enc_write_ctx
 
     if (s->write_hash) {
         if (s->enc_write_ctx
-            && ((EVP_CIPHER_CTX_mode(s->enc_write_ctx) == EVP_CIPH_GCM_MODE) ||
-                (EVP_CIPHER_CTX_mode(s->enc_write_ctx) == EVP_CIPH_CCM_MODE)))
+            && (EVP_CIPHER_CTX_flags(s->enc_write_ctx) &
+                EVP_CIPH_FLAG_AEAD_CIPHER) != 0)
             mac_size = 0;
         else
             mac_size = EVP_MD_CTX_size(s->write_hash);
             mac_size = 0;
         else
             mac_size = EVP_MD_CTX_size(s->write_hash);