Skip to content

library: check_config: remove RSA encryption requirement from ECDHE-RSA#10639

Queued
valeriosetti wants to merge 3 commits intoMbed-TLS:developmentfrom
valeriosetti:ecdhe-rsa-fix-check
Queued

library: check_config: remove RSA encryption requirement from ECDHE-RSA#10639
valeriosetti wants to merge 3 commits intoMbed-TLS:developmentfrom
valeriosetti:ecdhe-rsa-fix-check

Conversation

@valeriosetti
Copy link
Copy Markdown
Contributor

Description

ECDHE-RSA only requires RSA signature, not encryption. This commits fixes guards in "mbedtls_check_config.h".

PR checklist

  • changelog not required because: minor fix which is a bit of corner case configuration wise.
  • development PR not required because: this one
  • TF-PSA-Crypto PR not required because: no change there
  • framework PR not required
  • 3.6 PR not required because: only applies to development where guards are PSA only
  • tests not required because: minor improvement

@valeriosetti valeriosetti added needs-review Every commit must be reviewed by at least two team members, needs-ci Needs to pass CI tests needs-reviewer This PR needs someone to pick it up for review priority-high High priority - will be reviewed soon size-xs Estimated task size: extra small (a few hours at most) labels Mar 13, 2026
@valeriosetti valeriosetti requested a review from yanesca March 13, 2026 13:12
yanesca
yanesca previously approved these changes Mar 13, 2026
Copy link
Copy Markdown
Contributor

@yanesca yanesca left a comment

Choose a reason for hiding this comment

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

LGTM

@bjwtaylor bjwtaylor self-requested a review March 13, 2026 14:20
#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
( !defined(MBEDTLS_CAN_ECDH) || !defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC) || \
!defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(PSA_WANT_ALG_RSA_PKCS1V15_CRYPT) || !defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN) )
!defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN) )
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can we also update the dependency here tests/scripts/depends.py:277, or is this still required?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nice catch, thanks!

@valeriosetti valeriosetti removed the needs-ci Needs to pass CI tests label Mar 15, 2026
Comment thread tests/scripts/depends.py Outdated
'MBEDTLS_X509_RSASSA_PSS_SUPPORT'],
'PSA_WANT_ALG_RSA_PKCS1V15_CRYPT': ['PSA_WANT_ALG_RSA_PKCS1V15_SIGN',
'MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED'],
'PSA_WANT_ALG_RSA_PKCS1V15_CRYPT': ['PSA_WANT_ALG_RSA_PKCS1V15_SIGN'],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I can't see this dependency in either of the check_config.h files. I think what we need here is:

Suggested change
'PSA_WANT_ALG_RSA_PKCS1V15_CRYPT': ['PSA_WANT_ALG_RSA_PKCS1V15_SIGN'],
'PSA_WANT_ALG_RSA_PKCS1V15_SIGN': ['MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED'],

