summaryrefslogtreecommitdiffstats
path: root/ssl/record
AgeCommit message (Collapse)Author
2015-06-10Remove SSL_OP_TLS_BLOCK_PADDING_BUGEmilia Kasper
This is a workaround so old that nobody remembers what buggy clients it was for. It's also been broken in stable branches for two years and nobody noticed (see https://boringssl-review.googlesource.com/#/c/1694/). Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-06-10Correct type of RECORD_LAYER_get_rrec_length()Matt Caswell
The underlying field returned by RECORD_LAYER_get_rrec_length() is an unsigned int. The return type of the function should match that. Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-06-08Use CRYPTO_memcmp in ssl3_record.cEmilia Kasper
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-05-29Remove struct ccs_header_stMatt Caswell
struct ccs_header_st is not used so it should be removed. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-05-25Don't send an alert if we've just received oneMatt Caswell
If the record received is for a version that we don't support, previously we were sending an alert back. However if the incoming record already looks like an alert then probably we shouldn't do that. So suppress an outgoing alert if it looks like we've got one incoming. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-05-22Lost alert in DTLSLubom
If a client receives a bad hello request in DTLS then the alert is not sent correctly. RT#2801 Signed-off-by: Matt Caswell <matt@openssl.org> Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-05-22Fix a memory leak in compressionMatt Caswell
The function RECORD_LAYER_clear() is supposed to clear the contents of the RECORD_LAYER structure, but retain certain data such as buffers that are allocated. Unfortunately one buffer (for compression) got missed and was inadvertently being wiped, thus causing a memory leak. In part this is due to the fact that RECORD_LAYER_clear() was reaching inside SSL3_BUFFERs and SSL3_RECORDs, which it really shouldn't. So, I've rewritten it to only clear the data it knows about, and to defer clearing of SSL3_RECORD and SSL3_BUFFER structures to SSL_RECORD_clear() and the new function SSL3_BUFFER_clear(). Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-05-16Updates following review commentsMatt Caswell
Miscellaneous updates following review comments on the version negotiation rewrite patches. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-05-16Version negotiation rewrite cleanupMatt Caswell
Following the version negotiation rewrite all of the previous code that was dedicated to version negotiation can now be deleted - all six source files of it!! Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-05-16Client side version negotiation rewriteMatt Caswell
Continuing from the previous commit this changes the way we do client side version negotiation. Similarly all of the s23* "up front" state machine code has been avoided and again things now work much the same way as they already did for DTLS, i.e. we just do most of the work in the ssl3_get_server_hello() function. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-05-16Server side version negotiation rewriteMatt Caswell
This commit changes the way that we do server side protocol version negotiation. Previously we had a whole set of code that had an "up front" state machine dedicated to the negotiating the protocol version. This adds significant complexity to the state machine. Historically the justification for doing this was the support of SSLv2 which works quite differently to SSLv3+. However, we have now removed support for SSLv2 so there is little reason to maintain this complexity. The one slight difficulty is that, although we no longer support SSLv2, we do still support an SSLv3+ ClientHello in an SSLv2 backward compatible ClientHello format. This is generally only used by legacy clients. This commit adds support within the SSLv3 code for these legacy format ClientHellos. Server side version negotiation now works in much the same was as DTLS, i.e. we introduce the concept of TLS_ANY_VERSION. If s->version is set to that then when a ClientHello is received it will work out the most appropriate version to respond with. Also, SSLv23_method and SSLv23_server_method have been replaced with TLS_method and TLS_server_method respectively. The old SSLv23* names still exist as macros pointing at the new name, although they are deprecated. Subsequent commits will look at client side version negotiation, as well of removal of the old s23* code. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-05-14Identify and move OpenSSL internal header filesRichard Levitte
There are header files in crypto/ that are used by the rest of OpenSSL. Move those to include/internal and adapt the affected source code, Makefiles and scripts. The header files that got moved are: crypto/constant_time_locl.h crypto/o_dir.h crypto/o_str.h Reviewed-by: Matt Caswell <matt@openssl.org>
2015-05-13Remove Kerberos support from libsslMatt Caswell
Remove RFC2712 Kerberos support from libssl. This code and the associated standard is no longer considered fit-for-purpose. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-05-05memset, memcpy, sizeof consistency fixesRich Salz
Just as with the OPENSSL_malloc calls, consistently use sizeof(*ptr) for memset and memcpy. Remove needless casts for those functions. For memset, replace alternative forms of zero with 0. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-05-04Use safer sizeof variant in mallocRich Salz
For a local variable: TYPE *p; Allocations like this are "risky": p = OPENSSL_malloc(sizeof(TYPE)); if the type of p changes, and the malloc call isn't updated, you could get memory corruption. Instead do this: p = OPENSSL_malloc(sizeof(*p)); Also fixed a few memset() calls that I noticed while doing this. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-05-01free NULL cleanup -- codaRich Salz
After the finale, the "real" final part. :) Do a recursive grep with "-B1 -w [a-zA-Z0-9_]*_free" to see if any of the preceeding lines are an "if NULL" check that can be removed. Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-05-01u_len may be unused.Ben Laurie
Reviewed-by: Andy Polyakov
2015-05-01free null cleanup finaleRich Salz
Don't check for NULL before calling OPENSSL_free Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-30Sanity check EVP_CTRL_AEAD_TLS_AADMatt Caswell
The various implementations of EVP_CTRL_AEAD_TLS_AAD expect a buffer of at least 13 bytes long. Add sanity checks to ensure that the length is at least that. Also add a new constant (EVP_AEAD_TLS1_AAD_LEN) to evp.h to represent this length. Thanks to Kevin Wojtysiak (Int3 Solutions) and Paramjot Oberoi (Int3 Solutions) for reporting this issue. Reviewed-by: Andy Polyakov <appro@openssl.org>
2015-04-30Remove redundant includes from dtls1.hMatt Caswell
There were a set of includes in dtls1.h which are now redundant due to the libssl opaque work. This commit removes those includes, which also has the effect of resolving one issue preventing building on windows (i.e. the include of winsock.h) Reviewed-by: Andy Polyakov <appro@openssl.org>
2015-04-16Code style: space after 'if'Viktor Dukhovni
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-04-10Fix read_ahead issueMatt Caswell
Fix a "&" that should have been "!" when processing read_ahead. RT#3793 Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-31Clean up record layerMatt Caswell
Fix up various things that were missed during the record layer work. All instances where we are breaking the encapsulation rules. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Add Record Layer documentationMatt Caswell
Add some design documentation on how the record layer works to aid future maintenance. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Fix formatting odditiesMatt Caswell
Fix some formatting oddities in rec_layer_d1.c. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Fix record.h formattingMatt Caswell
Fix some strange formatting in record.h. This was probably originally introduced as part of the reformat work. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Define SEQ_NUM_SIZEMatt Caswell
Replace the hard coded value 8 (the size of the sequence number) with a constant defined in a macro. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Rename record layer source filesMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Remove some unneccessary macrosMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Renamed record layer header filesMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Reorganise header filesMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Remove last trace of non-record layer code reading and writing sequenceMatt Caswell
numbers directly Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Move last_write_sequence from s->d1 to s->rlayer.d.Matt Caswell
Also push some usage of last_write_sequence out of dtls1_retransmit_message and into the record layer. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Move ssl3_record_sequence_update into record layerMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Move buffered_app_data from s->d1 to s->rlayer.dMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Move handshake_fragment, handshake_fragment_len, alert_fragment andMatt Caswell
alert_fragment_len from s->d1 to s->rlayer.d Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Fix seg fault in dtls1_newMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Moved processed_rcds and unprocessed_rcds from s->d1 to s->rlayer.dMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Move bitmap and next_bitmap from s->d1 to s->rlayer.d.Matt Caswell
Create dtls_bitmap.h and dtls_bitmap.c Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Move r_epoch and w_epoch from s->d1 to s->rlayer.dMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Introduce a DTLS_RECORD_LAYER type for DTLS record layer stateMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Move DTLS1_RECORD_DATA into rec_layer.hMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Move read_sequence and write_sequence from s->s3 to s->rlayerMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Move s->s3->wpend_* to s->rlayerMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Move handshake_fragment, handshake_fragment_len, alert_fragment andMatt Caswell
alert_fragment_len from s->s3 into s->rlayer Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Move s->s3->wnum to s->rlayer.wnumMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Move s->rstate to s->rlayer.rstateMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Move s->packet and s->packet_length into s->rlayerMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Remove unneccessary use of accessor function now code is moved into recordMatt Caswell
layer Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-26Make rrec, wrec, rbuf and wbuf fully private to the record layer. Also, cleanMatt Caswell
up some access to them. Now that various functions have been moved into the record layer they no longer need to use the accessor macros. Reviewed-by: Richard Levitte <levitte@openssl.org>