Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add remaining TLS 1.3 ciphersuites #2550

Closed
wants to merge 10 commits into from

Conversation

snhenson
Copy link
Contributor

@snhenson snhenson commented Feb 3, 2017

Checklist
  • documentation is added or updated
  • tests are added or updated
Description of change

This adds the remaining TLS 1.3 ciphersuites and fixes the code to support CCM. They all connect with OpenSSL itself and GCM-256 and Chacha/Poly connects to the google test server.

Q: anyone have an implementation that supports CCM and CCM8 we can test against?

Added entries to the cipherlist test. The existing tests will check a handshake can be completed with the new ciphersuites,

The Chacha/Poly code might need to be more explicit too: it works but that's seems to be coincidence because the GCM parameters work with it.

@snhenson snhenson changed the title WIP add remaining TLS 1.3 ciphersuites Add remaining TLS 1.3 ciphersuites Feb 4, 2017
NULL) <= 0)
return -1;
} else {
taglen = EVP_GCM_TLS_TAG_LEN;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of think we should have a branch here for chacha/poly...even it happens to be the same value. Failing that we should at least have a comment about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

* byte that we know must have been encrypted.
*/
if (rec->length < EVP_GCM_TLS_TAG_LEN)
if (rec->length < taglen)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this now be if (rec->length < taglen + 1) to account for the second TODO item you removed here? We've done the work to swap over the record layer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

ssl/s3_lib.c Outdated
SSL_kANY,
SSL_aANY,
SSL_HIGH,
SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we drop the TLS1_PRF_SHA256 bit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this is presumably (haven't checked the code) used to determine which algorithm to use for the HKDF: maybe change it to TLS13_HKDF_SHA256 etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see we're using the handshake MD for that instead. I'll remove that PRF bit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think they're always the same in TLS1.3, so there doesn't seem any reason to have two flags which are always going to indicate the same hash.

@@ -2127,6 +2127,10 @@ static int aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
if (cctx->tls_aad_len >= 0)
return aes_ccm_tls_cipher(ctx, out, in, len);

/* EVP_*Final() doesn't return any data */
if (in == NULL && out != NULL)
return 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand this change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to a bug in the CCM code EVP_*Final() used to always return an error if any data had been processed: that was because EVP_*Update() in CCM mode resets the iv_set, tag_set and len_set fields in (as CCM mode can only call EVP_*Update once).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is this a bug fix for backport?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I'll create a PR for 1.1.0.

@snhenson
Copy link
Contributor Author

snhenson commented Feb 7, 2017

Update: rebased and addressed comments so far.

SSL_AEAD,
TLS1_3_VERSION, TLS1_3_VERSION,
0, 0,
SSL_NOT_DEFAULT | SSL_HIGH,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we marking the CCM ciphersuites as SSL_NOT_DEFAULT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've done the same with the other CCM ciphersuites.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found it here: a556f34
The rationale provided for removing CCM from the default cipherlist is that it's "rarely used" (which is both subjective and circular) and to "reduce ClientHello bloat" (which is hardly applicable to TLS 1.3).

@snhenson snhenson closed this Feb 8, 2017
levitte pushed a commit that referenced this pull request Feb 8, 2017
Add SSL_kANY and SSL_aANY contants for TLS 1.3 ciphersuites. Return
appropriate text strings when they are used.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #2550)
levitte pushed a commit that referenced this pull request Feb 8, 2017
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #2550)
levitte pushed a commit that referenced this pull request Feb 8, 2017
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #2550)
levitte pushed a commit that referenced this pull request Feb 8, 2017
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #2550)
levitte pushed a commit that referenced this pull request Feb 8, 2017
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #2550)
levitte pushed a commit that referenced this pull request Feb 8, 2017
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #2550)
levitte pushed a commit that referenced this pull request Feb 8, 2017
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #2550)
levitte pushed a commit that referenced this pull request Feb 8, 2017
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #2550)
levitte pushed a commit that referenced this pull request Feb 8, 2017
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #2550)
levitte pushed a commit that referenced this pull request Feb 8, 2017
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #2550)
tniessen added a commit to tniessen/node that referenced this pull request Jul 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants