[git] GnuPG - branch, master, updated. gnupg-2.1.13-38-ge430ff6

by Werner Koch cvs at cvs.gnupg.org
Thu Jun 23 09:40:17 CEST 2016


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  e430ff6ad0b7dcfcebd92b825dd5168205447ff3 (commit)
       via  3694579bc4eef27ed53e1845bf03be38c299ce76 (commit)
       via  679aadb03ed272491ddf7f341a547dceb72b0a55 (commit)
      from  6f5ff1cfe449cf1f4cb7287bc57570eb794216b2 (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 e430ff6ad0b7dcfcebd92b825dd5168205447ff3
Author: Werner Koch <wk at gnupg.org>
Date:   Thu Jun 23 09:21:45 2016 +0200

    common: Change license of b64dec.c and b64enc.c to LGPLv2.1+
    
    --
    
    The code as solely been written by employees of g10 Code.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/common/b64dec.c b/common/b64dec.c
index e4128b3..9e8fb78 100644
--- a/common/b64dec.c
+++ b/common/b64dec.c
@@ -1,29 +1,20 @@
 /* b64dec.c - Simple Base64 decoder.
  * Copyright (C) 2008, 2011 Free Software Foundation, Inc.
+ * Copyright (C) 2008, 2011, 2016 g10 Code GmbH
  *
  * This file is part of GnuPG.
  *
  * This file is free software; you can redistribute it and/or modify
- * it under the terms of either
- *
- *   - the GNU Lesser General Public License as published by the Free
- *     Software Foundation; either version 3 of the License, or (at
- *     your option) any later version.
- *
- * or
- *
- *   - the GNU General Public License as published by the Free
- *     Software Foundation; either version 2 of the License, or (at
- *     your option) any later version.
- *
- * or both in parallel, as here.
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
  *
  * This file is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
+ * You should have received a copy of the GNU Lesser General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
diff --git a/common/b64enc.c b/common/b64enc.c
index 9101d98..af861fc 100644
--- a/common/b64enc.c
+++ b/common/b64enc.c
@@ -1,30 +1,22 @@
 /* b64enc.c - Simple Base64 encoder.
  * Copyright (C) 2001, 2003, 2004, 2008, 2010,
  *               2011 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2003, 2004, 2008, 2010,
+ *               2011 g10 Code GmbH
  *
  * This file is part of GnuPG.
  *
  * This file is free software; you can redistribute it and/or modify
- * it under the terms of either
- *
- *   - the GNU Lesser General Public License as published by the Free
- *     Software Foundation; either version 3 of the License, or (at
- *     your option) any later version.
- *
- * or
- *
- *   - the GNU General Public License as published by the Free
- *     Software Foundation; either version 2 of the License, or (at
- *     your option) any later version.
- *
- * or both in parallel, as here.
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
  *
  * This file is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
+ * You should have received a copy of the GNU Lesser General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 

commit 3694579bc4eef27ed53e1845bf03be38c299ce76
Author: Werner Koch <wk at gnupg.org>
Date:   Thu Jun 23 09:20:24 2016 +0200

    common: Add PGP armor decoding to b64dec.
    
    * common/b64dec.c (decoder_states): Add new states.
    (b64dec_proc): Handle PGP armored format.
    --
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/common/b64dec.c b/common/b64dec.c
index 3e02e4a..e4128b3 100644
--- a/common/b64dec.c
+++ b/common/b64dec.c
@@ -61,7 +61,7 @@ static unsigned char const asctobin[128] =
 
 enum decoder_states
   {
-    s_init, s_idle, s_lfseen, s_begin,
+    s_init, s_idle, s_lfseen, s_beginseen, s_waitheader, s_waitblank, s_begin,
     s_b64_0, s_b64_1, s_b64_2, s_b64_3,
     s_waitendtitle, s_waitend
   };
@@ -71,26 +71,18 @@ enum decoder_states
 /* Initialize the context for the base64 decoder.  If TITLE is NULL a
    plain base64 decoding is done.  If it is the empty string the
    decoder will skip everything until a "-----BEGIN " line has been
-   seen, decoding ends at a "----END " line.
-
-   Not yet implemented: If TITLE is either "PGP" or begins with "PGP "
-   the PGP armor lines are skipped as well.  */
+   seen, decoding ends at a "----END " line.  */
 gpg_error_t
 b64dec_start (struct b64state *state, const char *title)
 {
   memset (state, 0, sizeof *state);
   if (title)
     {
-      if (!strncmp (title, "PGP", 3) && (!title[3] || title[3] == ' '))
-        state->lasterr = gpg_error (GPG_ERR_NOT_IMPLEMENTED);
+      state->title = xtrystrdup (title);
+      if (!state->title)
+        state->lasterr = gpg_error_from_syserror ();
       else
-        {
-          state->title = xtrystrdup (title);
-          if (!state->title)
-            state->lasterr = gpg_error_from_syserror ();
-          else
-            state->idx = s_init;
-        }
+        state->idx = s_init;
     }
   else
     state->idx = s_b64_0;
@@ -123,6 +115,7 @@ b64dec_proc (struct b64state *state, void *buffer, size_t length,
 
   for (s=d=buffer; length && !state->stop_seen; length--, s++)
     {
+    again:
       switch (ds)
         {
         case s_idle:
@@ -136,12 +129,42 @@ b64dec_proc (struct b64state *state, void *buffer, size_t length,
           ds = s_lfseen;
         case s_lfseen:
           if (*s != "-----BEGIN "[pos])
-            ds = s_idle;
+            {
+              ds = s_idle;
+              goto again;
+            }
           else if (pos == 10)
-            ds = s_begin;
+            {
+              pos = 0;
+              ds = s_beginseen;
+            }
           else
             pos++;
           break;
+        case s_beginseen:
+          if (*s != "PGP "[pos])
+            ds = s_begin; /* Not a PGP armor.  */
+          else if (pos == 3)
+            ds = s_waitheader;
+          else
+            pos++;
+          break;
+        case s_waitheader:
+          if (*s == '\n')
+            ds = s_waitblank;
+          break;
+        case s_waitblank:
+          if (*s == '\n')
+            ds = s_b64_0; /* blank line found.  */
+          else if (*s == ' ' || *s == '\r' || *s == '\t')
+            ; /* Ignore spaces. */
+          else
+            {
+              /* Armor header line.  Note that we don't care that our
+               * FSM accepts a header prefixed with spaces.  */
+              ds = s_waitheader; /* Wait for next header.  */
+            }
+          break;
         case s_begin:
           if (*s == '\n')
             ds = s_b64_0;

commit 679aadb03ed272491ddf7f341a547dceb72b0a55
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Jun 22 18:40:35 2016 +0200

    tests: Add four more sample messages for the two new keys to the repo.
    
    --
    
    These are uncompressed signed messages

diff --git a/tests/openpgp/samplemsgs/signedz0-1-key-1.gpg b/tests/openpgp/samplemsgs/signedz0-1-key-1.gpg
new file mode 100644
index 0000000..400bcba
Binary files /dev/null and b/tests/openpgp/samplemsgs/signedz0-1-key-1.gpg differ
diff --git a/tests/openpgp/samplemsgs/signedz0-1-key-2.gpg b/tests/openpgp/samplemsgs/signedz0-1-key-2.gpg
new file mode 100644
index 0000000..55f3637
Binary files /dev/null and b/tests/openpgp/samplemsgs/signedz0-1-key-2.gpg differ
diff --git a/tests/openpgp/samplemsgs/signedz0-2-keys-1.gpg b/tests/openpgp/samplemsgs/signedz0-2-keys-1.gpg
new file mode 100644
index 0000000..84f2fd2
Binary files /dev/null and b/tests/openpgp/samplemsgs/signedz0-2-keys-1.gpg differ
diff --git a/tests/openpgp/samplemsgs/signedz0-2-keys-2.gpg b/tests/openpgp/samplemsgs/signedz0-2-keys-2.gpg
new file mode 100644
index 0000000..7e142b9
Binary files /dev/null and b/tests/openpgp/samplemsgs/signedz0-2-keys-2.gpg differ

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

Summary of changes:
 common/b64dec.c                                |  74 +++++++++++++++----------
 common/b64enc.c                                |  20 ++-----
 tests/openpgp/samplemsgs/signedz0-1-key-1.gpg  | Bin 0 -> 382 bytes
 tests/openpgp/samplemsgs/signedz0-1-key-2.gpg  | Bin 0 -> 220 bytes
 tests/openpgp/samplemsgs/signedz0-2-keys-1.gpg | Bin 0 -> 571 bytes
 tests/openpgp/samplemsgs/signedz0-2-keys-2.gpg | Bin 0 -> 585 bytes
 6 files changed, 50 insertions(+), 44 deletions(-)
 create mode 100644 tests/openpgp/samplemsgs/signedz0-1-key-1.gpg
 create mode 100644 tests/openpgp/samplemsgs/signedz0-1-key-2.gpg
 create mode 100644 tests/openpgp/samplemsgs/signedz0-2-keys-1.gpg
 create mode 100644 tests/openpgp/samplemsgs/signedz0-2-keys-2.gpg


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




More information about the Gnupg-commits mailing list