From: Richard Levitte Date: Tue, 9 Mar 2021 17:23:39 +0000 (+0100) Subject: PROV: use EVP_CIPHER_CTX_set_params() rather than EVP_CIPHER_CTX_ctrl() X-Git-Tag: openssl-3.0.0-alpha14~339 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c9d01f4186817612e8afa401951e0968aed83b2e;p=thirdparty%2Fopenssl.git PROV: use EVP_CIPHER_CTX_set_params() rather than EVP_CIPHER_CTX_ctrl() This is in gmac_final(), where the cipher is known to be fetched. It's more suitable to use OSSL_PARAMs than _ctrl functions, as the latter are expected to become obsolete. Fixes #14359 Reviewed-by: Paul Dale Reviewed-by: Shane Lontis (Merged from https://github.com/openssl/openssl/pull/14484) --- diff --git a/providers/implementations/macs/gmac_prov.c b/providers/implementations/macs/gmac_prov.c index 14ca9480776..1f4047ccd3e 100644 --- a/providers/implementations/macs/gmac_prov.c +++ b/providers/implementations/macs/gmac_prov.c @@ -146,6 +146,7 @@ static int gmac_update(void *vmacctx, const unsigned char *data, static int gmac_final(void *vmacctx, unsigned char *out, size_t *outl, size_t outsize) { + OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END }; struct gmac_data_st *macctx = vmacctx; int hlen = 0; @@ -155,10 +156,10 @@ static int gmac_final(void *vmacctx, unsigned char *out, size_t *outl, if (!EVP_EncryptFinal_ex(macctx->ctx, out, &hlen)) return 0; - /* TODO(3.0) Use params */ hlen = gmac_size(); - if (!EVP_CIPHER_CTX_ctrl(macctx->ctx, EVP_CTRL_AEAD_GET_TAG, - hlen, out)) + params[0] = OSSL_PARAM_construct_octet_string(OSSL_CIPHER_PARAM_AEAD_TAG, + out, (size_t)hlen); + if (!EVP_CIPHER_CTX_get_params(macctx->ctx, params)) return 0; *outl = hlen;