My own TLS Extension - Hello World :-)

Carolin Latze carolin.latze at unifr.ch
Fri Apr 23 15:11:16 CEST 2010


Hi everybody,

I tried to write my own TLS extension and ran into problems when trying
to define an API for that extension. But let me explain step-by-step:

I use gnutls 2.9.11 and followed
http://www.gnu.org/software/gnutls/devel/manual/gnutls.html#TLS-Extension-Handling
to add an extension that sends a fix HelloWorld message from client to
server and vice versa and prints it (using printf). In order to do so, I
modified and added the following files:

lib/m4/hooks.m4
lib/gnutls_int.h
lib/gnutls_extensions.c
lib/ext_helloworld.{h|c}
lib/Makefile.am

That worked pretty well. My very simple client and server application
(they do a standard handshake) print out the HelloWorld as expected.

Now, I wanted to add an API to be able to specify the HelloWorld message
within the client and server application. In order to do so, I added the
following line to lib/includes/gnutls/gnutls.h:

int gnutls_helloworld_set_msg(gnutls_session_t session, const char *msg);

The function itself is defined in lib/gnutls_helloworld.c. Furthermore I
added gnutls_helloworld.c to lib/Makefile.am. Running make and make
install does not show any problems but when I try to call
gnutls_helloworld_set_msg in my client application, I run into linker
problems:

undefined reference to `gnutls_helloworld_set_msg'

However when I run nm with my GnuTLS library, gnutls_helloworld_set_msg
is listed.

Does anybody have an idea whats going wrong here? I assume I missed on
modification that is needed to export API methods, but I have no idea
where.... Any help would be appreciated.

Carolin





More information about the Gnutls-help mailing list