[Pkg-gnupg-commit] [gnupg2] 39/205: gpg: Initialize the primary key when generating a key.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed May 11 08:38:12 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gnupg2.

commit bf9d1248c80205795e26156f67aff0b3f796cfce
Author: Neal H. Walfield <neal at g10code.com>
Date:   Fri Feb 19 14:53:29 2016 +0100

    gpg: Initialize the primary key when generating a key.
    
    * g10/keygen.c (do_generate_keypair): Initialize
    pri_psk->flags.primary, pri_psk->keyid and pri_psk->main_keyid.
    
    --
    Signed-off-by: Neal H. Walfield <neal at g10code.com>
---
 g10/keygen.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/g10/keygen.c b/g10/keygen.c
index 7b5a35b..be132bb 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -4079,6 +4079,13 @@ do_generate_keypair (ctrl_t ctrl, struct para_data_s *para,
       assert (pri_psk);
     }
 
+  /* Make sure a few fields are correctly set up before going further.  */
+  pri_psk->flags.primary = 1;
+  keyid_from_pk (pri_psk, NULL);
+  /* We don't use pk_keyid to get keyid, because it also asserts that
+     main_keyid is set!  */
+  keyid_copy (pri_psk->main_keyid, pri_psk->keyid);
+
   if (!err && (revkey = get_parameter_revkey (para, pREVOKER)))
     err = write_direct_sig (pub_root, pri_psk, revkey, timestamp, cache_nonce);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list