|
|
83639f |
From ea10a33d26572eebde59565179f622b6fb240d04 Mon Sep 17 00:00:00 2001
|
|
|
83639f |
From: Patrick Uiterwijk <patrick@puiterwijk.org>
|
|
|
83639f |
Date: Wed, 6 Jan 2021 10:43:34 +0100
|
|
|
83639f |
Subject: [PATCH] Fix sign_hash not observing the hashalgo argument
|
|
|
83639f |
|
|
|
83639f |
This fixes sign_hash not using the correct algorithm for creating the
|
|
|
83639f |
signature, by ensuring it uses the passed in variable value.
|
|
|
83639f |
|
|
|
83639f |
Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
|
|
|
83639f |
---
|
|
|
83639f |
src/libimaevm.c | 4 ++--
|
|
|
83639f |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
83639f |
|
|
|
83639f |
diff --git a/src/libimaevm.c b/src/libimaevm.c
|
|
|
83639f |
index fa6c27858d0f..72d5e67f6fdd 100644
|
|
|
83639f |
--- a/src/libimaevm.c
|
|
|
83639f |
+++ b/src/libimaevm.c
|
|
|
83639f |
@@ -916,7 +916,7 @@ static int sign_hash_v2(const char *algo, const unsigned char *hash,
|
|
|
83639f |
return -1;
|
|
|
83639f |
}
|
|
|
83639f |
|
|
|
83639f |
- log_info("hash(%s): ", imaevm_params.hash_algo);
|
|
|
83639f |
+ log_info("hash(%s): ", algo);
|
|
|
83639f |
log_dump(hash, size);
|
|
|
83639f |
|
|
|
83639f |
pkey = read_priv_pkey(keyfile, imaevm_params.keypass);
|
|
|
83639f |
@@ -942,7 +942,7 @@ static int sign_hash_v2(const char *algo, const unsigned char *hash,
|
|
|
83639f |
if (!EVP_PKEY_sign_init(ctx))
|
|
|
83639f |
goto err;
|
|
|
83639f |
st = "EVP_get_digestbyname";
|
|
|
83639f |
- if (!(md = EVP_get_digestbyname(imaevm_params.hash_algo)))
|
|
|
83639f |
+ if (!(md = EVP_get_digestbyname(algo)))
|
|
|
83639f |
goto err;
|
|
|
83639f |
st = "EVP_PKEY_CTX_set_signature_md";
|
|
|
83639f |
if (!EVP_PKEY_CTX_set_signature_md(ctx, md))
|
|
|
83639f |
--
|
|
|
83639f |
2.29.2
|
|
|
83639f |
|