Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main-src > by-pkgid > a05f635f8bbbe665ff06237a7c5ffdb8 > files > 7

gnupg-1.4.5-18.el5_10.src.rpm

diff -up gnupg-1.4.5/g10/getkey.c.no-usage gnupg-1.4.5/g10/getkey.c
--- gnupg-1.4.5/g10/getkey.c.no-usage	2006-06-25 12:58:40.000000000 +0200
+++ gnupg-1.4.5/g10/getkey.c	2013-10-11 14:13:15.327459855 +0200
@@ -1454,13 +1454,19 @@ parse_key_usage(PKT_signature *sig)
 
       if(flags)
 	key_usage |= PUBKEY_USAGE_UNKNOWN;
+
+      if (!key_usage)
+	key_usage |= PUBKEY_USAGE_NONE;
     }
+  else if (p) /* Key flags of length zero.  */
+    key_usage |= PUBKEY_USAGE_NONE;
 
   /* We set PUBKEY_USAGE_UNKNOWN to indicate that this key has a
      capability that we do not handle.  This serves to distinguish
      between a zero key usage which we handle as the default
      capabilities for that algorithm, and a usage that we do not
-     handle. */
+     handle.  Likewise we use PUBKEY_USAGE_NONE to indicate that
+     key_flags have been given but they do not specify any usage.  */
 
   return key_usage;
 }
diff -up gnupg-1.4.5/include/cipher.h.no-usage gnupg-1.4.5/include/cipher.h
--- gnupg-1.4.5/include/cipher.h.no-usage	2013-10-11 14:13:15.328459879 +0200
+++ gnupg-1.4.5/include/cipher.h	2013-10-11 14:18:26.471485953 +0200
@@ -52,6 +52,7 @@
 #define PUBKEY_USAGE_CERT    4      /* key is also good to certify other keys*/
 #define PUBKEY_USAGE_AUTH    8      /* key is good for authentication */
 #define PUBKEY_USAGE_UNKNOWN 128    /* key has an unknown usage bit */
+#define PUBKEY_USAGE_NONE    256                 /* No usage given. */
 
 #define DIGEST_ALGO_MD5       1
 #define DIGEST_ALGO_SHA1      2