View Issue Details

IDProjectCategoryView StatusLast Update
0001423libmicrohttpdHTTPS (TLS)public2009-02-08 22:20
Reporteruser369Assigned ToChristian Grothoff  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version0.4.0pre0 
Summary0001423: TLS/SSL examples fail
Description>./https_fileserver_example 8000 50
Failed to initialize TLS support
Error: failed to start TLS_daemon (a newline is missed here btw.)

On a closer look, the MHD_gnutls_certificate_set_x509_key_mem function in src/daemon/https/gnutls_x509.c returns -207, which means GNUTLS_E_BASE64_UNEXPECTED_HEADER_ERRO.

Additional InformationSystem is Debian Stable Etch on i386.
Configured:
  Operating System: linux-gnu
  Target directory: /home/user/libmicrohttpd
  Messages: yes
  libgcrypt: yes
  libcurl (testing): no, many unit tests will not run
  HTTPS support: yes

configure: HTTPS subsystem configuration:
  TLS support: yes
  SSLv3 support: yes (and also tried no)
  x509 support: yes
  Client code dep.: disabled. running some test cases won't be possible
TagsNo tags attached.

Activities

Christian Grothoff

2008-09-11 09:47

manager   ~0003683

Interesting -- works for me (Debian unstable, i386). Can you try to see where exactly it is failing? (set_X509_key_mem calls a bunch of other stuff...).

user369

2008-09-11 11:38

  ~0003684

Phew, this seems endless. Let us do an intermediate comparison.
The chain of calling so far is:
-> MHD_gnutls_certificate_set_x509_key_mem
-> read_key_mem (where key != NULL)
-> _gnutls_x509_raw_privkey_to_gkey
 ret = gnutls_x509_privkey_init (&tmpkey); <- returns 0 (OK)

-> gnutls_x509_privkey_import (x509_privkey.c)
 if (format == GNUTLS_X509_FMT_PEM) ... <- is true

 result = _gnutls_fbase64_decode(...) <- returns 1191

 if (key->pk_algorithm == MHD_GNUTLS_PK_RSA) <- is true
  
-> _gnutls_privkey_decode_pkcs1_rsa_key
-> asn1_create_element (structure.c)
 passed Arguments are:
  source_name = GNUTLS.RSAPrivateKey
  definitions = NULL

With this, dest_node = _asn1_copy_structure2 (definitions, source_name);
returns NULL and the error dominos fall.

Christian Grothoff

2008-10-12 20:06

manager   ~0003708

I've removed tons of code today and done some renaming, so first of all the symbols you reported will now have slightly different names.

I also still can not reproduce the problem on any of my systems. I do, however, have another bug (that maybe similar) which only appears on some of my systems. That bug is triggered by running "make check" (with libcurl installed).

Does "make check" pass on your system? (just to make sure that there is no interference from this other bug...).

user369

2008-10-13 10:01

  ~0003709

I have at my disposal three Debian Etch boxes, each of them installed and configured independently. I have tried with and without libcurl, too. On neither machine the srd/examples/https_fileserver_example ran without:
"Error: failed to start TLS_daemon"

I did, however, succeed on Debian Unstable. (With the 0.4 release)

Running make check on Etch gives me:
...
===================
All 15 tests passed
===================

...
Error: running curl test depends on local libcurl version > 7.16.4
FAIL: tls_daemon_options_test
Error: running curl test depends on local libcurl version > 7.16.4
FAIL: tls_authentication_test
Error: running curl test depends on local libcurl version > 7.16.4
FAIL: mhds_multi_daemon_test
Error: running curl test depends on local libcurl version > 7.16.4
FAIL: mhds_session_info_test
=========================================
4 of 4 tests failed
Please report to libmicrohttpd@gnunet.org
=========================================

(The version of libcurl is 7.15.5-1etch1 in Etch.)

Christian Grothoff

2008-11-16 02:50

manager   ~0003739

I've now done another run of fixing testcases and removing dead code. Is the original problem still there?

user369

2008-11-16 03:45

  ~0003741

Last edited: 2008-11-16 03:51

Yes, it is.
The dependencies are still not met on Debian Etch.

make[5]: Entering directory `~/libmicrohttpd/src/testcurl/https'
Error: running curl test depends on local libcurl version > 7.16.4
FAIL: tls_daemon_options_test
Error: running curl test depends on local libcurl version > 7.16.4
FAIL: tls_authentication_test
Error: running curl test depends on local libcurl version > 7.16.4
FAIL: mhds_multi_daemon_test
Error: running curl test depends on local libcurl version > 7.16.4
FAIL: mhds_session_info_test
=========================================
4 of 4 tests failed
Please report to libmicrohttpd@gnunet.org
=========================================

And the https examples of the package are still aborting with the error message.

Christian Grothoff

2008-11-16 16:27

manager   ~0003743

Last edited: 2008-11-16 16:30

Well, the testcases failing with the version error is fine. I thought that even when you used a recent-enough version of curl things broke. We obviously can not force etch to update ;-). Besides, these are just testcases failing due to a version mismatch; that's really not a problem IMO.

Now, the examples not working is more serious. This should not have anything to do with the CURL version; maybe it is the libgcrypt version? Can you try installing (by hand) a more recent version of libgcrypt (if it exists...) and see if that helps?

user369

2008-11-19 08:15

  ~0003746

Last edited: 2008-11-19 08:16

I built upstream's version 1.4.1 of libgcrypt and told bash to prefer it for dynamic linking (LD_LIBRARY_PATH). The https_fileserver_example is running correctly with that.

Issue History

Date Modified Username Field Change
2008-09-11 04:20 user369 New Issue
2008-09-11 09:47 Christian Grothoff Note Added: 0003683
2008-09-11 09:47 Christian Grothoff Status new => feedback
2008-09-11 11:38 user369 Note Added: 0003684
2008-09-28 21:10 Christian Grothoff Status feedback => assigned
2008-09-28 21:10 Christian Grothoff Assigned To => Christian Grothoff
2008-10-12 20:06 Christian Grothoff Note Added: 0003708
2008-10-13 10:01 user369 Note Added: 0003709
2008-11-16 02:50 Christian Grothoff Note Added: 0003739
2008-11-16 03:45 user369 Note Added: 0003741
2008-11-16 03:51 user369 Note Edited: 0003741
2008-11-16 16:27 Christian Grothoff Note Added: 0003743
2008-11-16 16:28 Christian Grothoff Note Edited: 0003743
2008-11-16 16:30 Christian Grothoff Note Edited: 0003743
2008-11-19 08:15 user369 Note Added: 0003746
2008-11-19 08:16 user369 Note Edited: 0003746
2008-11-22 22:16 Christian Grothoff Status assigned => resolved
2008-11-22 22:16 Christian Grothoff Resolution open => fixed
2009-02-08 22:20 Christian Grothoff Status resolved => closed
2013-05-06 12:52 Christian Grothoff Category SSL => HTTPS (SSL)
2024-01-21 13:25 Christian Grothoff Category HTTPS (SSL) => HTTPS (TLS)