summaryrefslogtreecommitdiffstats
path: root/ssl/packet_locl.h
AgeCommit message (Collapse)Author
2016-03-03Refactor ClientHello extension parsingEmilia Kasper
1) Simplify code with better PACKET methods. 2) Make broken SNI parsing explicit. SNI was intended to be extensible to new name types but RFC 4366 defined the syntax inextensibly, and OpenSSL has never parsed SNI in a way that would allow adding a new name type. RFC 6066 fixed the definition but due to broken implementations being widespread, it appears impossible to ever extend SNI. 3) Annotate resumption behaviour. OpenSSL doesn't currently handle all extensions correctly upon resumption. Annotate for further clean-up. 4) Send an alert on ALPN protocol mismatch. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2016-02-01constify PACKETEmilia Kasper
PACKET contents should be read-only. To achieve this, also - constify two user callbacks - constify BUF_reverse. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-01-26Remove /* foo.c */ commentsRich Salz
This was done by the following find . -name '*.[ch]' | /tmp/pl where /tmp/pl is the following three-line script: print unless $. == 1 && m@/\* .*\.[ch] \*/@; close ARGV if eof; # Close file to reset $. And then some hand-editing of other files. Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2016-01-02Instead of a local hack, implement SIZE_MAX in numbers.h if it's missingRichard Levitte
Reviewed-by: Stephen Henson <steve@openssl.org>
2015-12-30SIZE_MAX doesn't exist everywhere, supply an alternativeRichard Levitte
SIZE_MAX is a great macro, and does unfortunately not exist everywhere. Since we check against half of it, using bitwise shift to calculate the value of half SIZE_MAX should be safe enough. Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-12-22Add ossl_inlineDr. Stephen Henson
Add macro ossl_inline for use in public headers where a portable inline is required. Change existing inline to use ossl_inline Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-12-16Rename some BUF_xxx to OPENSSL_xxxRich Salz
Rename BUF_{strdup,strlcat,strlcpy,memdup,strndup,strnlen} to OPENSSL_{strdup,strlcat,strlcpy,memdup,strndup,strnlen} Add #define's for the old names. Add CRYPTO_{memdup,strndup}, called by OPENSSL_{memdup,strndup} macros. Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-10-21Avoid undefined behaviour in PACKET_buf_initMatt Caswell
Change the sanity check in PACKET_buf_init to check for excessive length buffers, which should catch the interesting cases where len has been cast from a negative value whilst avoiding any undefined behaviour. RT#4094 Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-10-15PACKET: fix __owurEmilia Kasper
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-10-09DTLS: remove unused cookie fieldEmilia Kasper
Note that this commit constifies a user callback parameter and therefore will break compilation for applications using this callback. But unless they are abusing write access to the buffer, the fix is trivial. Reviewed-by: Andy Polyakov <appro@openssl.org>
2015-10-08PACKET: simplify ServerKeyExchange parsingEmilia Kasper
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-10-05Add PACKET_copy_allEmilia Kasper
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-10-05ssl3_get_client_hello: rearrange logicEmilia Kasper
Move all packet parsing to the beginning of the method. This limits the SSLv2 compatibility soup to the parsing, and makes the rest of the processing uniform. This is also needed for simpler EMS support: EMS servers need to do an early scan for EMS to make resumption decisions. This'll be easier when the entire ClientHello is parsed in the beginning. As a side effect, 1) PACKETize ssl_get_prev_session and tls1_process_ticket; and 2) Delete dead code for SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-09-22PACKET: simplifyEmilia Kasper
Get rid of the third field that is no longer needed. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-09-18Remove PACKET_backEmilia Kasper
It's unused, and the same functionality can be achieved with saving a copy of the struct. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-09-17Remove PACKET_(get|goto)_bookmarkEmilia Kasper
The bookmark API results in a lot of boilerplate error checking that can be much more easily achieved with a simple struct copy. It also lays the path for removing the third PACKET field. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-09-09PACKET: add PACKET_memdup and PACKET_strndupEmilia Kasper
Use each once in s3_srvr.c to show how they work. Also fix a bug introduced in c3fc7eeab884b6876a1b4006163f190d325aa047 and made apparent by this change: ssl3_get_next_proto wasn't updating next_proto_negotiated_len Reviewed-by: Matt Caswell <matt@openssl.org>
2015-08-26PACKET: add methods for reading length-prefixed TLS vectors.Emilia Kasper
Rewrite ssl3_get_client_hello to use the new methods. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-08-26PACKET: constify where possibleEmilia Kasper
The PACKET should hold a 'const unsigned char*' underneath as well but the legacy code passes the record buffer around as 'unsigned char*' (to callbacks, too) so that's a bigger refactor. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-08-13Enhance PACKET readabilityMatt Caswell
Enhance the PACKET code readability, and fix a stale comment. Thanks to Ben Kaduk (bkaduk@akamai.com) for pointing this out. Reviewed-by: Emilia Käsper <emilia@openssl.org>
2015-08-04Fix a bug in the new PACKET implementationMatt Caswell
Some of the PACKET functions were returning incorrect data. An unfortunate choice of test data in the unit test was masking the failure. Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-08-03Add initial packet parsing codeMatt Caswell
Provide more robust (inline) functions to replace n2s, n2l, etc. These functions do the same thing as the previous macros, but also keep track of the amount of data remaining and return an error if we try to read more data than we've got. Reviewed-by: Tim Hudson <tjh@openssl.org>