gnutls extension

Sumon Islam isumon20 at yahoo.com
Mon Nov 29 23:11:14 CET 2010


Hi,
I would like to extend the gnutls, I followed all steps (point 1 to 4) as the 
link specified 
(http://www.gnu.org/software/gnutls/devel/manual/gnutls.html#TLS-Extension-Handling).
 I made simple ext_foobar.c and ext_foobar.h ( I avoided the API steps of point 
5 at the first time for simplicity), attached below. 


Then I did ./configure --enable-foobar, make and make install, but could not get 
any message (of extension part) when run the client and server. 

I found that ./configure --enable-foobar  gives "checking whether to disable 
foobar support... yes" output. But only ./configure gives "checking whether to 
disable foobar support... no"
So I did ./configure, make and make install and run the client and server (with 
compile) again, but could not get any extension output.I also tried with 
autoreconf to build the program with extension, but no improvement. 

I downloaded the client 
(http://www.gnu.org/software/gnutls/manual/html_node/Simple-client-example-with-anonymous-authentication.html#Simple-client-example-with-anonymous-authentication)
 and server 
(http://www.gnu.org/software/gnutls/manual/html_node/Echo-Server-with-anonymous-authentication.html#Echo-Server-with-anonymous-authentication)
 and run the unmodified version.  Do I need to change anything in the client and 
server program to initiate the extension? 


I could not find anything that can help me. Please help me to get the extension 
message when run the client and server, and guide me to the right direction. 
Thank you.

Best regards,
Sumon

/* ext_foobar.h */

int
          _gnutls_foobar_recv_params (gnutls_session_t session,
                                      const opaque * data,
                                      size_t data_size);
          
int
          _gnutls_foobar_send_params (gnutls_session_t session,
                                      opaque * data,
                                      size_t data_size);



/* ext_foobar.c */

#include <gnutls_int.h>
#include "ext_foobar.h"


int
          _gnutls_foobar_recv_params (gnutls_session_t session,
                                      const opaque * data,
                                      size_t data_size)
          {
           if (session->security_parameters.entity == GNUTLS_CLIENT)
            
               {
                printf("data rcvd from client:%s\n", data); 
                return 0;
               }
           else
                {
                    printf("data rcvd from server:\n%s\n", data); 
                    return 0;
                }
             
          }
          

int
          _gnutls_foobar_send_params (gnutls_session_t session,
                                      opaque * data,
                                      size_t data_size)
          {
            if (session->security_parameters.entity == GNUTLS_CLIENT)
                 {
                    data= gnutls_malloc(17); 
                    data_size=16;
                    memcpy (data, "server: hi there", 16); 
                    return 17;
                }
            else
                {
                    data= gnutls_malloc(17); 
                    data_size=16;
                    memcpy (data, "client: hi there", 16); 
                    return 17;
                }
              
          }



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20101129/aad20472/attachment.htm>


More information about the Gnutls-help mailing list