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

* seckey-cert.c (do_check): Handle case when checksum was okay but

passphrase still wrong.  Roman Pavlik found such a case.

* mpicoder.c (mpi_read_from_buffer): Don't abort in case of an
invalid MPI but print a message and return NULL.  Use log_info and
not log_error.
This commit is contained in:
Werner Koch 2004-12-20 10:05:20 +00:00
parent be4bb5a88b
commit 9e3526f236
6 changed files with 49 additions and 8 deletions

View file

@ -1,3 +1,8 @@
2004-12-20 Werner Koch <wk@g10code.com>
* seckey-cert.c (do_check): Handle case when checksum was okay but
passphrase still wrong. Roman Pavlik found such a case.
2004-12-20 David Shaw <dshaw@jabberwocky.com>
* keyedit.c (keyedit_menu): Invisible alias "passwd" as

View file

@ -147,12 +147,20 @@ do_check( PKT_secret_key *sk, const char *tryagain_text, int mode,
}
}
/* must check it here otherwise the mpi_read_xx would fail
/* Must check it here otherwise the mpi_read_xx would fail
because the length may have an arbitrary value */
if( sk->csum == csum ) {
for( ; i < pubkey_get_nskey(sk->pubkey_algo); i++ ) {
nbytes = ndata;
sk->skey[i] = mpi_read_from_buffer(p, &nbytes, 1 );
if (!sk->skey[i])
{
/* Checksum was okay, but not correctly
decrypted. */
sk->csum = 0;
csum = 1;
break;
}
ndata -= nbytes;
p += nbytes;
}
@ -179,8 +187,15 @@ do_check( PKT_secret_key *sk, const char *tryagain_text, int mode,
csum += checksum (buffer, ndata);
mpi_free (sk->skey[i]);
sk->skey[i] = mpi_read_from_buffer (buffer, &ndata, 1);
assert (sk->skey[i]);
m_free (buffer);
if (!sk->skey[i])
{
/* Checksum was okay, but not correctly
decrypted. */
sk->csum = 0;
csum = 1;
break;
}
/* csum += checksum_mpi (sk->skey[i]); */
}
}