diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/evp/e_aes.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c index a0f192905d..74d86c98d8 100644 --- a/src/lib/libcrypto/evp/e_aes.c +++ b/src/lib/libcrypto/evp/e_aes.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: e_aes.c,v 1.69 2025/06/03 08:42:15 kenjiro Exp $ */ | 1 | /* $OpenBSD: e_aes.c,v 1.70 2025/06/06 07:41:01 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -2032,7 +2032,14 @@ aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
2032 | CCM128_CONTEXT *ccm = &cctx->ccm; | 2032 | CCM128_CONTEXT *ccm = &cctx->ccm; |
2033 | 2033 | ||
2034 | /* If not set up, return error */ | 2034 | /* If not set up, return error */ |
2035 | if (!cctx->iv_set && !cctx->key_set) | 2035 | if (!cctx->key_set) |
2036 | return -1; | ||
2037 | |||
2038 | /* EVP_*Final() doesn't return any data */ | ||
2039 | if (in == NULL && out != NULL) | ||
2040 | return 0; | ||
2041 | |||
2042 | if (!cctx->iv_set) | ||
2036 | return -1; | 2043 | return -1; |
2037 | if (!ctx->encrypt && !cctx->tag_set) | 2044 | if (!ctx->encrypt && !cctx->tag_set) |
2038 | return -1; | 2045 | return -1; |
@@ -2051,9 +2058,7 @@ aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
2051 | CRYPTO_ccm128_aad(ccm, in, len); | 2058 | CRYPTO_ccm128_aad(ccm, in, len); |
2052 | return len; | 2059 | return len; |
2053 | } | 2060 | } |
2054 | /* EVP_*Final() doesn't return any data */ | 2061 | |
2055 | if (!in) | ||
2056 | return 0; | ||
2057 | /* If not set length yet do it */ | 2062 | /* If not set length yet do it */ |
2058 | if (!cctx->len_set) { | 2063 | if (!cctx->len_set) { |
2059 | if (CRYPTO_ccm128_setiv(ccm, ctx->iv, 15 - cctx->L, len)) | 2064 | if (CRYPTO_ccm128_setiv(ccm, ctx->iv, 15 - cctx->L, len)) |