[git] GnuPG - branch, master, updated. gnupg-2.2.1-59-g6c63a04

by NIIBE Yutaka cvs at cvs.gnupg.org
Wed Nov 1 02:40:41 CET 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  6c63a04569c07c9c2817c7c530a92ccfa58155cc (commit)
      from  d63b7966cdd72548c60466c620de5cd6104a779e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6c63a04569c07c9c2817c7c530a92ccfa58155cc
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Wed Nov 1 10:19:35 2017 +0900

    g10: Unattended key generation "Key-Grip" and "Subkey-Grip".
    
    * g10/keygen.c (pSUBKEYGRIP): New.
    (read_parameter_file): Add "Key-Grip" and "Subkey-Grip".
    (do_generate_keypair): Support pSUBKEYGRIP.
    
    --
    
    In the manual, it says "Key-Grip".  gpgsm also supports "Key-Grip".
    Adding "Subkey-Grip" now, adding "Key-Grip" makes sense.
    
    GnuPG-bug-id: 3478
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/g10/keygen.c b/g10/keygen.c
index 1dddfee..e63fbaa 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -89,7 +89,8 @@ enum para_name {
   pCARDBACKUPKEY,
   pHANDLE,
   pKEYSERVER,
-  pKEYGRIP
+  pKEYGRIP,
+  pSUBKEYGRIP,
 };
 
 struct para_data_s {
@@ -3648,6 +3649,8 @@ read_parameter_file (ctrl_t ctrl, const char *fname )
         { "Handle",         pHANDLE },
         { "Keyserver",      pKEYSERVER },
         { "Keygrip",        pKEYGRIP },
+        { "Key-Grip",       pKEYGRIP },
+        { "Subkey-grip",    pSUBKEYGRIP },
         { NULL, 0 }
     };
     IOBUF fp;
@@ -4696,8 +4699,7 @@ do_generate_keypair (ctrl_t ctrl, struct para_data_s *para,
   if (!err && card && get_parameter (para, pAUTHKEYTYPE))
     {
       err = gen_card_key (3, get_parameter_algo( para, pAUTHKEYTYPE, NULL ),
-                          0, pub_root, &timestamp,
-                          get_parameter_u32 (para, pKEYEXPIRE));
+                          0, pub_root, &timestamp, expire);
       if (!err)
         err = write_keybinding (ctrl, pub_root, pri_psk, NULL,
                                 PUBKEY_USAGE_AUTH, timestamp, cache_nonce);
@@ -4705,11 +4707,18 @@ do_generate_keypair (ctrl_t ctrl, struct para_data_s *para,
 
   if (!err && get_parameter (para, pSUBKEYTYPE))
     {
-      sub_psk = NULL;
+      int subkey_algo = get_parameter_algo (para, pSUBKEYTYPE, NULL);
+
       s = NULL;
-      if (!card || (s = get_parameter_value (para, pCARDBACKUPKEY)))
+      key_from_hexgrip = get_parameter_value (para, pSUBKEYGRIP);
+      if (key_from_hexgrip)
+        err = do_create_from_keygrip (ctrl, subkey_algo, key_from_hexgrip,
+                                      pub_root, timestamp,
+                                      get_parameter_u32 (para, pSUBKEYEXPIRE),
+                                      1);
+      else if (!card || (s = get_parameter_value (para, pCARDBACKUPKEY)))
         {
-          err = do_create (get_parameter_algo (para, pSUBKEYTYPE, NULL),
+          err = do_create (subkey_algo,
                            get_parameter_uint (para, pSUBKEYLENGTH),
                            get_parameter_value (para, pSUBKEYCURVE),
                            pub_root,
@@ -4735,9 +4744,7 @@ do_generate_keypair (ctrl_t ctrl, struct para_data_s *para,
         }
       else
         {
-          err = gen_card_key (2, get_parameter_algo (para, pSUBKEYTYPE, NULL),
-                              0, pub_root, &timestamp,
-                              get_parameter_u32 (para, pKEYEXPIRE));
+          err = gen_card_key (2, subkey_algo, 0, pub_root, &timestamp, expire);
         }
 
       if (!err)

-----------------------------------------------------------------------

Summary of changes:
 g10/keygen.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list