[git] GnuPG - branch, master, updated. gnupg-2.1.8-50-g8ab63e4

by Neal H. Walfield cvs at cvs.gnupg.org
Tue Sep 29 11:37:31 CEST 2015


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  8ab63e4b5018044ecfb0b9910412487066886826 (commit)
       via  12443eafa6e19b94a8b554126423e2a5ccc2dd7e (commit)
      from  5c067d54d349fdfb3243634789c8841515d2c28f (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 8ab63e4b5018044ecfb0b9910412487066886826
Author: Neal H. Walfield <neal at g10code.com>
Date:   Thu Sep 24 14:11:13 2015 +0200

    g10: Remove unused struct cmp_help_context_s.
    
    * g10/sig-check.c (struct cmp_help_context_s) Remove unused struct.
    
    --
    Signed-off-by: Neal H. Walfield <neal at g10code.com>.

diff --git a/g10/sig-check.c b/g10/sig-check.c
index 8d150fe..d45a9f3 100644
--- a/g10/sig-check.c
+++ b/g10/sig-check.c
@@ -34,12 +34,6 @@
 #include "options.h"
 #include "pkglue.h"
 
-/* Context used by the compare function. */
-struct cmp_help_context_s
-{
-  PKT_signature *sig;
-  gcry_md_hd_t md;
-};
 
 
 

commit 12443eafa6e19b94a8b554126423e2a5ccc2dd7e
Author: Neal H. Walfield <neal at g10code.com>
Date:   Wed Sep 23 20:50:03 2015 +0200

    g10: Avoid an unnecessary copy.
    
    * g10/sig-check.c (signature_check2): Avoid copying PK to RET_PK.
    Instead, directly use the provided storage.  If none is provided
    allocate some.
    
    --
    Signed-off-by: Neal H. Walfield <neal at g10code.com>.

diff --git a/g10/sig-check.c b/g10/sig-check.c
index f8ba98b..8d150fe 100644
--- a/g10/sig-check.c
+++ b/g10/sig-check.c
@@ -60,10 +60,18 @@ signature_check (PKT_signature *sig, gcry_md_hd_t digest)
 
 int
 signature_check2 (PKT_signature *sig, gcry_md_hd_t digest, u32 *r_expiredate,
-		  int *r_expired, int *r_revoked, PKT_public_key *ret_pk )
+		  int *r_expired, int *r_revoked, PKT_public_key *pk )
 {
-    PKT_public_key *pk = xmalloc_clear( sizeof *pk );
     int rc=0;
+    int pk_internal;
+
+    if (pk)
+      pk_internal = 0;
+    else
+      {
+	pk_internal = 1;
+	pk = xmalloc_clear( sizeof *pk );
+      }
 
     if ( (rc=openpgp_md_test_algo(sig->digest_algo)) )
       ; /* We don't have this digest. */
@@ -91,7 +99,7 @@ signature_check2 (PKT_signature *sig, gcry_md_hd_t digest, u32 *r_expiredate,
         if(r_expiredate)
 	  *r_expiredate = pk->expiredate;
 
-	rc = do_check( pk, sig, digest, r_expired, r_revoked, ret_pk );
+	rc = do_check( pk, sig, digest, r_expired, r_revoked, NULL );
 
 	/* Check the backsig.  This is a 0x19 signature from the
 	   subkey on the primary key.  The idea here is that it should
@@ -122,7 +130,15 @@ signature_check2 (PKT_signature *sig, gcry_md_hd_t digest, u32 *r_expiredate,
 	  }
       }
 
-    free_public_key( pk );
+    if (pk_internal || rc)
+      {
+	release_public_key_parts (pk);
+	if (pk_internal)
+	  xfree (pk);
+	else
+	  /* Be very sure that the caller doesn't try to use *PK.  */
+	  memset (pk, 0, sizeof (*pk));
+      }
 
     if( !rc && sig->sig_class < 2 && is_status_enabled() ) {
 	/* This signature id works best with DLP algorithms because

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

Summary of changes:
 g10/sig-check.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)


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




More information about the Gnupg-commits mailing list