diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2017-02-03 02:47:56 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2017-02-08 02:16:27 +0000 |
commit | 197421b120396a16588a8d9d969fe75908ea9d2e (patch) | |
tree | b270d4ebe0db5ddcc092e460331baa9f29250d9e /crypto/evp/e_aes.c | |
parent | 20fc2051d2f8ec678b62d5f5c9d799ce51368120 (diff) | |
download | openssl-197421b120396a16588a8d9d969fe75908ea9d2e.zip openssl-197421b120396a16588a8d9d969fe75908ea9d2e.tar.gz openssl-197421b120396a16588a8d9d969fe75908ea9d2e.tar.bz2 |
Make EVP_*Final work for CCM ciphers
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2550)
Diffstat (limited to 'crypto/evp/e_aes.c')
-rw-r--r-- | crypto/evp/e_aes.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crypto/evp/e_aes.c b/crypto/evp/e_aes.c index 857a402..451d32d 100644 --- a/crypto/evp/e_aes.c +++ b/crypto/evp/e_aes.c @@ -2129,6 +2129,10 @@ static int aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, if (cctx->tls_aad_len >= 0) return aes_ccm_tls_cipher(ctx, out, in, len); + /* EVP_*Final() doesn't return any data */ + if (in == NULL && out != NULL) + return 0; + if (!cctx->iv_set) return -1; @@ -2148,9 +2152,6 @@ static int aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, CRYPTO_ccm128_aad(ccm, in, len); return len; } - /* EVP_*Final() doesn't return any data */ - if (!in) - return 0; /* If not set length yet do it */ if (!cctx->len_set) { if (CRYPTO_ccm128_setiv(ccm, EVP_CIPHER_CTX_iv_noconst(ctx), |