supplemental data handshake message

Carolin Latze carolin.latze at unifr.ch
Mon May 3 16:33:20 CEST 2010


Hi Simon
>>
>> int _gnutls_helloworld_supp_recv_params(gnutls_session_t session,const
>> opaque *data,size_t _data_size)
>> {
>>         uint8_t len;
>>         ssize_t data_size = _data_size;
>>         unsigned char *msg;
>>
>>         if (data_size > 0)
>>         {
>>           len = data[0];
>>           DECR_LEN (data_size, len);
>>           msg=(unsigned char*)malloc(len*sizeof(unsigned char));
>>           memcpy(msg,&data[1],len);
>>           msg[len]='\0';
>>           printf("supp data: %s\n",msg);
>>         }
>>
>>         return 0;
>>     
>
>
> Shouldn't you return the length of parsed data here?  Look at
> gnutls_supplemental.c, the function _gnutls_parse_supplemental trusts
> your function to return the proper length for incrementing the length
> pointer for its parsing code.
>
> Just a quick response, haven't looked into this in detail.
>
> /Simon
>   
I don't know whether that would have been the next issue (I fixed it 
anyway now), but the bigger problem was that I forgot to specify the 
helloworld supplemental functions and type in lib/gnutls_supplemental.c:


gnutls_supplemental_entry _gnutls_supplemental[] = {
  { "helloworld",
    GNUTLS_SUPPLEMENTAL_HELLOWORLD_DATA,
    gnutls_helloworld_supp_recv_params,
    gnutls_helloworld_supp_send_params },
  {0, 0, 0, 0}
};

Now, I got one step further and the crash occurs in ext_helloworld.c in 
_gnutls_helloworld_supp_recv_params in line "DECR_LEN (data_size, 
len);". I try to debug that further....

Thanks!
Carolin






More information about the Gnutls-help mailing list