From: Pauli Date: Tue, 23 Feb 2021 01:48:57 +0000 (+1000) Subject: evp: upport modified gettable/settable ctx calls for ciphers X-Git-Tag: openssl-3.0.0-alpha13~159 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=292b4184d6fda8e0c5c62c22170e8ad464a1a3a7;p=thirdparty%2Fopenssl.git evp: upport modified gettable/settable ctx calls for ciphers Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/14240) --- diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index ebb876a8dc4..851c6d5d9a0 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -1220,17 +1220,45 @@ const OSSL_PARAM *EVP_CIPHER_gettable_params(const EVP_CIPHER *cipher) const OSSL_PARAM *EVP_CIPHER_settable_ctx_params(const EVP_CIPHER *cipher) { - if (cipher != NULL && cipher->settable_ctx_params != NULL) - return cipher->settable_ctx_params( - ossl_provider_ctx(EVP_CIPHER_provider(cipher))); + void *alg; + + if (cipher != NULL && cipher->settable_ctx_params != NULL) { + alg = ossl_provider_ctx(EVP_CIPHER_provider(cipher)); + return cipher->settable_ctx_params(NULL, alg); + } return NULL; } const OSSL_PARAM *EVP_CIPHER_gettable_ctx_params(const EVP_CIPHER *cipher) { - if (cipher != NULL && cipher->gettable_ctx_params != NULL) - return cipher->gettable_ctx_params( - ossl_provider_ctx(EVP_CIPHER_provider(cipher))); + void *alg; + + if (cipher != NULL && cipher->gettable_ctx_params != NULL) { + alg = ossl_provider_ctx(EVP_CIPHER_provider(cipher)); + return cipher->gettable_ctx_params(NULL, alg); + } + return NULL; +} + +const OSSL_PARAM *EVP_CIPHER_CTX_settable_params(EVP_CIPHER_CTX *cctx) +{ + void *alg; + + if (cctx != NULL && cctx->cipher->settable_ctx_params != NULL) { + alg = ossl_provider_ctx(EVP_CIPHER_provider(cctx->cipher)); + return cctx->cipher->settable_ctx_params(cctx->provctx, alg); + } + return NULL; +} + +const OSSL_PARAM *EVP_CIPHER_CTX_gettable_params(EVP_CIPHER_CTX *cctx) +{ + void *alg; + + if (cctx != NULL && cctx->cipher->gettable_ctx_params != NULL) { + alg = ossl_provider_ctx(EVP_CIPHER_provider(cctx->cipher)); + return cctx->cipher->gettable_ctx_params(cctx->provctx, alg); + } return NULL; } diff --git a/include/openssl/evp.h b/include/openssl/evp.h index 17250be90e8..6a2202d9544 100644 --- a/include/openssl/evp.h +++ b/include/openssl/evp.h @@ -816,6 +816,8 @@ int EVP_CIPHER_CTX_get_params(EVP_CIPHER_CTX *ctx, OSSL_PARAM params[]); const OSSL_PARAM *EVP_CIPHER_gettable_params(const EVP_CIPHER *cipher); const OSSL_PARAM *EVP_CIPHER_settable_ctx_params(const EVP_CIPHER *cipher); const OSSL_PARAM *EVP_CIPHER_gettable_ctx_params(const EVP_CIPHER *cipher); +const OSSL_PARAM *EVP_CIPHER_CTX_settable_params(EVP_CIPHER_CTX *ctx); +const OSSL_PARAM *EVP_CIPHER_CTX_gettable_params(EVP_CIPHER_CTX *ctx); const BIO_METHOD *BIO_f_md(void); const BIO_METHOD *BIO_f_base64(void);