]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
PROV: use EVP_CIPHER_CTX_set_params() rather than EVP_CIPHER_CTX_ctrl()
authorRichard Levitte <levitte@openssl.org>
Tue, 9 Mar 2021 17:23:39 +0000 (18:23 +0100)
committerRichard Levitte <levitte@openssl.org>
Thu, 11 Mar 2021 16:21:59 +0000 (17:21 +0100)
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 <pauli@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14484)

providers/implementations/macs/gmac_prov.c

index 14ca948077633c160b64a798526a0cdb25c826b9..1f4047ccd3e6f9ec572850b23f640266e6502c98 100644 (file)
@@ -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;