aboutsummaryrefslogtreecommitdiff
path: root/ssl/packet_locl.h
AgeCommit message (Collapse)AuthorFilesLines
2015-10-21Avoid undefined behaviour in PACKET_buf_initMatt Caswell1-1/+1
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 Kasper1-5/+4
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-10-09DTLS: remove unused cookie fieldEmilia Kasper1-0/+13
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 Kasper1-0/+2
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-10-05Add PACKET_copy_allEmilia Kasper1-1/+19
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-10-05ssl3_get_client_hello: rearrange logicEmilia Kasper1-0/+7
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 Kasper1-42/+29
Get rid of the third field that is no longer needed. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-09-18Remove PACKET_backEmilia Kasper1-11/+0
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 Kasper1-19/+0
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 Kasper1-2/+54
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 Kasper1-0/+82
Rewrite ssl3_get_client_hello to use the new methods. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-08-26PACKET: constify where possibleEmilia Kasper1-13/+15
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 Caswell1-2/+1
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 Caswell1-8/+8
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 Caswell1-0/+394
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>