View Issue Details

IDProjectCategoryView StatusLast Update
0004917libmicrohttpdHTTPS (SSL)public2018-02-01 09:38
ReportersilvioprogAssigned To 
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status newResolutionopen 
Product Versioncurrent SVN 
Target VersionFixed in Version 
Summary0004917: OpenSSL support
DescriptionHello,

It would be nice to implement OpenSSL support in MHD.

Thank you!
Tagsfeature

Relationships

related to 0004998 closedsilvioprog LibreSSL support 

Activities

ghaderer

2017-10-13 14:36

reporter   ~0012475

Hello,

I made changes to support OpenSSL and other TLS engines. You will find my working branch here: https://github.com/ghaderer/libmicrohttpd/tree/wip-openssl-master. Could you review it and tell me if this is something you could integrate? If you don't, what should be done to improve it and have it checked in?

I tested on Linux/amd64. All existing tests pass. Not tested on Windows at all.

Cheers,


Gauthier

silvioprog

2018-02-01 00:07

developer   ~0012847

Hello.

Thanks a lot for implementing and sharing it, I'm going to test your changes as soon as possible.

OpenSSL support is an awesome feature, it requires a detailed test ...

silvioprog

2018-02-01 01:07

developer   ~0012848

Hello again @ghaderer .

I took a look at your changes, really impressive. However, I've tried to compile it on my Xubuntu and got the following error:

./configure --with-gnutls=no --with-openssl=yes
make

[snip]
gcc -DHAVE_CONFIG_H -I. -I../..  -I../../src/include -DDATA_DIR=\"../../src/datadir/\" -DCPU_COUNT=8    -g -O2 -fno-strict-aliasing -MT benchmark-benchmark.o -MD -MP -MF .deps/benchmark-benchmark.Tpo -c -o benchmark-benchmark.o `test -f 'benchmark.c' || echo './'`benchmark.c
mv -f .deps/benchmark-benchmark.Tpo .deps/benchmark-benchmark.Po
/bin/bash ../../libtool  --tag=CC   --mode=link gcc   -g -O2 -fno-strict-aliasing   -o benchmark benchmark-benchmark.o ../../src/microhttpd/libmicrohttpd.la 
libtool: link: gcc -g -O2 -fno-strict-aliasing -o .libs/benchmark benchmark-benchmark.o  ../../src/microhttpd/.libs/libmicrohttpd.so -pthread
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_del_session'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_del_context'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_create_context'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_set_context_client_certificate_mode'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_set_context_certificate_cb'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_session_wants_write'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_set_https_callbacks'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_global_deinit'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_tls_connection_shutdown'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_session_read'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_get_session_protocol_version'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_get_specific_session'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_session_close'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_session_read_pending'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_run_tls_handshake_'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_set_context_trust_certificate'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_get_session_cipher_algorithm'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_session_wants_read'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_set_context_cipher_priorities'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_lookup_engine'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_create_session'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_engine_has_feature'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_set_context_dh_params'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_global_init'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_set_context_certificate'
../../src/microhttpd/.libs/libmicrohttpd.so: undefined reference to `MHD_TLS_session_write'
collect2: error: ld returned 1 exit status
Makefile:734: recipe for target 'benchmark' failed
make[4]: *** [benchmark] Error 1
make[4]: Leaving directory '/home/silvioprog/dev/git/libmicrohttpd2/src/examples'
Makefile:938: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/home/silvioprog/dev/git/libmicrohttpd2/src/examples'
Makefile:418: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/silvioprog/dev/git/libmicrohttpd2/src'
Makefile:549: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/silvioprog/dev/git/libmicrohttpd2'
Makefile:454: recipe for target 'all' failed
make: *** [all] Error 2


It should link openssl by itself. Another test:

./configure --with-openssl=no
make
[snip]
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/include -I../../src/microhttpd -I/usr/include/p11-kit-1 -DBUILDING_MHD_LIB=1 -fvisibility=hidden -pthread -I/usr/include/p11-kit-1 -g -O2 -fno-strict-aliasing -MT libmicrohttpd_la-connection.lo -MD -MP -MF .deps/libmicrohttpd_la-connection.Tpo -c connection.c  -fPIC -DPIC -o .libs/libmicrohttpd_la-connection.o
In file included from internal.h:32:0,
                 from connection.c:28:
tls.h:493:31: error: field ‘gnutls’ has incomplete type
     struct MHD_GnuTLS_Context gnutls;
                               ^
tls.h:529:31: error: field ‘gnutls’ has incomplete type
     struct MHD_GnuTLS_Session gnutls;
                               ^
connection.c: In function ‘MHD_get_connection_info’:
connection.c:3764:28: warning: implicit declaration of function ‘gnutls_cipher_get’ [-Wimplicit-function-declaration]
       connection->cipher = gnutls_cipher_get (connection->tls_session->d.gnutls
                            ^
connection.c:3775:30: warning: implicit declaration of function ‘gnutls_protocol_get_version’ [-Wimplicit-function-declaration]
       connection->protocol = gnutls_protocol_get_version (connection->tls_sessi
                              ^
Makefile:1182: recipe for target 'libmicrohttpd_la-connection.lo' failed
make[3]: *** [libmicrohttpd_la-connection.lo] Error 1
make[3]: Leaving directory '/home/silvioprog/dev/git/libmicrohttpd2/src/microhttpd'
Makefile:418: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/silvioprog/dev/git/libmicrohttpd2/src'
Makefile:549: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/silvioprog/dev/git/libmicrohttpd2'
Makefile:454: recipe for target 'all' failed
make: *** [all] Error 2

ghaderer

2018-02-01 09:38

reporter   ~0012851

Hello silvioprog,

Thank you for taking time to test and review my changes.

Regarding the missing symbols issue, I broke the HTTPS support auto-detection.

For the second issue, it was due to a typo which caused the build to break when GnuTLS was enabled but not OpenSSL.

I fixed both of them and pushed on the same branch. I hope I did not make other mistakes! :-/

Let me know if you have other issues or questions regarding all of this.

Issue History

Date Modified Username Field Change
2017-02-22 21:29 silvioprog New Issue
2017-02-22 21:29 silvioprog Tag Attached: feature
2017-03-08 00:05 Christian Grothoff Product Version => current SVN
2017-03-08 00:05 Christian Grothoff Summary [FEATURE REQUEST] OpenSSL support => OpenSSL support
2017-04-26 17:22 silvioprog Relationship added related to 0004998
2017-10-13 14:36 ghaderer Note Added: 0012475
2018-02-01 00:07 silvioprog Note Added: 0012847
2018-02-01 01:07 silvioprog Note Added: 0012848
2018-02-01 09:38 ghaderer Note Added: 0012851