summaryrefslogtreecommitdiffstats
path: root/g10/seckey-cert.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1999-01-07 18:05:48 +0100
committerWerner Koch <wk@gnupg.org>1999-01-07 18:05:48 +0100
commit7d0efec7cf5ae110c99511abc32587ff0c45b14f (patch)
treec25f43c0b175ca31c84da4e9a256b259ea070fc7 /g10/seckey-cert.c
parentSee ChangeLog: Sun Jan 3 15:28:44 CET 1999 Werner Koch (diff)
downloadgnupg2-7d0efec7cf5ae110c99511abc32587ff0c45b14f.tar.xz
gnupg2-7d0efec7cf5ae110c99511abc32587ff0c45b14f.zip
See ChangeLog: Thu Jan 7 18:00:58 CET 1999 Werner Koch
Diffstat (limited to 'g10/seckey-cert.c')
-rw-r--r--g10/seckey-cert.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/g10/seckey-cert.c b/g10/seckey-cert.c
index 6adfafdf4..5edebf782 100644
--- a/g10/seckey-cert.c
+++ b/g10/seckey-cert.c
@@ -44,7 +44,7 @@ do_check( PKT_secret_key *sk )
if( sk->is_protected ) { /* remove the protection */
DEK *dek = NULL;
- u32 keyid[2];
+ u32 keyid[4]; /* 4! because we need two of them */
CIPHER_HANDLE cipher_hd=NULL;
PKT_secret_key *save_sk;
char save_iv[8];
@@ -58,6 +58,13 @@ do_check( PKT_secret_key *sk )
return G10ERR_CIPHER_ALGO;
}
keyid_from_sk( sk, keyid );
+ keyid[2] = keyid[3] = 0;
+ if( !sk->is_primary ) {
+ PKT_secret_key *sk2 = m_alloc_clear( sizeof *sk2 );
+ if( !get_primary_seckey( sk2, keyid ) )
+ keyid_from_sk( sk2, keyid+2 );
+ free_secret_key( sk2 );
+ }
dek = passphrase_to_dek( keyid, sk->protect.algo,
&sk->protect.s2k, 0 );
cipher_hd = cipher_open( sk->protect.algo,