1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-02 12:01:32 +01:00

tkd: Fix PKSIGN.

Clean up confusion of hashing.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2023-03-20 11:08:51 +09:00
parent e57c072ea6
commit 512213d6ed
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054

View File

@ -920,13 +920,8 @@ do_pksign (struct key *key, int hash_algo,
size_t asnlen = sizeof (data); size_t asnlen = sizeof (data);
gcry_md_get_asnoid (hash_algo, data, &asnlen); 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) */ /* u_data_len == gcry_md_get_algo_dlen (hash_algo) */
memcpy (data+asnlen, u_data, u_data_len); memcpy (data+asnlen, u_data, u_data_len);
#endif
data_len = asnlen+gcry_md_get_algo_dlen (hash_algo); data_len = asnlen+gcry_md_get_algo_dlen (hash_algo);
} }
else if (key->key_type == KEY_EC) else if (key->key_type == KEY_EC)
@ -953,7 +948,8 @@ do_pksign (struct key *key, int hash_algo,
} }
/* Scute, YKCS11 */ /* 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); data_len = gcry_md_get_algo_dlen (hash_algo);
} }
} }