]> wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
Properly set expected digest size for mac in provider
authorDmitry Belyavskiy <beldmit@gmail.com>
Sun, 14 Nov 2021 10:46:20 +0000 (11:46 +0100)
committerDmitry Belyavskiy <beldmit@gmail.com>
Sun, 14 Nov 2021 10:46:20 +0000 (11:46 +0100)
test_digest.c

index 9d3019a9cc8363848bd63d5194038177b3b35bdb..b9c48810abe8b1357bd6210aa24d00c77485ef20 100644 (file)
@@ -637,7 +637,7 @@ static int do_mac(int iter, EVP_MAC *mac, const char *plaintext,
 
     size_t acpkm = (size_t)t->acpkm;
     size_t acpkm_t = (size_t)t->acpkm_t;
-    OSSL_PARAM params[] = { OSSL_PARAM_END, OSSL_PARAM_END, OSSL_PARAM_END };
+    OSSL_PARAM params[] = { OSSL_PARAM_END, OSSL_PARAM_END, OSSL_PARAM_END, OSSL_PARAM_END };
     OSSL_PARAM *p = params;
     if (acpkm) {
         *p++ = OSSL_PARAM_construct_size_t("key-mesh", &acpkm);
@@ -650,8 +650,10 @@ static int do_mac(int iter, EVP_MAC *mac, const char *plaintext,
     if (t->outsize)
         T(EVP_MAC_CTX_get_mac_size(ctx) == t->outsize);
     size_t outsize;
-    if (t->truncate)
+    if (t->truncate) {
         outsize = t->truncate;
+       *p++ = OSSL_PARAM_construct_size_t("size", &outsize);
+    }
     else
         outsize = EVP_MAC_CTX_get_mac_size(ctx);