From: Tomas Mraz Date: Tue, 12 Sep 2023 16:54:55 +0000 (+0200) Subject: Revert "Add dupctx support to aead ciphers" X-Git-Tag: openssl-3.1.3~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d74ef8d89c408d419e41edb877e984d4052250c6;p=thirdparty%2Fopenssl.git Revert "Add dupctx support to aead ciphers" This reverts commit a982016c56f8c631e0906b0a33f4feaf3d20a2ff. Reviewed-by: Paul Dale Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/22081) --- diff --git a/providers/implementations/ciphers/cipher_aes_ccm.c b/providers/implementations/ciphers/cipher_aes_ccm.c index 3930f52d606..bb4b1e1e649 100644 --- a/providers/implementations/ciphers/cipher_aes_ccm.c +++ b/providers/implementations/ciphers/cipher_aes_ccm.c @@ -33,26 +33,6 @@ static void *aes_ccm_newctx(void *provctx, size_t keybits) return ctx; } -static void *aes_ccm_dupctx(void *provctx) -{ - PROV_AES_CCM_CTX *ctx = provctx; - PROV_AES_CCM_CTX *dupctx = NULL; - - if (ctx == NULL) - return NULL; - dupctx = OPENSSL_memdup(provctx, sizeof(*ctx)); - if (dupctx == NULL) - return NULL; - /* - * ossl_cm_initctx, via the ossl_prov_aes_hw_ccm functions assign a - * provctx->ccm.ks.ks to the ccm context key so we need to point it to - * the memduped copy - */ - dupctx->base.ccm_ctx.key = &dupctx->ccm.ks.ks; - - return dupctx; -} - static OSSL_FUNC_cipher_freectx_fn aes_ccm_freectx; static void aes_ccm_freectx(void *vctx) { diff --git a/providers/implementations/ciphers/cipher_aes_gcm.c b/providers/implementations/ciphers/cipher_aes_gcm.c index 0a15693cc1a..0081ca6cd77 100644 --- a/providers/implementations/ciphers/cipher_aes_gcm.c +++ b/providers/implementations/ciphers/cipher_aes_gcm.c @@ -34,15 +34,6 @@ static void *aes_gcm_newctx(void *provctx, size_t keybits) return ctx; } -static void *aes_gcm_dupctx(void *provctx) -{ - PROV_AES_GCM_CTX *ctx = provctx; - - if (ctx == NULL) - return NULL; - return OPENSSL_memdup(ctx, sizeof(*ctx)); -} - static OSSL_FUNC_cipher_freectx_fn aes_gcm_freectx; static void aes_gcm_freectx(void *vctx) { diff --git a/providers/implementations/ciphers/cipher_aria_ccm.c b/providers/implementations/ciphers/cipher_aria_ccm.c index 39a96a6f140..d6b5517ee09 100644 --- a/providers/implementations/ciphers/cipher_aria_ccm.c +++ b/providers/implementations/ciphers/cipher_aria_ccm.c @@ -28,15 +28,6 @@ static void *aria_ccm_newctx(void *provctx, size_t keybits) return ctx; } -static void *aria_ccm_dupctx(void *provctx) -{ - PROV_ARIA_CCM_CTX *ctx = provctx; - - if (ctx == NULL) - return NULL; - return OPENSSL_memdup(ctx, sizeof(*ctx)); -} - static void aria_ccm_freectx(void *vctx) { PROV_ARIA_CCM_CTX *ctx = (PROV_ARIA_CCM_CTX *)vctx; diff --git a/providers/implementations/ciphers/cipher_aria_gcm.c b/providers/implementations/ciphers/cipher_aria_gcm.c index 6ffa0910fa2..b412bd3202f 100644 --- a/providers/implementations/ciphers/cipher_aria_gcm.c +++ b/providers/implementations/ciphers/cipher_aria_gcm.c @@ -27,15 +27,6 @@ static void *aria_gcm_newctx(void *provctx, size_t keybits) return ctx; } -static void *aria_gcm_dupctx(void *provctx) -{ - PROV_ARIA_GCM_CTX *ctx = provctx; - - if (ctx == NULL) - return NULL; - return OPENSSL_memdup(ctx, sizeof(*ctx)); -} - static OSSL_FUNC_cipher_freectx_fn aria_gcm_freectx; static void aria_gcm_freectx(void *vctx) { diff --git a/providers/implementations/ciphers/cipher_sm4_ccm.c b/providers/implementations/ciphers/cipher_sm4_ccm.c index fa4b216a024..38e75016e93 100644 --- a/providers/implementations/ciphers/cipher_sm4_ccm.c +++ b/providers/implementations/ciphers/cipher_sm4_ccm.c @@ -28,15 +28,6 @@ static void *sm4_ccm_newctx(void *provctx, size_t keybits) return ctx; } -static void *sm4_ccm_dupctx(void *provctx) -{ - PROV_SM4_CCM_CTX *ctx = provctx; - - if (ctx == NULL) - return NULL; - return OPENSSL_memdup(ctx, sizeof(*ctx)); -} - static void sm4_ccm_freectx(void *vctx) { PROV_SM4_CCM_CTX *ctx = (PROV_SM4_CCM_CTX *)vctx; diff --git a/providers/implementations/ciphers/cipher_sm4_gcm.c b/providers/implementations/ciphers/cipher_sm4_gcm.c index 88761a30f04..ce1aa2b07d5 100644 --- a/providers/implementations/ciphers/cipher_sm4_gcm.c +++ b/providers/implementations/ciphers/cipher_sm4_gcm.c @@ -29,15 +29,6 @@ static void *sm4_gcm_newctx(void *provctx, size_t keybits) return ctx; } -static void *sm4_gcm_dupctx(void *provctx) -{ - PROV_SM4_GCM_CTX *ctx = provctx; - - if (ctx == NULL) - return NULL; - return OPENSSL_memdup(ctx, sizeof(*ctx)); -} - static void sm4_gcm_freectx(void *vctx) { PROV_SM4_GCM_CTX *ctx = (PROV_SM4_GCM_CTX *)vctx; diff --git a/providers/implementations/include/prov/ciphercommon_aead.h b/providers/implementations/include/prov/ciphercommon_aead.h index de3dd52ee7c..1d017175d32 100644 --- a/providers/implementations/include/prov/ciphercommon_aead.h +++ b/providers/implementations/include/prov/ciphercommon_aead.h @@ -23,14 +23,9 @@ static void * alg##kbits##lc##_newctx(void *provctx) \ { \ return alg##_##lc##_newctx(provctx, kbits); \ } \ -static void * alg##kbits##lc##_dupctx(void *src) \ -{ \ - return alg##_##lc##_dupctx(src); \ -} \ const OSSL_DISPATCH ossl_##alg##kbits##lc##_functions[] = { \ { OSSL_FUNC_CIPHER_NEWCTX, (void (*)(void))alg##kbits##lc##_newctx }, \ { OSSL_FUNC_CIPHER_FREECTX, (void (*)(void))alg##_##lc##_freectx }, \ - { OSSL_FUNC_CIPHER_DUPCTX, (void (*)(void))alg##kbits##lc##_dupctx }, \ { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))ossl_##lc##_einit }, \ { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))ossl_##lc##_dinit }, \ { OSSL_FUNC_CIPHER_UPDATE, (void (*)(void))ossl_##lc##_stream_update }, \