mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg: Fix modifying signature data by pk_verify for Ed25519.
* g10/pkglue.c (pk_verify): When fixing R and S, make sure those are copies. -- GnuPG-bug-id: 7426 Fixing-commit: 0a5a854510fda6e6990938a3fca424df868fe676 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
bb6b38c240
commit
70c49ce024
10
g10/pkglue.c
10
g10/pkglue.c
@ -331,6 +331,15 @@ pk_verify (pubkey_algo_t pkalgo, gcry_mpi_t hash,
|
|||||||
rc = gpg_error (GPG_ERR_BAD_MPI);
|
rc = gpg_error (GPG_ERR_BAD_MPI);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
r = gcry_mpi_copy (r);
|
||||||
|
s = gcry_mpi_copy (s);
|
||||||
|
|
||||||
|
if (!r || !s)
|
||||||
|
{
|
||||||
|
rc = gpg_error_from_syserror ();
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
|
||||||
/* We need to fixup the length in case of leading zeroes.
|
/* We need to fixup the length in case of leading zeroes.
|
||||||
* OpenPGP does not allow leading zeroes and the parser for
|
* OpenPGP does not allow leading zeroes and the parser for
|
||||||
* the signature packet has no information on the use curve,
|
* the signature packet has no information on the use curve,
|
||||||
@ -416,6 +425,7 @@ pk_verify (pubkey_algo_t pkalgo, gcry_mpi_t hash,
|
|||||||
if (!rc)
|
if (!rc)
|
||||||
rc = gcry_pk_verify (s_sig, s_hash, s_pkey);
|
rc = gcry_pk_verify (s_sig, s_hash, s_pkey);
|
||||||
|
|
||||||
|
leave:
|
||||||
gcry_sexp_release (s_sig);
|
gcry_sexp_release (s_sig);
|
||||||
gcry_sexp_release (s_hash);
|
gcry_sexp_release (s_hash);
|
||||||
gcry_sexp_release (s_pkey);
|
gcry_sexp_release (s_pkey);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user