]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Avoid using base64 armor auto-detection which causes decoding errors in win32.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 30 Dec 2011 15:23:02 +0000 (17:23 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 30 Dec 2011 15:24:59 +0000 (17:24 +0200)
For some reason reading from the stream modifies the stream
and this work-around avoids that issue.

NEWS
lib/openpgp/pgp.c
lib/openpgp/privkey.c

diff --git a/NEWS b/NEWS
index a1a0e737fbd2c1a9f54bac7b15731ba3d748159a..869a428a0cbc9b242d8b5b19dcc22b87c4c74786 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,11 @@ See the end for copying conditions.
 ** gnutls-cli/serv: Set don't fragment bit in DTLS sessions
 in Linux as well as in BSD.
 
+** libgnutls: When GNUTLS_OPENPGP_FMT_BASE64 is specified
+the stream is assumed to be base64 encoded (previously
+the encoding was auto-detected). This avoids a decoding
+issue in windows systems.
+
 ** libgnutls: Corrected ciphersuite GNUTLS_ECDHE_PSK_AES_256_CBC_SHA384
 
 ** libgnutls: Added ciphersuites: GNUTLS_PSK_WITH_AES_256_GCM_SHA384
index 2510ae917b172728e4c4982295d6eb6f1740d83c..e01264448aa93dd14bf8f7a2e6eeba162d61969b 100644 (file)
@@ -118,8 +118,7 @@ gnutls_openpgp_crt_import (gnutls_openpgp_crt_t key,
           gnutls_assert ();
           return rc;
         }
-      if (cdk_armor_filter_use (inp))
-        rc = cdk_stream_set_armor_flag (inp, 0);
+      rc = cdk_stream_set_armor_flag (inp, 0);
       if (!rc)
         rc = cdk_keydb_get_keyblock (inp, &key->knode);
       cdk_stream_close (inp);
index 0ee05325b4dbb9f7317e8e7dfb6fa858c639a486..f43c53b7babc84e8d6d8802be0dc74ae9fd545ad 100644 (file)
@@ -199,16 +199,13 @@ gnutls_openpgp_privkey_import (gnutls_openpgp_privkey_t key,
           return rc;
         }
 
-      if (cdk_armor_filter_use (inp))
+      rc = cdk_stream_set_armor_flag (inp, 0);
+      if (rc != 0)
         {
-          rc = cdk_stream_set_armor_flag (inp, 0);
-          if (rc != 0)
-            {
-              rc = _gnutls_map_cdk_rc (rc);
-              cdk_stream_close (inp);
-              gnutls_assert ();
-              return rc;
-            }
+          rc = _gnutls_map_cdk_rc (rc);
+          cdk_stream_close (inp);
+          gnutls_assert ();
+          return rc;
         }
 
       rc = cdk_keydb_get_keyblock (inp, &key->knode);