ssl: accept TLS 1.2 rsa_pss_rsae signature algorithms#10672
ssl: accept TLS 1.2 rsa_pss_rsae signature algorithms#10672ronald-cron-arm merged 6 commits intoMbed-TLS:developmentfrom
Conversation
Signed-off-by: Viktor Sokolovskiy <maokaman@gmail.com>
2a5a942 to
c064ba0
Compare
|
Thank you very much for providing a fix! We'll review it ASAP since it's a regression that causes a major interoperability problem. |
gilles-peskine-arm
left a comment
There was a problem hiding this comment.
Thank you very much for contributing this!
The fix looks plausible to me, but I'm not sure it's complete. We really should have a non-regression test in ssl-opt.sh. I'm not sure how to write it.
Signed-off-by: Viktor Sokolovskiy <maokaman@gmail.com>
gilles-peskine-arm
left a comment
There was a problem hiding this comment.
LGTM, with perhaps a question of whether we're doing enough testing in ssl-opt.sh. I'll defer to Ronald on this as he's much more familiar than I am with sigalgs-related testing.
ronald-cron-arm
left a comment
There was a problem hiding this comment.
Sorry for the delay, please find my comments below.
Signed-off-by: Viktor Sokolovskiy <maokaman@gmail.com>
ronald-cron-arm
left a comment
There was a problem hiding this comment.
Thanks for addressing my comments. LGTM.
gilles-peskine-arm
left a comment
There was a problem hiding this comment.
LGTM
Can you please update the 3.6 backport, and also make a backport for the new LTS branch mbedtls-4.1?
|
Do you think the patch below is warranted for this PR? @@ -2069,13 +2073,13 @@ start_processing:
}
#endif
-#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT)
+#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) || defined(PSA_WANT_ALG_RSA_PSS)
if (pk_alg == MBEDTLS_PK_SIGALG_RSA_PSS) {
ret = mbedtls_pk_verify_ext((mbedtls_pk_sigalg_t) pk_alg, peer_pk,
md_alg, hash, hashlen,
p, sig_len);
} else
-#endif /* MBEDTLS_X509_RSASSA_PSS_SUPPORT */
+#endif /* MBEDTLS_X509_RSASSA_PSS_SUPPORT || PSA_WANT_ALG_RSA_PSS */
ret = mbedtls_pk_verify_restartable(peer_pk,
md_alg, hash, hashlen, p, sig_len, rs_ctx);
@@ -2090,7 +2094,14 @@ start_processing:
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR);
}
- MBEDTLS_SSL_DEBUG_RET(1, "mbedtls_pk_verify_restartable", ret);
+#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) || defined(PSA_WANT_ALG_RSA_PSS)
+ if (pk_alg == MBEDTLS_PK_SIGALG_RSA_PSS) {
+ MBEDTLS_SSL_DEBUG_RET(1, "mbedtls_pk_verify_ext", ret);
+ } else
+#endif /* MBEDTLS_X509_RSASSA_PSS_SUPPORT || PSA_WANT_ALG_RSA_PSS */
+ {
+ MBEDTLS_SSL_DEBUG_RET(1, "mbedtls_pk_verify_restartable", ret);
+ }
#if defined(MBEDTLS_SSL_ECP_RESTARTABLE_ENABLED)
if (ret == MBEDTLS_ERR_ECP_IN_PROGRESS) {
ret = MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS; |
|
Regarding |
Signed-off-by: Viktor Sokolovskiy <maokaman@gmail.com>
3d61c38
gilles-peskine-arm
left a comment
There was a problem hiding this comment.
Approving the merge.
For future reference, please don't add merge commits to a pull request unless there's a merge conflict.
Signed-off-by: Viktor Sokolovskiy <maokaman@gmail.com>
Description
Fixes #10668
Fix a TLS 1.2 client regression introduced by the signature-algorithm validation added in commit 9f19fe1.
The new validation correctly rejects signature algorithms that are invalid for TLS 1.2 or were not offered by the client, but it also rejects valid
rsa_pss_rsae_*SignatureScheme values even when RSA-PSS support is compiled in. As a result, handshakes with TLS 1.2 servers using RSA-PSS signatures can fail withMBEDTLS_ERR_SSL_ILLEGAL_PARAMETER(-0x6600).This PR updates the TLS 1.2 support check to accept
rsa_pss_rsae_sha256/384/512when the corresponding RSA-PSS and hash support is available, and adds regression tests for these values.PR checklist