Relax CCM tag check.
authorDr. Stephen Henson <steve@openssl.org>
Tue, 9 Jun 2015 22:17:06 +0000 (23:17 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 6 Jul 2015 17:35:35 +0000 (18:35 +0100)
In CCM mode don't require a tag before initialising decrypt: this allows
the tag length to be set without requiring the tag.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 9cca7be11d62298b2af0722f94345012c86eaed4)

crypto/evp/e_aes.c

index 33cbed87f473197a892d5353153fb879d1aa6a04..1734a823c1e5c515a43380177544f9f576512bf2 100644 (file)
@@ -1771,7 +1771,7 @@ static int aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
     case EVP_CTRL_CCM_SET_TAG:
         if ((arg & 1) || arg < 4 || arg > 16)
             return 0;
-        if ((c->encrypt && ptr) || (!c->encrypt && !ptr))
+        if (c->encrypt && ptr)
             return 0;
         if (ptr) {
             cctx->tag_set = 1;