Matt Caswell
312e9387fd
Fix a memory leak on an error path
...
A leak of an SSL_SESSION object can occur when decoding a psk extension on
an error path when using TLSv1.3
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2843 )
2017-03-04 16:20:13 +00:00
Dr. Stephen Henson
5528d68f6d
Set specific error is we have no valid signature algorithms set
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2840 )
2017-03-03 22:02:39 +00:00
Dr. Stephen Henson
b0e9ab95dd
Signature algorithm enhancement.
...
Change tls12_sigalg_allowed() so it is passed a SIGALG_LOOKUP parameter,
this avoids multiple lookups.
When we copy signature algorithms return an error if no valid TLS message
signing algorithm is present. For TLS 1.3 this means we need at least one
signature algorithm other than RSA PKCS#1 or SHA1 both of which can only be
used to sign certificates and not TLS messages.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2840 )
2017-03-03 22:02:39 +00:00
Dr. Stephen Henson
8f12296e23
Disallow zero length signature algorithms
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2840 )
2017-03-03 21:58:33 +00:00
Dr. Stephen Henson
224b4e37c0
Don't allow DSA for TLS 1.3
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2840 )
2017-03-03 21:58:33 +00:00
Matt Caswell
42f50fdf8a
Silence some more clang warnings
...
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2832 )
2017-03-03 00:05:57 +00:00
Matt Caswell
30d1bab146
Silence some clang warnings
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2831 )
2017-03-02 23:56:36 +00:00
Matt Caswell
09f2887482
Update early data API for writing to unauthenticated clients
...
Change the early data API so that the server must use
SSL_write_early_data() to write to an unauthenticated client.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:16 +00:00
Matt Caswell
0665b4edae
Rename SSL_write_early() to SSL_write_early_data()
...
This is for consistency with the rest of the API where all the functions
are called *early_data*.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:16 +00:00
Matt Caswell
f533fbd44a
Rename SSL_read_early() to SSL_read_early_data()
...
This is for consistency with the rest of the API where all the functions
are called *early_data*.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:16 +00:00
Matt Caswell
3eaa417095
Make SSL_write_early_finish() an internal only function
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:16 +00:00
Matt Caswell
f7e393be47
Various fixes required to allow SSL_write/SSL_read during early data
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:16 +00:00
Matt Caswell
d7f8783ff9
Enable the server to call SSL_write() without stopping the ability to call SSL_read_early()
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:16 +00:00
Matt Caswell
564547e482
Enable the client to call SSL_read() without stopping the ability to call SSL_write_early()
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:16 +00:00
Matt Caswell
4004ce5f6c
Introduce a new early_data state in the state machine
...
Also simplifies the state machine a bit.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:16 +00:00
Matt Caswell
bc908c679b
Improve the early data sanity check in SSL_do_handshake()
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:16 +00:00
Matt Caswell
0a5ece5bd2
Tighten sanity checks when calling early data functions
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:16 +00:00
Matt Caswell
f5b519c416
Make SSL_get_early_data_status() take a const
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:16 +00:00
Matt Caswell
46dcb9457e
Make SSL_get_max_early_data() and SSL_CTX_get_max_early_data() take a const
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
fcc4757823
Add a SSL_SESSION_get_max_early_data() function
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
7daf7156d8
Don't attempt to write more early_data than we know the server will accept
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
f637004037
Only accept early_data if the negotiated ALPN is the same
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
a832b5ef7a
Skip early_data if appropriate after a HelloRetryRequest
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
38df5a4527
Don't accept early_data if we are going to issue a HelloRetryRequest
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
538bea6c81
Add extra validation parsing the server-to-client early_data extension
...
Check that we actually resumed the session, and that we selected the first
identity.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
329114f91f
Remove some TLSv1.3 TODOs that are no longer relevant
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
2c604cb9af
Validate the ticket age for resumed sessions
...
If the ticket age calcualtions do not check out then we must not accept
early data (it could be a replay).
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
bfa9a9afe8
Provide a default value for max_early_data
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
70ef40a05e
Check max_early_data against the amount of early data we actually receive
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
67f78eadd0
Make sure we reset the read sequence when skipping records
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
10109364bf
Disallow handshake messages in the middle of early_data
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
c117af6765
Fix seg fault when sending early_data using CCM ciphersuites
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
b2cc7f313e
Implement client side parsing of the early_data extension
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
fe5e20fd26
Fix changing of the cipher state when dealing with early data
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
1ea4d09a3c
Construct the server side early_data extension
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
d781d247d1
Provide an SSL_read_early() function for reading early data
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
6cb422654d
Change the cipher state when sending early data
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
d49e23ec58
Implement the early data changes required in tls13_change_cipher_state()
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
0a87d0ac62
Parse the early_data extension
...
We also skip any early_data that subsequently gets sent. Later commits will
process it if we can.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:15 +00:00
Matt Caswell
a4f376af7e
Construct the early_data extension
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:14 +00:00
Matt Caswell
49e7fe12ea
Provide functions to write early data
...
We provide SSL_write_early() which *must* be called first on a connection
(prior to any other IO function including SSL_connect()/SSL_do_handshake()).
Also SSL_write_early_finish() which signals the end of early data.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:14 +00:00
Matt Caswell
5d5b3fba1f
Parse the ticket_early_data_info extension
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:14 +00:00
Matt Caswell
29fac541b0
Teach SSL_trace() about the early_data_info extension
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:14 +00:00
Matt Caswell
3fc8d85610
Construct the ticket_early_data_info extension
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2737 )
2017-03-02 17:44:14 +00:00
Matt Caswell
f33f9ddefb
Fix a compression bug
...
do_ssl3_write() was crashing when compression was enabled. We calculate
the maximum length that a record will be after compression and reserve
those bytes in the WPACKET. Unfortunately we were adding the maximum
compression overhead onto the wrong variable resulting in a corrupted
record.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2814 )
2017-03-02 16:49:28 +00:00
Matt Caswell
c19602b543
Ensure that we never select compression in TLSv1.3
...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2814 )
2017-03-02 16:49:28 +00:00
Jon Spillett
a3004c8203
Check for zero records and return immediately
...
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2822 )
2017-03-02 09:28:58 -05:00
Andy
607c926856
Code health: ssl/ssl_locl.h unused macros
...
CLA: trivial
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2806 )
2017-03-01 10:52:09 +00:00
Emilia Kasper
2f0ca54c32
Remove some obsolete/obscure internal define switches:
...
- FLAT_INC
- PKCS1_CHECK (the SSL_OP_PKCS1_CHECK options have been
no-oped)
- PKCS_TESTVECT (debugging leftovers)
- SSL_AD_MISSING_SRP_USERNAME (unfinished feature)
- DTLS_AD_MISSING_HANDSHAKE_MESSAGE (unfinished feature)
- USE_OBJ_MAC (note this removes a define from the public header but
very unlikely someone would be depending on it)
- SSL_FORBID_ENULL
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Stephen Henson <steve@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
2017-03-01 10:44:49 +01:00
Matt Caswell
38f2837b1b
Remove some commented out code in libssl
...
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2774 )
2017-02-28 16:02:11 +00:00