1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

agent: RSA signature verification by gpg-agent.

* g10/sign.c (do_sign): Let verify signature by gpg-agent.
* agent/pksign.c (agent_pksign_do): Call gcry_pk_verify for RSA.

--

RSA signature verification should be done to prevent attacks against
RSA CRT implementations and not to return invalid signature to
adversary.  Newer libgcrypt does so.  For older libgcrypt and
smartcards, gpg-agent does signature verification.
This commit is contained in:
NIIBE Yutaka 2015-09-29 09:49:44 +09:00
parent f1effdc5ec
commit cfbe6ba9cf
2 changed files with 39 additions and 33 deletions

View file

@ -229,7 +229,6 @@ do_sign (PKT_public_key *pksk, PKT_signature *sig,
gcry_md_hd_t md, int mdalgo, const char *cache_nonce)
{
gpg_error_t err;
gcry_mpi_t frame;
byte *dp;
char *hexgrip;
@ -292,35 +291,6 @@ do_sign (PKT_public_key *pksk, PKT_signature *sig,
}
xfree (hexgrip);
/* Check that the signature verification worked and nothing is
* fooling us e.g. by a bug in the signature create code or by
* deliberately introduced faults. Because Libgcrypt 1.7 does this
* for RSA internally there is no need to do it here again. */
if (!err
#if GCRYPT_VERSION_NUMBER >= 0x010700 /* Libgcrypt >= 1.7 */
&& !is_RSA (pksk->pubkey_algo)
#endif /* Libgcrypt >= 1.7 */
)
{
PKT_public_key *pk = xmalloc_clear (sizeof *pk);
if (get_pubkey (pk, sig->keyid ))
err = gpg_error (GPG_ERR_NO_PUBKEY);
else
{
frame = encode_md_value (pk, md, sig->digest_algo );
if (!frame)
err = gpg_error (GPG_ERR_GENERAL);
else
err = pk_verify (pk->pubkey_algo, frame, sig->data, pk->pkey);
gcry_mpi_release (frame);
}
if (err)
log_error (_("checking created signature failed: %s\n"),
gpg_strerror (err));
free_public_key (pk);
}
if (err)
log_error (_("signing failed: %s\n"), gpg_strerror (err));
else