aboutsummaryrefslogtreecommitdiffstats
path: root/g10/seckey-cert.c
diff options
context:
space:
mode:
Diffstat (limited to 'g10/seckey-cert.c')
-rw-r--r--g10/seckey-cert.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/g10/seckey-cert.c b/g10/seckey-cert.c
index 77e27ae7b..ac360bbcd 100644
--- a/g10/seckey-cert.c
+++ b/g10/seckey-cert.c
@@ -105,8 +105,14 @@ do_check( PKT_secret_key *sk, const char *tryagain_text )
md_write (h, data, ndata - 20);
md_final (h);
if (!memcmp (md_read (h, DIGEST_ALGO_SHA1),
- data + ndata - 20, 20) )
- csum = 0; /* digest does match */
+ data + ndata - 20, 20) ) {
+ /* digest does match. We have to keep the old
+ style checksum in sk->csum, so that the
+ test used for unprotected keys does work.
+ This test gets used when we are adding new
+ keys. */
+ sk->csum = csum = checksum (data, ndata-20);
+ }
md_close (h);
}
}