[git] GnuPG - branch, master, updated. gnupg-2.2.7-317-gdafffa9

by NIIBE Yutaka cvs at cvs.gnupg.org
Wed Jan 16 02:32:20 CET 2019


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  dafffa95b2317bcb80fff1fd6d2bc7b4e6b1e206 (commit)
      from  6c000d4b78b836686e5a2789cc88a41e465e4400 (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 dafffa95b2317bcb80fff1fd6d2bc7b4e6b1e206
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Wed Jan 16 10:27:21 2019 +0900

    gpg: Report STATUS_NO_SECKEY when it is examined.
    
    * g10/packet.h (struct pubkey_enc_list): Add result.
    * g10/mainproc.c (proc_pubkey_enc): Initialize ->result.
    (proc_encrypted): Report STATUS_NO_SECKEY status.
    * g10/pubkey-enc.c (get_session_key): Set ->result.
    
    --
    
    This change is for GPGME compatibility.  Before this change,
    gpgme/tests/json/t-json failed with t-decrypt-verify.
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/g10/mainproc.c b/g10/mainproc.c
index dce3f37..8c41088 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -481,6 +481,7 @@ proc_pubkey_enc (CTX c, PACKET *pkt)
       x->keyid[0] = enc->keyid[0];
       x->keyid[1] = enc->keyid[1];
       x->pubkey_algo = enc->pubkey_algo;
+      x->result = -1;
       x->data[0] = x->data[1] = NULL;
       if (enc->data[0])
         {
@@ -577,22 +578,21 @@ proc_encrypted (CTX c, PACKET *pkt)
     {
       c->dek = xmalloc_secure_clear (sizeof *c->dek);
       result = get_session_key (c->ctrl, c->pkenc_list, c->dek);
-      if (result  == GPG_ERR_NO_SECKEY)
-        {
-          if (is_status_enabled ())
-            {
-              struct pubkey_enc_list *list;
-
-              for (list = c->pkenc_list; list; list = list->next)
-                {
-                  char buf[20];
-                  snprintf (buf, sizeof buf, "%08lX%08lX",
-                            (ulong)list->keyid[0], (ulong)list->keyid[1]);
-                  write_status_text (STATUS_NO_SECKEY, buf);
-                }
-            }
+      if (is_status_enabled ())
+        {
+          struct pubkey_enc_list *list;
+
+          for (list = c->pkenc_list; list; list = list->next)
+            if (list->result == GPG_ERR_NO_SECKEY)
+              {
+                char buf[20];
+                snprintf (buf, sizeof buf, "%08lX%08lX",
+                          (ulong)list->keyid[0], (ulong)list->keyid[1]);
+                write_status_text (STATUS_NO_SECKEY, buf);
+              }
         }
-      else if (result)
+
+      if (result)
         {
           log_info (_("public key decryption failed: %s\n"),
                     gpg_strerror (result));
diff --git a/g10/packet.h b/g10/packet.h
index 1ec12d6..78a57ba 100644
--- a/g10/packet.h
+++ b/g10/packet.h
@@ -137,6 +137,7 @@ struct pubkey_enc_list
   struct pubkey_enc_list *next;
   u32 keyid[2];
   int pubkey_algo;
+  int result;
   gcry_mpi_t data[PUBKEY_MAX_NENC];
 };
 
diff --git a/g10/pubkey-enc.c b/g10/pubkey-enc.c
index ad0a77e..e0a6e8a 100644
--- a/g10/pubkey-enc.c
+++ b/g10/pubkey-enc.c
@@ -132,6 +132,8 @@ get_session_key (ctrl_t ctrl, struct pubkey_enc_list *list, DEK *dek)
           if (openpgp_pk_test_algo2 (k->pubkey_algo, PUBKEY_USAGE_ENC))
             continue;
 
+          k->result = GPG_ERR_NO_SECKEY;
+
           if (sk->pubkey_algo != k->pubkey_algo)
             continue;
 
@@ -155,6 +157,7 @@ get_session_key (ctrl_t ctrl, struct pubkey_enc_list *list, DEK *dek)
           rc = get_it (ctrl, k, dek, sk, keyid);
           if (!rc)
             {
+              k->result = 0;
               if (!opt.quiet && !k->keyid[0] && !k->keyid[1])
                 log_info (_("okay, we are the anonymous recipient.\n"));
               search_for_secret_keys = 0;

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

Summary of changes:
 g10/mainproc.c   | 30 +++++++++++++++---------------
 g10/packet.h     |  1 +
 g10/pubkey-enc.c |  3 +++
 3 files changed, 19 insertions(+), 15 deletions(-)


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




More information about the Gnupg-commits mailing list