From: Nikos Mavrogiannopoulos Date: Fri, 30 Dec 2011 15:23:02 +0000 (+0200) Subject: Avoid using base64 armor auto-detection which causes decoding errors in win32. X-Git-Tag: gnutls_3_0_10~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=340a2a99d6a6b4a98fab75b876422d74ff8d22d2;p=thirdparty%2Fgnutls.git Avoid using base64 armor auto-detection which causes decoding errors in win32. For some reason reading from the stream modifies the stream and this work-around avoids that issue. --- diff --git a/NEWS b/NEWS index a1a0e737fb..869a428a0c 100644 --- 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 diff --git a/lib/openpgp/pgp.c b/lib/openpgp/pgp.c index 2510ae917b..e01264448a 100644 --- a/lib/openpgp/pgp.c +++ b/lib/openpgp/pgp.c @@ -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); diff --git a/lib/openpgp/privkey.c b/lib/openpgp/privkey.c index 0ee05325b4..f43c53b7ba 100644 --- a/lib/openpgp/privkey.c +++ b/lib/openpgp/privkey.c @@ -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);