summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/e_aes.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/evp/e_aes.c')
-rw-r--r--src/lib/libcrypto/evp/e_aes.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c
index 3d3b1a9d6c..3d357f0119 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.53 2023/07/07 19:37:53 beck Exp $ */ 1/* $OpenBSD: e_aes.c,v 1.54 2023/09/28 11:29:10 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 *
@@ -1305,7 +1305,11 @@ aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
1305 gctx->tls_aad_len = -1; 1305 gctx->tls_aad_len = -1;
1306 return 1; 1306 return 1;
1307 1307
1308 case EVP_CTRL_GCM_SET_IVLEN: 1308 case EVP_CTRL_AEAD_GET_IVLEN:
1309 *(int *)ptr = gctx->ivlen;
1310 return 1;
1311
1312 case EVP_CTRL_AEAD_SET_IVLEN:
1309 if (arg <= 0) 1313 if (arg <= 0)
1310 return 0; 1314 return 0;
1311 /* Allocate memory for IV if needed */ 1315 /* Allocate memory for IV if needed */
@@ -1631,6 +1635,7 @@ aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
1631 1635
1632#define CUSTOM_FLAGS \ 1636#define CUSTOM_FLAGS \
1633 ( EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CUSTOM_IV | \ 1637 ( EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CUSTOM_IV | \
1638 EVP_CIPH_FLAG_CUSTOM_IV_LENGTH | \
1634 EVP_CIPH_FLAG_CUSTOM_CIPHER | EVP_CIPH_ALWAYS_CALL_INIT | \ 1639 EVP_CIPH_FLAG_CUSTOM_CIPHER | EVP_CIPH_ALWAYS_CALL_INIT | \
1635 EVP_CIPH_CTRL_INIT | EVP_CIPH_CUSTOM_COPY ) 1640 EVP_CIPH_CTRL_INIT | EVP_CIPH_CUSTOM_COPY )
1636 1641
@@ -1968,7 +1973,11 @@ aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
1968 cctx->len_set = 0; 1973 cctx->len_set = 0;
1969 return 1; 1974 return 1;
1970 1975
1971 case EVP_CTRL_CCM_SET_IVLEN: 1976 case EVP_CTRL_AEAD_GET_IVLEN:
1977 *(int *)ptr = 15 - cctx->L;
1978 return 1;
1979
1980 case EVP_CTRL_AEAD_SET_IVLEN:
1972 arg = 15 - arg; 1981 arg = 15 - arg;
1973 1982
1974 case EVP_CTRL_CCM_SET_L: 1983 case EVP_CTRL_CCM_SET_L: