diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2015-09-29 02:49:44 +0200 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2015-09-29 02:49:44 +0200 |
commit | cfbe6ba9cf1414e9aa4977e2bbaecaa43154b2ae (patch) | |
tree | 9a23dd0ee6c45ed6d8046911d341ccabd92a578a /g10/sign.c | |
parent | common: Provide two new error code replacements. (diff) | |
download | gnupg2-cfbe6ba9cf1414e9aa4977e2bbaecaa43154b2ae.tar.xz gnupg2-cfbe6ba9cf1414e9aa4977e2bbaecaa43154b2ae.zip |
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.
Diffstat (limited to 'g10/sign.c')
-rw-r--r-- | g10/sign.c | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/g10/sign.c b/g10/sign.c index 7a8d6978e..4a30f1e16 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -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 |