[git] GnuPG - branch, master, updated. gnupg-2.1.0-beta864-26-g472a4a0

by Werner Koch cvs at cvs.gnupg.org
Sun Oct 19 14:25:06 CEST 2014


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  472a4a0d82add2d17154fa38e0074eaea56c28c1 (commit)
       via  1b8decc4767f0c55867327bdf3113204efcd19a7 (commit)
      from  6d9491842d5da597980eaa59e1e3e2137965fe09 (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 472a4a0d82add2d17154fa38e0074eaea56c28c1
Author: Werner Koch <wk at gnupg.org>
Date:   Sun Oct 19 14:17:23 2014 +0200

    gpg: Silence "packet with obsolete versoin" warnings.
    
    * g10/parse-packet.c (parse_key): Print warning only in very verbose
    mode.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/g10/parse-packet.c b/g10/parse-packet.c
index 50da17c..7787825 100644
--- a/g10/parse-packet.c
+++ b/g10/parse-packet.c
@@ -1949,7 +1949,8 @@ parse_key (IOBUF inp, int pkttype, unsigned long pktlen,
     }
   else if (version == 2 || version == 3)
     {
-      log_info ("packet(%d) with obsolete version %d\n", pkttype, version);
+      if (opt.verbose > 1)
+        log_info ("packet(%d) with obsolete version %d\n", pkttype, version);
       if (list_mode)
         es_fprintf (listfp, ":key packet: [obsolete version %d]\n", version);
       err = gpg_error (GPG_ERR_INV_PACKET);

commit 1b8decc4767f0c55867327bdf3113204efcd19a7
Author: Werner Koch <wk at gnupg.org>
Date:   Sun Oct 19 14:09:04 2014 +0200

    gpg: Make card key generation work again.
    
    * g10/call-agent.c (agent_scd_learn): Rename from agent_learn.
    (agent_learn): New.
    * g10/keygen.c (gen_card_key): Call new agent-learn.
    --
    
    Without a shadow key we can't create the self-signatures.  Thus we
    need to issue the learn command after each key generation.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/g10/call-agent.c b/g10/call-agent.c
index 080df18..cadc02c 100644
--- a/g10/call-agent.c
+++ b/g10/call-agent.c
@@ -639,9 +639,9 @@ learn_status_cb (void *opaque, const char *line)
   return 0;
 }
 
-/* Call the agent to learn about a smartcard */
+/* Call the scdaemon to learn about a smartcard */
 int
-agent_learn (struct agent_card_info_s *info)
+agent_scd_learn (struct agent_card_info_s *info)
 {
   int rc;
   struct default_inq_parm_s parm;
@@ -677,6 +677,29 @@ agent_learn (struct agent_card_info_s *info)
 }
 
 
+/* Call the agent to learn about the current smartcard.  This is
+   currently only used to have the agent create the shadow key.  */
+gpg_error_t
+agent_learn (void)
+{
+  gpg_error_t err;
+  struct default_inq_parm_s parm;
+
+  memset (&parm, 0, sizeof parm);
+
+  err = start_agent (NULL, 1);
+  if (err)
+    return err;
+
+  parm.ctx = agent_ctx;
+  err = assuan_transact (agent_ctx, "LEARN",
+                         dummy_data_cb, NULL, default_inq_cb, &parm,
+                         NULL, NULL);
+
+  return err;
+}
+
+
 int
 agent_keytocard (const char *hexgrip, int keyno, int force,
                  const char *serialno, const char *timestamp)
diff --git a/g10/call-agent.h b/g10/call-agent.h
index 5b4cd09..a99cac9 100644
--- a/g10/call-agent.h
+++ b/g10/call-agent.h
@@ -76,7 +76,10 @@ struct agent_card_genkey_s {
 void agent_release_card_info (struct agent_card_info_s *info);
 
 /* Return card info. */
-int agent_learn (struct agent_card_info_s *info);
+int agent_scd_learn (struct agent_card_info_s *info);
+
+/* Let the agent learn about the current card.  */
+gpg_error_t agent_learn (void);
 
 /* Update INFO with the attribute NAME. */
 int agent_scd_getattr (const char *name, struct agent_card_info_s *info);
diff --git a/g10/card-util.c b/g10/card-util.c
index b5be80a..d7a6754 100644
--- a/g10/card-util.c
+++ b/g10/card-util.c
@@ -80,7 +80,7 @@ change_pin (int unblock_v2, int allow_admin)
   struct agent_card_info_s info;
   int rc;
 
-  rc = agent_learn (&info);
+  rc = agent_scd_learn (&info);
   if (rc)
     {
       log_error (_("OpenPGP card not available: %s\n"),
@@ -370,7 +370,7 @@ card_status (estream_t fp, char *serialno, size_t serialnobuflen)
   if (serialno && serialnobuflen)
     *serialno = 0;
 
-  rc = agent_learn (&info);
+  rc = agent_scd_learn (&info);
   if (rc)
     {
       if (opt.with_colons)
diff --git a/g10/keygen.c b/g10/keygen.c
index 8095452..e25ecc3 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -4510,6 +4510,19 @@ gen_card_key (int algo, int keyno, int is_primary, kbnode_t pub_root,
       return err;
     }
 
+  /* Send the learn command so that the agent creates a shadow key for
+     card key.  We need to do that now so that we are able to create
+     the self-signatures. */
+  err = agent_learn ();
+  if (err)
+    {
+      /* Oops: Card removed during generation.  */
+      log_error (_("OpenPGP card not available: %s\n"), gpg_strerror (err));
+      xfree (pkt);
+      xfree (pk);
+      return err;
+    }
+
   if (*timestamp != info.created_at)
     log_info ("NOTE: the key does not use the suggested creation date\n");
   *timestamp = info.created_at;

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

Summary of changes:
 g10/call-agent.c   |   27 +++++++++++++++++++++++++--
 g10/call-agent.h   |    5 ++++-
 g10/card-util.c    |    4 ++--
 g10/keygen.c       |   13 +++++++++++++
 g10/parse-packet.c |    3 ++-
 5 files changed, 46 insertions(+), 6 deletions(-)


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




More information about the Gnupg-commits mailing list