(I haven't tested whether this would make the CI happy.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh yes, of course. Previously it was working because PSA_WANT_ALG_RSA_PKCS1V15_SIGN and MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED were disabled at the same time (from the wrong signal, but still...).
Thanks! I will apply immediately

@valeriosetti valeriosetti requested a review from yanesca March 17, 2026 10:05
yanesca
yanesca previously approved these changes Mar 17, 2026
Copy link
Copy Markdown
Contributor

@yanesca yanesca left a comment

Choose a reason for hiding this comment

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

LGTM

@valeriosetti
Copy link
Copy Markdown
Contributor Author

Sorry, I had to patch depends.py once again to fix another failure with pkalgs testing. Thanks @bjwtaylor for the heads up!
Hopefully the CI should be happy now.

@valeriosetti valeriosetti requested a review from yanesca March 17, 2026 13:39
bjwtaylor
bjwtaylor previously approved these changes Mar 17, 2026
yanesca
yanesca previously approved these changes Mar 17, 2026
Copy link
Copy Markdown
Contributor

@yanesca yanesca left a comment

Choose a reason for hiding this comment

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

LGTM

@github-project-automation github-project-automation Bot moved this from In Development to Has Approval in Roadmap pull requests (new board) Mar 17, 2026
@valeriosetti valeriosetti enabled auto-merge March 17, 2026 15:02
@valeriosetti valeriosetti added approved Design and code approved - may be waiting for CI or backports and removed needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review labels Mar 17, 2026
@valeriosetti
Copy link
Copy Markdown
Contributor Author

@yanesca @bjwtaylor since this PR missed the code freeze, please wait for the CI to be fully green before taking another look.

@valeriosetti valeriosetti added needs-ci Needs to pass CI tests and removed approved Design and code approved - may be waiting for CI or backports labels Mar 17, 2026
@valeriosetti
Copy link
Copy Markdown
Contributor Author

I think that current CI complains in result-analysis reveal a lack of testing:

[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(MD5): !RSA_PKCS1V15_SIGN with RSA_KEY_PAIR
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(MD5): !RSA_PKCS1V15_SIGN with RSA_PUBLIC_KEY
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(RIPEMD160): !RSA_PKCS1V15_SIGN with RSA_KEY_PAIR
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(RIPEMD160): !RSA_PKCS1V15_SIGN with RSA_PUBLIC_KEY
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(SHA3_224): !RSA_PKCS1V15_SIGN with RSA_KEY_PAIR
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(SHA3_224): !RSA_PKCS1V15_SIGN with RSA_PUBLIC_KEY
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(SHA3_256): !RSA_PKCS1V15_SIGN with RSA_KEY_PAIR
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(SHA3_256): !RSA_PKCS1V15_SIGN with RSA_PUBLIC_KEY
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(SHA3_384): !RSA_PKCS1V15_SIGN with RSA_KEY_PAIR
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(SHA3_384): !RSA_PKCS1V15_SIGN with RSA_PUBLIC_KEY
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(SHA3_512): !RSA_PKCS1V15_SIGN with RSA_KEY_PAIR
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(SHA3_512): !RSA_PKCS1V15_SIGN with RSA_PUBLIC_KEY
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(SHA_1): !RSA_PKCS1V15_SIGN with RSA_KEY_PAIR
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(SHA_1): !RSA_PKCS1V15_SIGN with RSA_PUBLIC_KEY
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(SHA_224): !RSA_PKCS1V15_SIGN with RSA_KEY_PAIR
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(SHA_224): !RSA_PKCS1V15_SIGN with RSA_PUBLIC_KEY
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(SHA_256): !RSA_PKCS1V15_SIGN with RSA_KEY_PAIR
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(SHA_256): !RSA_PKCS1V15_SIGN with RSA_PUBLIC_KEY
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(SHA_384): !RSA_PKCS1V15_SIGN with RSA_KEY_PAIR
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(SHA_384): !RSA_PKCS1V15_SIGN with RSA_PUBLIC_KEY
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(SHA_512): !RSA_PKCS1V15_SIGN with RSA_KEY_PAIR
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN(SHA_512): !RSA_PKCS1V15_SIGN with RSA_PUBLIC_KEY
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN_RAW: !RSA_PKCS1V15_SIGN_RAW with RSA_KEY_PAIR
[2026-03-17T19:24:46.168Z] Error: Test case not executed: test_suite_psa_crypto_op_fail.generated;PSA sign RSA_PKCS1V15_SIGN_RAW: !RSA_PKCS1V15_SIGN_RAW with RSA_PUBLIC_KEY

It seems we have no tests where RSA_PKCS1V15_SIGN is unset, but RSA_KEY_PAIR/RSA_PUBLIC_KEY are set. Am I wrong?

ECDHE-RSA only requires RSA signature, not encryption. This commits fixes
guards in "mbedtls_check_config.h".

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
…SIGN

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
@valeriosetti valeriosetti removed the needs-ci Needs to pass CI tests label Mar 20, 2026
Comment thread tests/scripts/depends.py
'PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC',
'PSA_WANT_ALG_RSA_OAEP',
'PSA_WANT_ALG_RSA_PKCS1V15_CRYPT',
'PSA_WANT_ALG_RSA_PKCS1V15_SIGN',
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@mpg does this somehow reduces gaps for RSA testing you mentioned recently?

Copy link
Copy Markdown
Contributor

@mpg mpg Mar 24, 2026

Choose a reason for hiding this comment

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

I don't think this line does, what I was after was builds with RSA_PUBLIC_KEY but not RSA_KEY_PAIR_BASIC. Though looking at the context, we seem to have that already - not sure why it didn't show when I searched the outcomes file, perhaps it's not being correctly filled by depends.py? That's something I'd like to double-check later. (Unless you beat me to it, of course - please feel free!)

@valeriosetti
Copy link
Copy Markdown
Contributor Author

@bjwtaylor @yanesca now the CI is fine.

@valeriosetti
Copy link
Copy Markdown
Contributor Author

@yanesca can you please take another look at this PR?

Question: since this is adding a new check in mbedtls_check_config.h does it need to be backported? On one hand I would say yes because this would be beneficial also for the LTS, but OTOH I'm always a bit cautious when changing a user facing header in an LTS...

Copy link
Copy Markdown
Contributor

@yanesca yanesca left a comment

Choose a reason for hiding this comment

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

LGTM.

Regarding the backport, I agree that we shouldn't fiddle with a user facing headers, but this one looks safe: We are removing a requirement, whatever config built successfully will continue to build in the future, this change shouldn't break any existing user.

@valeriosetti valeriosetti added this pull request to the merge queue Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority-high High priority - will be reviewed soon size-xs Estimated task size: extra small (a few hours at most)

Projects

Development

Successfully merging this pull request may close these issues.

4 participants