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

Backport 2.x: fix SHA384 guards in TLS #4503

Conversation

gilles-peskine-arm
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm commented May 12, 2021

Even after the addition of MBEDTLS_SHA512_NO_SHA384, the TLS code gated the availability of SHA384 ciphersuites on MBEDTLS_SHA512_C alone, and in one case due to a typo on MBEDTLS_SHA1_C. Fix #4472, #4499.

For 3.0 this is fixed in #4304 (the issues were discovered while reviewing that PR).

I have not fixed a similar issue in ssl_cookie.c because I'm not sure what the fix is and it remains partly open in 3.0. It is filed as #4501.

There are no non-regression tests because I don't think it's easy to add them. I've filed the lack of tests as #4500. To test manually, build development_2.x with MBEDTLS_SHA512_NO_SHA384 defined and observe that programs/ssl/ssl_client2 help lists SHA384 cipher suites but they do not work. With this patch, the ciphersuites are no longer offered.

@gilles-peskine-arm gilles-peskine-arm added bug needs-review Every commit must be reviewed by at least two team members, component-tls needs-ci Needs to pass CI tests needs-reviewer This PR needs someone to pick it up for review labels May 12, 2021
@ronald-cron-arm ronald-cron-arm self-requested a review May 19, 2021 12:55
Copy link
Contributor

@ronald-cron-arm ronald-cron-arm left a comment

Choose a reason for hiding this comment

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

LGTM. Just spotted a very minor miss.

They depended on MBEDTLS_SHA512_C only. A check for !MBEDTLS_SHA512_NO_SHA384
was missing.

Fix Mbed-TLS#4499.

Signed-off-by: Gilles Peskine <[email protected]>
TLS code specific to SHA-384 was gated on MBEDTLS_SHA512_C. But SHA-384 also
requires that MBEDTLS_SHA512_NO_SHA384 is not defined. This lead to dead
code in TLS when MBEDTLS_SHA512_C and MBEDTLS_SHA512_NO_SHA384 were both
defined (i.e. when SHA-512 was enabled but not SHA-384).

Signed-off-by: Gilles Peskine <[email protected]>
@gilles-peskine-arm gilles-peskine-arm force-pushed the ciphersuite-sha384-guard-2.x branch from 2a98b7e to c54010c Compare May 19, 2021 14:58
Copy link
Contributor

@ronald-cron-arm ronald-cron-arm left a comment

Choose a reason for hiding this comment

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

All good to me now. Thanks.

@daverodgman daverodgman self-requested a review May 19, 2021 15:49
@daverodgman daverodgman removed the needs-reviewer This PR needs someone to pick it up for review label May 19, 2021
Copy link
Contributor

@daverodgman daverodgman left a comment

Choose a reason for hiding this comment

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

This looks good

@gilles-peskine-arm gilles-peskine-arm added approved Design and code approved - may be waiting for CI or backports and removed needs-ci Needs to pass CI tests needs-review Every commit must be reviewed by at least two team members, labels May 19, 2021
@gilles-peskine-arm gilles-peskine-arm merged commit 05c11e3 into Mbed-TLS:development_2.x May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Design and code approved - may be waiting for CI or backports bug component-tls
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants