supplemental data handshake message

Carolin Latze carolin.latze at unifr.ch
Mon May 3 17:23:21 CEST 2010


Hi again,

it seems there is a mismatched between the length the sender assumes to 
send (which is the correct length) and the length the receiver is able 
to retrieve out of the buffer. The debug output on the sender says the 
following:

--debug--
server.log screenshot
--end debug--

(sorry didn't have time to capture that properly)

The data is indeed 10 bytes long, which results in 14 bytes to be sent 
due to the 2 byte length and type. So, the server.log make sense to me. 
However the client does something strange:

--debug--
REC[0x954f378]: Received Packet[1] Handshake(22) with length: 14
REC[0x954f378]: Decrypted Packet[1] Handshake(22) with length: 14
HSK[0x954f378]: SUPPLEMENTAL was received [14 bytes]
EXT[0x954f378]: Got supplemental type=01 length=3
--end debug--

I set the type to 1, so that makes sense as well. However... why does it 
read out a length of 3? It receives the correct packet length of 14 
bytes. It is gnutls_supplemental.c that generates the packet and parses 
it... so I would expect that it would parse it correctly. Any ideas or 
hints?

Carolin

Carolin Latze wrote:
> 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
>
>
>
> _______________________________________________
> Help-gnutls mailing list
> Help-gnutls at gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnutls
>   






More information about the Gnutls-help mailing list