[git] GpgOL - branch, master, updated. gpgol-2.2.0-66-g7f050d6

by Andre Heinecke cvs at cvs.gnupg.org
Wed Jul 18 14:21:05 CEST 2018


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 "GnuPG extension for MS Outlook".

The branch, master has been updated
       via  7f050d64eabf781a737b1890c839d64a51c6bef6 (commit)
       via  9c9edde2fbae79a41f9b13b79345692795a2c036 (commit)
       via  128a1570c1b2af58733081aca237247d92129600 (commit)
       via  9c0216de9a552a2ec5060fe426bdef51803aad02 (commit)
       via  aee94ccce1f3df1ef769197b1b2f7f693eac56ee (commit)
      from  1e699afd9531c6d0e4d7bde3efcdf5a323fc02a7 (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 7f050d64eabf781a737b1890c839d64a51c6bef6
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Jul 18 14:04:03 2018 +0200

    Minor performance improvement
    
    * src/parsecontroller.cpp (ParseController::parse): Check that
    get_ultimate_keys is only called once even for multisigs.

diff --git a/src/parsecontroller.cpp b/src/parsecontroller.cpp
index 29e5b30..323b1d3 100644
--- a/src/parsecontroller.cpp
+++ b/src/parsecontroller.cpp
@@ -448,22 +448,25 @@ ParseController::parse()
              SRCNAME, __func__, this, m_decrypt_result.error().code(),
              m_verify_result.error().code());
 
-  TRACEPOINT;
-
   bool has_valid_encrypted_checksum = false;
   /* Ensure that the Keys for the signatures are available
      and if it has a valid encrypted checksum. */
+  bool ultimate_keys_queried = false;
   for (const auto sig: m_verify_result.signatures())
     {
       has_valid_encrypted_checksum = is_valid_chksum (sig);
 
+      /* FIXME: This is very expensive. We need some caching here
+         or reduce the information */
       sig.key(true, true);
-      if (sig.validity() == Signature::Validity::Full ||
-          sig.validity() == Signature::Validity::Ultimate)
+      if (!ultimate_keys_queried &&
+          (sig.validity() == Signature::Validity::Full ||
+          sig.validity() == Signature::Validity::Ultimate))
         {
           /* Ensure that we have the keys with ultimate
              trust cached for the ui. */
           get_ultimate_keys ();
+          ultimate_keys_queried = true;
         }
     }
 

commit 9c9edde2fbae79a41f9b13b79345692795a2c036
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Jul 18 14:03:23 2018 +0200

    Print binary mime data as hex
    
    * src/mimedataprovider.cpp (MimeDataProvider::read): Dump
    binary as hex.

diff --git a/src/mimedataprovider.cpp b/src/mimedataprovider.cpp
index 2b48382..92be963 100644
--- a/src/mimedataprovider.cpp
+++ b/src/mimedataprovider.cpp
@@ -558,11 +558,21 @@ MimeDataProvider::read(void *buffer, size_t size)
   log_mime_parser ("%s:%s: Reading: " SIZE_T_FORMAT "Bytes",
                  SRCNAME, __func__, size);
   ssize_t bRead = m_crypto_data.read (buffer, size);
-  if (opt.enable_debug & DBG_MIME_PARSER)
+  if (opt.enable_debug & DBG_MIME_PARSER && bRead)
     {
       std::string buf ((char *)buffer, bRead);
-      log_mime_parser ("%s:%s: Data: \"%s\"",
-                     SRCNAME, __func__, buf.c_str());
+
+      if (!is_binary (buf))
+        {
+          log_mime_parser ("%s:%s: Data: \n------\n%s\n------",
+                           SRCNAME, __func__, buf.c_str());
+        }
+      else
+        {
+          log_mime_parser ("%s:%s: Hex Data: \n------\n%s\n------",
+                           SRCNAME, __func__,
+                           string_to_hex (buf).c_str ());
+        }
     }
   return bRead;
 }

commit 128a1570c1b2af58733081aca237247d92129600
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Jul 18 14:02:26 2018 +0200

    Minor perfomance improvement
    
    * src/mail.cpp (level_4_check): Reduce copies
    of get_ultimate_keys vector.

