cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-1889856 ] Fails with ASN1 parser: Element was not found after cleanup

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Fri, 08 Feb 2008 13:40:02 -0800

Bugs item #1889856, was opened at 2008-02-08 22:40
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1889856&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: SSL/TLS
Group: bad behaviour
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Mike Hommey (glandium)
Assigned to: Daniel Stenberg (bagder)
Summary: Fails with ASN1 parser: Element was not found after cleanup

Initial Comment:
When using the gnutls ssl layer, cleaning-up and reinitializing curl ends up with https requests failing with "ASN1 parser: Element was not found" errors.

The following code exposes the problem:
       #include <curl/curl.h>
       #include <curl/easy.h>

       int main(void) {
               CURL *easy = curl_easy_init();
               curl_easy_setopt(easy, CURLOPT_VERBOSE, 1);
               curl_easy_setopt(easy, CURLOPT_URL, "https://www.verisign.com/");
               curl_easy_perform(easy);
               curl_global_cleanup();
               easy = curl_easy_init();
               curl_easy_setopt(easy, CURLOPT_VERBOSE, 1);
               curl_easy_setopt(easy, CURLOPT_URL, "https://www.verisign.com/");
               curl_easy_perform(easy);
       }

This works properly with openssl backend, and with the gnutls backend until version 7.16.3, according to CVS tags.

The bug was introduced in this commit:
http://cool.haxx.se/cvs.cgi/curl/lib/gtls.c.diff?r1=1.26&r2=1.27
Note how gtls_inited is not set back to FALSE in cleanup.

The following patch fixes the issue:
--- curl-7.18.0.orig/lib/gtls.c
+++ curl-7.18.0/lib/gtls.c
@@ -110,8 +110,10 @@
 
 int Curl_gtls_cleanup(void)
 {
- if(gtls_inited)
+ if(gtls_inited) {
     gnutls_global_deinit();
+ gtls_inited = FALSE;
+ }
   return 1;
 }
 

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

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1889856&group_id=976
Received on 2008-02-08

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET