]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
apps: updates for the new additional MAC_init arguments
authorPauli <ppzgs1@gmail.com>
Thu, 25 Feb 2021 03:48:00 +0000 (13:48 +1000)
committerPauli <ppzgs1@gmail.com>
Sun, 28 Feb 2021 07:25:48 +0000 (17:25 +1000)
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14310)

apps/lib/s_cb.c

index 3761d913956cb2b21368002444dba74c8aecf98a..6737eca13e1abc5cc0717e899c358d41cac551e3 100644 (file)
@@ -741,7 +741,7 @@ int generate_cookie_callback(SSL *ssl, unsigned char *cookie,
     int res = 0;
     EVP_MAC *hmac = NULL;
     EVP_MAC_CTX *ctx = NULL;
-    OSSL_PARAM params[3], *p = params;
+    OSSL_PARAM params[2], *p = params;
     size_t mac_len;
 
     /* Initialize a random secret */
@@ -792,14 +792,8 @@ int generate_cookie_callback(SSL *ssl, unsigned char *cookie,
             goto end;
     }
     *p++ = OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST, "SHA1", 0);
-    *p++ = OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY, cookie_secret,
-                                             COOKIE_SECRET_LENGTH);
     *p = OSSL_PARAM_construct_end();
-    if (!EVP_MAC_CTX_set_params(ctx, params)) {
-            BIO_printf(bio_err, "HMAC context parameter setting failed\n");
-            goto end;
-    }
-    if (!EVP_MAC_init(ctx)) {
+    if (!EVP_MAC_init(ctx, cookie_secret, COOKIE_SECRET_LENGTH, params)) {
             BIO_printf(bio_err, "HMAC context initialisation failed\n");
             goto end;
     }