From 512213d6ed1cf1ff7b2a274f8d0e50326903af96 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Mon, 20 Mar 2023 11:08:51 +0900 Subject: [PATCH] tkd: Fix PKSIGN. Clean up confusion of hashing. Signed-off-by: NIIBE Yutaka --- tkd/pkcs11.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tkd/pkcs11.c b/tkd/pkcs11.c index 9f802db14..33c19ecdd 100644 --- a/tkd/pkcs11.c +++ b/tkd/pkcs11.c @@ -920,13 +920,8 @@ do_pksign (struct key *key, int hash_algo, size_t asnlen = sizeof (data); gcry_md_get_asnoid (hash_algo, data, &asnlen); -#if 0 - gcry_md_hash_buffer (hash_algo, data+asnlen, - u_data, u_data_len); -#else /* u_data_len == gcry_md_get_algo_dlen (hash_algo) */ memcpy (data+asnlen, u_data, u_data_len); -#endif data_len = asnlen+gcry_md_get_algo_dlen (hash_algo); } else if (key->key_type == KEY_EC) @@ -953,7 +948,8 @@ do_pksign (struct key *key, int hash_algo, } /* Scute, YKCS11 */ - gcry_md_hash_buffer (hash_algo, data, u_data, u_data_len); + /* u_data_len == gcry_md_get_algo_dlen (hash_algo) */ + memcpy (data, u_data, u_data_len); data_len = gcry_md_get_algo_dlen (hash_algo); } }