diff --git a/src/mail.cpp b/src/mail.cpp
index 1ea2a15..f2f99f4 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -2236,6 +2236,7 @@ level_4_check (const UserID &uid)
     }
   if (uid.validity () == UserID::Validity::Full)
     {
+      const auto ultimate_keys = ParseController::get_ultimate_keys ();
       for (const auto sig: uid.signatures ())
         {
           const char *sigID = sig.signerKeyID ();
@@ -2249,7 +2250,7 @@ level_4_check (const UserID &uid)
              through gnupg so we cached the keys with ultimate
              trust during parsing and now see if we find a direct
              trust path.*/
-          for (const auto secKey: ParseController::get_ultimate_keys ())
+          for (const auto secKey: ultimate_keys)
             {
               /* Check that the Key id of the key matches */
               const char *secKeyID = secKey.keyID ();

commit 9c0216de9a552a2ec5060fe426bdef51803aad02
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Jul 18 14:00:53 2018 +0200

    Only treat unknown sigs as lvl2 if they are valid
    
    * src/mail.cpp (Mail::updateSigstate): Check for sigsum valid
    before using WKD as shortcut to lvl 2.
    
    --
    Using GPGME's sigstate is clunky.

diff --git a/src/mail.cpp b/src/mail.cpp
index 84776ea..1ea2a15 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -1987,7 +1987,8 @@ Mail::updateSigstate ()
       m_is_signed = true;
       m_uid = get_uid_for_sender (sig.key(), sender.c_str());
 
-      if (m_uid.origin() == GpgME::Key::OriginWKD &&
+      if ((sig.summary() & Signature::Summary::Valid) &&
+          m_uid.origin() == GpgME::Key::OriginWKD &&
           (sig.validity() == Signature::Validity::Unknown ||
            sig.validity() == Signature::Validity::Marginal))
         {

commit aee94ccce1f3df1ef769197b1b2f7f693eac56ee
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Jul 18 13:59:45 2018 +0200

    Add helper functions for hexdump
    
    * src/cpphelp.cpp, src/cpphelp.h (is_binary, string_to_hex): New.

diff --git a/src/cpphelp.cpp b/src/cpphelp.cpp
index 20e4794..2dc25a4 100644
--- a/src/cpphelp.cpp
+++ b/src/cpphelp.cpp
@@ -254,3 +254,39 @@ gpgol_split (const std::string &s, char delim)
   internal_split (s, delim, std::back_inserter (elems));
   return elems;
 }
+
+std::string
+string_to_hex(const std::string& input)
+{
+    static const char* const lut = "0123456789ABCDEF";
+    size_t len = input.length();
+
+    std::string output;
+    output.reserve (3 * len + (len * 3 / 26));
+    for (size_t i = 0; i < len; ++i)
+    {
+        const unsigned char c = input[i];
+        output.push_back (lut[c >> 4]);
+        output.push_back (lut[c & 15]);
+        output.push_back (' ');
+        if (i % 26 == 0)
+          {
+            output.push_back ('\n');
+          }
+    }
+    return output;
+}
+
+bool
+is_binary (const std::string &input)
+{
+  for (int i = 0; i < input.size() - 1; ++i)
+    {
+      const unsigned char c = input[i];
+      if (c < 32 && c != 0x0d && c != 0x0a)
+        {
+          return true;
+        }
+    }
+  return false;
+}
diff --git a/src/cpphelp.h b/src/cpphelp.h
index 953f861..654ab19 100644
--- a/src/cpphelp.h
+++ b/src/cpphelp.h
@@ -46,5 +46,11 @@ bool in_de_vs_mode ();
 /* Get a map of all subkey value pairs in a registry key */
 std::map<std::string, std::string> get_registry_subkeys (const char *path);
 
-std::vector<std::string> gpgol_split(const std::string &s, char delim);
+std::vector<std::string> gpgol_split (const std::string &s, char delim);
+
+/* Convert a string to a hex representation */
+std::string string_to_hex (const std::string& input);
+
+/* Check if a string contains a char < 32 */
+bool is_binary (const std::string &input);
 #endif // CPPHELP_H

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

Summary of changes:
 src/cpphelp.cpp          | 36 ++++++++++++++++++++++++++++++++++++
 src/cpphelp.h            |  8 +++++++-
 src/mail.cpp             |  6 ++++--
 src/mimedataprovider.cpp | 16 +++++++++++++---
 src/parsecontroller.cpp  | 11 +++++++----
 5 files changed, 67 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
GnuPG extension for MS Outlook
http://git.gnupg.org




More information about the Gnupg-commits mailing list