1
0
mirror of https://git.code.sf.net/p/linux-ima/ima-evm-utils synced 2025-04-28 06:33:36 +02:00

libimaevm: Use function parameter algo for name of hash

Instead of using the global variable imaevm_params.hash_algo as the
hash algo to use, use the algo parameter passed into the function.
Existing code in this function already uses 'algo' for writing the
hash into the header:

        hdr->hash_algo = imaevm_get_hash_algo(algo);

Fixes: 07e623b60848 ("ima-evm-utils: Convert sign_hash_v2 to EVP_PKEY API").
Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
Stefan Berger 2021-04-19 11:01:51 -04:00 committed by Mimi Zohar
parent 3feccd45a8
commit 309d3369bb

View File

@ -913,7 +913,7 @@ static int sign_hash_v2(const char *algo, const unsigned char *hash,
return -1; return -1;
} }
log_info("hash(%s): ", imaevm_params.hash_algo); log_info("hash(%s): ", algo);
log_dump(hash, size); log_dump(hash, size);
pkey = read_priv_pkey(keyfile, imaevm_params.keypass); pkey = read_priv_pkey(keyfile, imaevm_params.keypass);
@ -939,7 +939,7 @@ static int sign_hash_v2(const char *algo, const unsigned char *hash,
if (!EVP_PKEY_sign_init(ctx)) if (!EVP_PKEY_sign_init(ctx))
goto err; goto err;
st = "EVP_get_digestbyname"; st = "EVP_get_digestbyname";
if (!(md = EVP_get_digestbyname(imaevm_params.hash_algo))) if (!(md = EVP_get_digestbyname(algo)))
goto err; goto err;
st = "EVP_PKEY_CTX_set_signature_md"; st = "EVP_PKEY_CTX_set_signature_md";
if (!EVP_PKEY_CTX_set_signature_md(ctx, md)) if (!EVP_PKEY_CTX_set_signature_md(ctx, md))