diff options
author | Matt Caswell <matt@openssl.org> | 2016-11-09 14:06:12 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-11-23 15:31:21 +0000 |
commit | 92760c21e62c6e5ef172fa110cf47a509cd50f2f (patch) | |
tree | a1aa35edbe72218b6897221e9427456199ef5e95 /ssl/tls13_enc.c | |
parent | 0d9824c1712b6cacd9b0ecfba26fb66ae4badfb4 (diff) |
Update state machine to be closer to TLS1.3
This is a major overhaul of the TLSv1.3 state machine. Currently it still
looks like TLSv1.2. This commit changes things around so that it starts
to look a bit less like TLSv1.2 and bit more like TLSv1.3.
After this commit we have:
ClientHello
+ key_share ---->
ServerHello
+key_share
{CertificateRequest*}
{Certificate*}
{CertificateStatus*}
<---- {Finished}
{Certificate*}
{CertificateVerify*}
{Finished} ---->
[ApplicationData] <---> [Application Data]
Key differences between this intermediate position and the final TLSv1.3
position are:
- No EncryptedExtensions message yet
- No server side CertificateVerify message yet
- CertificateStatus still exists as a separate message
- A number of the messages are still in the TLSv1.2 format
- Still running on the TLSv1.2 record layer
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'ssl/tls13_enc.c')
-rw-r--r-- | ssl/tls13_enc.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/ssl/tls13_enc.c b/ssl/tls13_enc.c index 04dba3b23e..65b5dee768 100644 --- a/ssl/tls13_enc.c +++ b/ssl/tls13_enc.c @@ -214,6 +214,53 @@ int tls13_generate_master_secret(SSL *s, unsigned char *out, return tls13_generate_secret(s, prev, NULL, 0, out); } +/* + * Generates the mac for the Finished message. + * + * Returns the length of the MAC or 0 on error. + */ +size_t tls13_final_finish_mac(SSL *s, const char *str, size_t slen, + unsigned char *out) +{ + size_t hashlen; + const EVP_MD *md; + + /* + * TODO(TLS1.3): This is a dummy implementation for now. We need to come + * back and fill this in. + */ + md = ssl_handshake_md(s); + hashlen = EVP_MD_size(md); + memset(out, 0, hashlen); + + return hashlen; +} + +/* + * There isn't really a key block in TLSv1.3, but we still need this function + * for initialising the cipher and hash. + * + * Returns 1 on success or 0 on failure. + */ +int tls13_setup_key_block(SSL *s) +{ + const EVP_CIPHER *c; + const EVP_MD *hash; + int mac_type = NID_undef; + + s->session->cipher = s->s3->tmp.new_cipher; + if (!ssl_cipher_get_evp + (s->session, &c, &hash, &mac_type, NULL, NULL, 0)) { + SSLerr(SSL_F_TLS13_SETUP_KEY_BLOCK, SSL_R_CIPHER_OR_HASH_UNAVAILABLE); + return 0; + } + + s->s3->tmp.new_sym_enc = c; + s->s3->tmp.new_hash = hash; + + return 1; +} + const unsigned char client_handshake_traffic[] = "client handshake traffic secret"; const unsigned char client_application_traffic[] = |