-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
driver-only ECDSA: enable ECDSA-based TLS 1.2 key exchanges #7117
Changes from all commits
f84b7d5
30c4618
75fba32
2f08147
1470ce3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1206,7 +1206,7 @@ static int ssl_handshake_init(mbedtls_ssl_context *ssl) | |||||
if (mbedtls_ssl_hash_from_md_alg(*md) == MBEDTLS_SSL_HASH_NONE) { | ||||||
continue; | ||||||
} | ||||||
#if defined(MBEDTLS_ECDSA_C) | ||||||
#if defined(MBEDTLS_PK_CAN_ECDSA_SOME) | ||||||
sig_algs_len += sizeof(uint16_t); | ||||||
#endif | ||||||
|
||||||
|
@@ -1234,7 +1234,7 @@ static int ssl_handshake_init(mbedtls_ssl_context *ssl) | |||||
if (hash == MBEDTLS_SSL_HASH_NONE) { | ||||||
continue; | ||||||
} | ||||||
#if defined(MBEDTLS_ECDSA_C) | ||||||
#if defined(MBEDTLS_PK_CAN_ECDSA_SOME) | ||||||
*p = ((hash << 8) | MBEDTLS_SSL_SIG_ECDSA); | ||||||
p++; | ||||||
#endif | ||||||
|
@@ -4979,22 +4979,25 @@ static int ssl_preset_suiteb_ciphersuites[] = { | |||||
*/ | ||||||
static uint16_t ssl_preset_default_sig_algs[] = { | ||||||
|
||||||
#if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_HAS_ALG_SHA_256_VIA_MD_OR_PSA_BASED_ON_USE_PSA) && \ | ||||||
#if defined(MBEDTLS_PK_CAN_ECDSA_SOME) && \ | ||||||
defined(MBEDTLS_HAS_ALG_SHA_256_VIA_MD_OR_PSA_BASED_ON_USE_PSA) && \ | ||||||
defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) | ||||||
MBEDTLS_TLS1_3_SIG_ECDSA_SECP256R1_SHA256, | ||||||
#endif /* MBEDTLS_ECDSA_C && MBEDTLS_HAS_ALG_SHA_256_VIA_MD_OR_PSA_BASED_ON_USE_PSA && | ||||||
#endif /* MBEDTLS_PK_CAN_ECDSA_SOME && MBEDTLS_HAS_ALG_SHA_256_VIA_MD_OR_PSA_BASED_ON_USE_PSA && | ||||||
MBEDTLS_ECP_DP_SECP256R1_ENABLED */ | ||||||
|
||||||
#if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_HAS_ALG_SHA_384_VIA_MD_OR_PSA_BASED_ON_USE_PSA) && \ | ||||||
#if defined(MBEDTLS_PK_CAN_ECDSA_SOME) && \ | ||||||
defined(MBEDTLS_HAS_ALG_SHA_384_VIA_MD_OR_PSA_BASED_ON_USE_PSA) && \ | ||||||
defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) | ||||||
MBEDTLS_TLS1_3_SIG_ECDSA_SECP384R1_SHA384, | ||||||
#endif /* MBEDTLS_ECDSA_C && MBEDTLS_HAS_ALG_SHA_384_VIA_MD_OR_PSA_BASED_ON_USE_PSA&& | ||||||
#endif /* MBEDTLS_PK_CAN_ECDSA_SOME && MBEDTLS_HAS_ALG_SHA_384_VIA_MD_OR_PSA_BASED_ON_USE_PSA&& | ||||||
MBEDTLS_ECP_DP_SECP384R1_ENABLED */ | ||||||
|
||||||
#if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_HAS_ALG_SHA_512_VIA_MD_OR_PSA_BASED_ON_USE_PSA) && \ | ||||||
#if defined(MBEDTLS_PK_CAN_ECDSA_SOME) && \ | ||||||
defined(MBEDTLS_HAS_ALG_SHA_512_VIA_MD_OR_PSA_BASED_ON_USE_PSA) && \ | ||||||
defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) | ||||||
MBEDTLS_TLS1_3_SIG_ECDSA_SECP521R1_SHA512, | ||||||
#endif /* MBEDTLS_ECDSA_C && MBEDTLS_HAS_ALG_SHA_384_VIA_MD_OR_PSA_BASED_ON_USE_PSA&& | ||||||
#endif /* MBEDTLS_PK_CAN_ECDSA_SOME && MBEDTLS_HAS_ALG_SHA_384_VIA_MD_OR_PSA_BASED_ON_USE_PSA&& | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (This is minor, not worth pushing if there's no other issue) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noted! In case no other change is required for this PR, I will solve it in a following one (ex: the one that I will create for addressing #7148) |
||||||
MBEDTLS_ECP_DP_SECP521R1_ENABLED */ | ||||||
|
||||||
#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) && \ | ||||||
|
@@ -5034,7 +5037,7 @@ static uint16_t ssl_preset_default_sig_algs[] = { | |||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2) | ||||||
static uint16_t ssl_tls12_preset_default_sig_algs[] = { | ||||||
#if defined(MBEDTLS_HAS_ALG_SHA_512_VIA_MD_OR_PSA_BASED_ON_USE_PSA) | ||||||
#if defined(MBEDTLS_ECDSA_C) | ||||||
#if defined(MBEDTLS_PK_CAN_ECDSA_SOME) | ||||||
MBEDTLS_SSL_TLS12_SIG_AND_HASH_ALG(MBEDTLS_SSL_SIG_ECDSA, MBEDTLS_SSL_HASH_SHA512), | ||||||
#endif | ||||||
#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) | ||||||
|
@@ -5045,7 +5048,7 @@ static uint16_t ssl_tls12_preset_default_sig_algs[] = { | |||||
#endif | ||||||
#endif /* MBEDTLS_HAS_ALG_SHA_512_VIA_MD_OR_PSA_BASED_ON_USE_PSA*/ | ||||||
#if defined(MBEDTLS_HAS_ALG_SHA_384_VIA_MD_OR_PSA_BASED_ON_USE_PSA) | ||||||
#if defined(MBEDTLS_ECDSA_C) | ||||||
#if defined(MBEDTLS_PK_CAN_ECDSA_SOME) | ||||||
MBEDTLS_SSL_TLS12_SIG_AND_HASH_ALG(MBEDTLS_SSL_SIG_ECDSA, MBEDTLS_SSL_HASH_SHA384), | ||||||
#endif | ||||||
#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) | ||||||
|
@@ -5056,7 +5059,7 @@ static uint16_t ssl_tls12_preset_default_sig_algs[] = { | |||||
#endif | ||||||
#endif /* MBEDTLS_HAS_ALG_SHA_384_VIA_MD_OR_PSA_BASED_ON_USE_PSA*/ | ||||||
#if defined(MBEDTLS_HAS_ALG_SHA_256_VIA_MD_OR_PSA_BASED_ON_USE_PSA) | ||||||
#if defined(MBEDTLS_ECDSA_C) | ||||||
#if defined(MBEDTLS_PK_CAN_ECDSA_SOME) | ||||||
MBEDTLS_SSL_TLS12_SIG_AND_HASH_ALG(MBEDTLS_SSL_SIG_ECDSA, MBEDTLS_SSL_HASH_SHA256), | ||||||
#endif | ||||||
#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I think I know what's the issue:
if in
component_test_psa_crypto_config_accel_ecdsa
I removeeverything builds and tests fine (as the test suites using ECDHE_ECDSA are skipped, there's no
MBEDTLS_PK_CAN_ECDSA_SOME
), but ssl-server2 and ssl-client2 report that they can use ECDHE-ECDSA ciphersuites, and the handshake fails.Is it a gap in the dependencies here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch! Indeed now that you mention it the ECDSA part of the dependency should be:
Wow, sorry for missing that and thanks for trying things out and catching it!
I wanted to do a final ECDSA PR to add a ChangeLog entry, I'll fix that there too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's the second time that that tricky pair of
MBEDTLS_USE_PSA_CRYPTO
vs!MBEDTLS_USE_PSA_CRYPTO
catches us :) Thanks!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it took me a while to understand the point here, but I agree with you now :)
@AndrzejKurek thanks for the hint!
@mpg you can assign the new issue to me so I will complete this part
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or can I simply create a pull request to fix this part without an associated issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry, I had already started working on it before I was your comment.
But in general yes, it's OK to create a PR without an issue - we just need to add a size label to the PR and add it to the EPICs board in the correct EPIC. (PRs linked to an issue don't need that as they show on the board attached to their issue.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem! Thanks for taking care of it ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#7245