FW: Help to understand WPACKET API

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

FW: Help to understand WPACKET API

Sai Teja Chowdary

 

Hi,

I am trying to tweak openssl-master client to test a tls1.3 enabled server.

 

I want to club the client certificate, client key exchange , change cipher spec and certificate verify into single handshake message.( So that the record shows up as multiple handshake messages).

 

OpenSSL Version : OpenSSL 1.1.1-dev  xx XXX xxxx.

 

After going through the code I understand the new tls1.3 implemented OpenSSL code is using WPACKET API to frame the records. I need help in understanding what the following functions do. I am new to the mailing list, thanks in advance.

 

WPACKET_start_sub_packet_

WPACKET_allocate_bytes

WPACKET_sub_allocate_bytes__

WPACKET_reserve_bytes

WPACKET_start_sub_packet_len__

WPACKET_sub_memcpy__

 

Basically what does the word _sub_ mean in these functions and how do that differ from the non sub function say

Difference between WPACKET_sub_memcpy__ and WPACKET_memcpy__

 

Please feel free to reply if something is not understandable.

Sent from Mail for Windows 10

 

Thanks

Sate.

 


--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: FW: Help to understand WPACKET API

Matt Caswell-2


On 19/12/17 13:43, Sai Teja Chowdary wrote:

> After going through the code I understand the new tls1.3 implemented
> OpenSSL code is using WPACKET API to frame the records. I need help in
> understanding what the following functions do. I am new to the mailing
> list, thanks in advance.
>
>  
>
> WPACKET_start_sub_packet_
>
> WPACKET_allocate_bytes
>
> WPACKET_sub_allocate_bytes__
>
> WPACKET_reserve_bytes
>
> WPACKET_start_sub_packet_len__
>
> WPACKET_sub_memcpy__
>
>  
>
> Basically what does the word _sub_ mean in these functions and how do
> that differ from the non sub function say
>
> Difference between WPACKET_sub_memcpy__ and WPACKET_memcpy__

It is common in TLS for a block of data to be preceded by a length.
Depending on the context the number of length bytes might typically be
1, 2, 3 or 4. Such a block of data is considered a "sub" packet in the
WPACKET API. So:

int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len);

Copies len bytes of data from src into the pkt. Compare with:

#define WPACKET_sub_memcpy_u8(pkt, src, len) \
    WPACKET_sub_memcpy__((pkt), (src), (len), 1)

So WPACKET_sub_memcpy_u8 will also copy len bytes of data from src into
pkt but will precede it with 1 byte containing the value of len.


Matt
--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: FW: Help to understand WPACKET API

Ananthaneni Saitejachowdary
Thank you Matt,

I understand that _u8,_u16. _u24 are the variants that helps us set the size of length field, that precedes the data.

-Saiteja.

-----Original Message-----
From: openssl-users [mailto:[hidden email]] On Behalf Of Matt Caswell
Sent: Friday, December 22, 2017 4:23 PM
To: [hidden email]
Subject: Re: [openssl-users] FW: Help to understand WPACKET API



On 19/12/17 13:43, Sai Teja Chowdary wrote:

> After going through the code I understand the new tls1.3 implemented
> OpenSSL code is using WPACKET API to frame the records. I need help in
> understanding what the following functions do. I am new to the mailing
> list, thanks in advance.
>
>  
>
> WPACKET_start_sub_packet_
>
> WPACKET_allocate_bytes
>
> WPACKET_sub_allocate_bytes__
>
> WPACKET_reserve_bytes
>
> WPACKET_start_sub_packet_len__
>
> WPACKET_sub_memcpy__
>
>  
>
> Basically what does the word _sub_ mean in these functions and how do
> that differ from the non sub function say
>
> Difference between WPACKET_sub_memcpy__ and WPACKET_memcpy__

It is common in TLS for a block of data to be preceded by a length.
Depending on the context the number of length bytes might typically be 1, 2, 3 or 4. Such a block of data is considered a "sub" packet in the WPACKET API. So:

int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len);

Copies len bytes of data from src into the pkt. Compare with:

#define WPACKET_sub_memcpy_u8(pkt, src, len) \
    WPACKET_sub_memcpy__((pkt), (src), (len), 1)

So WPACKET_sub_memcpy_u8 will also copy len bytes of data from src into pkt but will precede it with 1 byte containing the value of len.


Matt
--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users