[git] GnuPG - branch, master, updated. gnupg-2.2.7-344-g346a98f

by Werner Koch cvs at cvs.gnupg.org
Wed Jan 30 11:28:35 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  346a98fabe03adf2e202e36fc2aa24b1c2571154 (commit)
       via  6ecedd0b25b6b1a33be63b99f2a8256370000521 (commit)
      from  dee0138dc022c7113309087736312d2451adf115 (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 346a98fabe03adf2e202e36fc2aa24b1c2571154
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Jan 30 11:28:14 2019 +0100

    gpg: Allow generating Ed25519 key from an existing key.
    
    * g10/misc.c (map_pk_gcry_to_openpgp): Add EdDSA mapping.
    --
    
    Due to this missing mapping a "gpg --export --full-gen-key" with
    selection "13 - Existing key" did not worked for an ed25519 key.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/g10/misc.c b/g10/misc.c
index a3f0c67..0541d2b 100644
--- a/g10/misc.c
+++ b/g10/misc.c
@@ -513,6 +513,7 @@ map_pk_gcry_to_openpgp (enum gcry_pk_algos algo)
 {
   switch (algo)
     {
+    case GCRY_PK_EDDSA:  return PUBKEY_ALGO_EDDSA;
     case GCRY_PK_ECDSA:  return PUBKEY_ALGO_ECDSA;
     case GCRY_PK_ECDH:   return PUBKEY_ALGO_ECDH;
     default: return algo < 110 ? (pubkey_algo_t)algo : 0;

commit 6ecedd0b25b6b1a33be63b99f2a8256370000521
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Jan 30 08:28:56 2019 +0100

    common: New function decode_c_string.
    
    * common/miscellaneous.c (decode_c_string): New.
    --
    
    This is basically a copy from the code we use in gpgme and gpa.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/common/miscellaneous.c b/common/miscellaneous.c
index 0b374e6..2605528 100644
--- a/common/miscellaneous.c
+++ b/common/miscellaneous.c
@@ -328,6 +328,82 @@ make_printable_string (const void *p, size_t n, int delim )
 }
 
 
+/* Decode the C formatted string SRC and return the result in a newly
+ * allocated buffer.  In error returns NULL and sets ERRNO. */
+char *
+decode_c_string (const char *src)
+{
+  char *buffer, *dst;
+  int val;
+
+  /* The converted string will never be larger than the original
+     string.  */
+  buffer = dst = xtrymalloc (strlen (src) + 1);
+  if (!buffer)
+    return NULL;
+
+  while (*src)
+    {
+      if (*src != '\\')
+	{
+	  *dst++ = *src++;
+	  continue;
+	}
+
+#define DECODE_ONE(_m,_r) case _m: src += 2; *dst++ = _r; break;
+
+      switch (src[1])
+	{
+	  DECODE_ONE ('n', '\n');
+	  DECODE_ONE ('r', '\r');
+	  DECODE_ONE ('f', '\f');
+	  DECODE_ONE ('v', '\v');
+	  DECODE_ONE ('b', '\b');
+	  DECODE_ONE ('t', '\t');
+	  DECODE_ONE ('\\', '\\');
+	  DECODE_ONE ('\'', '\'');
+	  DECODE_ONE ('\"', '\"');
+
+	case 'x':
+          val = hextobyte (src+2);
+          if (val == -1)  /* Bad coding, keep as is. */
+            {
+              *dst++ = *src++;
+              *dst++ = *src++;
+              if (*src)
+                *dst++ = *src++;
+              if (*src)
+                *dst++ = *src++;
+            }
+          else if (!val)
+            {
+              /* A binary zero is not representable in a C string thus
+               * we keep the C-escaping.  Note that this will also
+               * never be larger than the source string.  */
+              *dst++ = '\\';
+              *dst++ = '0';
+              src += 4;
+            }
+          else
+            {
+              *(unsigned char *)dst++ = val;
+              src += 4;
+            }
+	  break;
+
+	default: /* Bad coding; keep as is..  */
+          *dst++ = *src++;
+          *dst++ = *src++;
+          break;
+        }
+#undef DECODE_ONE
+    }
+  *dst++ = 0;
+
+  return buffer;
+}
+
+
 /* Check whether (BUF,LEN) is valid header for an OpenPGP compressed
  * packet.  LEN should be at least 6.  */
 static int
diff --git a/common/util.h b/common/util.h
index 8234b62..a4b1cbd 100644
--- a/common/util.h
+++ b/common/util.h
@@ -303,6 +303,7 @@ void print_hexstring (FILE *fp, const void *buffer, size_t length,
                       int reserved);
 char *try_make_printable_string (const void *p, size_t n, int delim);
 char *make_printable_string (const void *p, size_t n, int delim);
+char *decode_c_string (const char *src);
 
 int is_file_compressed (const char *s, int *ret_rc);
 

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

Summary of changes:
 common/miscellaneous.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++
 common/util.h          |  1 +
 g10/misc.c             |  1 +
 3 files changed, 78 insertions(+)


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




More information about the Gnupg-commits mailing list