summaryrefslogtreecommitdiffstats
path: root/ssl/packet.c
AgeCommit message (Collapse)Author
2018-12-06Following the license change, modify the boilerplates in ssl/Richard Levitte
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7768)
2018-04-17Update copyright yearRichard Levitte
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5990)
2018-04-03Set error code on alloc failuresRich Salz
Almost all *alloc failures now set an error code. Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/5842)
2017-08-03Move ossl_assertMatt Caswell
Move the definition of ossl_assert() out of e_os.h which is intended for OS specific things. Instead it is moved into internal/cryptlib.h. This also changes the definition to remove the (int) cast. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4073)
2017-05-22Convert existing usage of assert() to ossl_assert() in libsslMatt Caswell
Provides consistent output and approach. Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3496)
2017-05-02TLS1.3 PaddingTodd Short
Add padding callback for application control Standard block_size callback Documentation and tests included Configuration file/s_client/s_srver option Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3130)
2017-01-30Use for loop in WPACKET_fill_lengths instead of do...whileMatt Caswell
Based on review feedback Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2259)
2017-01-30Provide a new WPACKET function for filling in all the lengthsMatt Caswell
For the psk extension we need to fill in all the lengths of the message so far, even though we haven't closed the WPACKET yet. This provides a function to do that. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2259)
2016-12-05Various style fixes from the TLSv1.3 record changes reviewMatt Caswell
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-12-05Add an ability to find out the current write location from a WPACKETMatt Caswell
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-11-09Add support for initialising WPACKETs from a static bufferMatt Caswell
Normally WPACKETs will use a BUF_MEM which can grow as required. Sometimes though that may be overkill for what is needed - a static buffer may be sufficient. This adds that capability. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-10-10Remove trailing whitespace from some files.David Benjamin
The prevailing style seems to not have trailing whitespace, but a few lines do. This is mostly in the perlasm files, but a few C files got them after the reformat. This is the result of: find . -name '*.pl' | xargs sed -E -i '' -e 's/( |'$'\t'')*$//' find . -name '*.c' | xargs sed -E -i '' -e 's/( |'$'\t'')*$//' find . -name '*.h' | xargs sed -E -i '' -e 's/( |'$'\t'')*$//' Then bn_prime.h was excluded since this is a generated file. Note mkerr.pl has some changes in a heredoc for some help output, but other lines there lack trailing whitespace too. Reviewed-by: Kurt Roeckx <kurt@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-09-29Address style feedback commentsMatt Caswell
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-29Add the WPACKET_reserve_bytes() functionMatt Caswell
WPACKET_allocate_bytes() requires you to know the size of the data you are allocating for, before you create it. Sometimes this isn't the case, for example we know the maximum size that a signature will be before we create it, but not the actual size. WPACKET_reserve_bytes() enables us to reserve bytes in the WPACKET, but not count them as written yet. We then subsequently need to acall WPACKET_allocate_bytes to actually count them as written. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-26Fix a WPACKET bugMatt Caswell
If we request more bytes to be allocated than double what we have already written, then we grow the buffer by the wrong amount. Reviewed-by: Emilia Käsper <emilia@openssl.org>
2016-09-22Add warning about a potential pitfall with WPACKET_allocate_bytes()Matt Caswell
If the underlying BUF_MEM gets realloc'd then the pointer returned could become invalid. Therefore we should always ensure that the allocated memory is filled in prior to any more WPACKET_* calls. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-20Convert WPACKET_put_bytes to use convenience macrosMatt Caswell
All the other functions that take an argument for the number of bytes use convenience macros for this purpose. We should do the same with WPACKET_put_bytes(). Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-14Encourage use of the macros for the various "sub" functionsMatt Caswell
Don't call WPACKET_sub_memcpy(), WPACKET_sub_allocation_bytes() and WPACKET_start_sub_packet_len() directly. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-14Add a WPACKET_sub_allocate_bytes() functionMatt Caswell
Updated the construction code to use the new function. Also added some convenience macros for WPACKET_sub_memcpy(). Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-13Fix a few style nits in the wpacket codeMatt Caswell
Addressing more feedback comments. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-13Remove else after a return in packet codeMatt Caswell
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-13Pull out some common packet code into a functionMatt Caswell
Two locations had the same loop for writing out a value. Pull it out into a function. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-13Add some soft asserts where applicableMatt Caswell
This is an internal API. Some of the tests were for programmer erorr and "should not happen" situations, so a soft assert is reasonable. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-13Address WPACKET review commentsMatt Caswell
A few style tweaks here and there. The main change is that curr and packet_len are now offsets into the buffer to account for the fact that the pointers can change if the buffer grows. Also dropped support for the WPACKET_set_packet_len() function. I thought that was going to be needed but so far it hasn't been. It doesn't really work any more due to the offsets change. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-13Simplify the overflow checks in WPACKET_allocate_bytes()Matt Caswell
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-13Move the WPACKET documentation comments to packet_locl.hMatt Caswell
The PACKET documentation is already in packet_locl.h so it makes sense to have the WPACKET documentation there as well. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-13Various bug fixes and tweaks to WPACKET implementationMatt Caswell
Also added the WPACKET_cleanup() function to cleanup a WPACKET if we hit an error. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-13Add WPACKET_sub_memcpy() functionMatt Caswell
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-13Move from explicit sub-packets to implicit onesMatt Caswell
No need to declare an explicit sub-packet. Just start one. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-13Rename PACKETW to WPACKETMatt Caswell
To avoid confusion with the read PACKET structure. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-13First pass at writing a writeable packets APIMatt Caswell
Reviewed-by: Rich Salz <rsalz@openssl.org>