-
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
Use switch statement instead if-else in psa_aead_check_nonce_length() and psa_aead_set_lengths(). Fixes #5065 #5072
Conversation
…PSA_WANT_ALG_CHACHA20_POLY1305 Signed-off-by: Przemyslaw Stekiel <[email protected]>
…th and psa_aead_set_lengths (fixes Mbed-TLS#5065) Signed-off-by: Przemyslaw Stekiel <[email protected]>
Signed-off-by: Przemyslaw Stekiel <[email protected]>
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.
Some minor documentation issues, other than that LGTM
ChangeLog.d/issue5065.txt
Outdated
* Use switch statement instead if-else in | ||
psa_aead_check_nonce_length() | ||
and psa_aead_set_lengths(). Fixes #5065. |
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.
Changelog entries are for users of the library, not for its developers. (Developers have the git commit messages.) “Use switch statement” is an implementation detail, it isn't relevant for users. Instead, the changelog entry should explain the consequence of the bug. For example:
Fix compile-time or run-time errors in PSA AEAD functions when ChachaPoly is disabled. Fixes #5065.
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.
Good point.
tests/scripts/all.sh
Outdated
@@ -1596,6 +1596,19 @@ component_test_psa_crypto_config_no_driver() { | |||
make test | |||
} | |||
|
|||
component_test_psa_crypto_config_chachapoly_disabled() { | |||
# full - MBEDTLS_CHACHAPOLY_C without PSA_WANT_ALG_GCM and PSA_WANT_ALG_CHACHA20_POLY1305 | |||
msg "build: full - MBEDTLS_CHACHAPOLY_C without PSA_WANT_ALG_GCM and PSA_WANT_ALG_CHACHA20_POLY1305" |
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.
The description says that MBEDTLS_CHACHAPOLY_C
is enabled, but the code disables it. The status of MBEDTLS_CHACHAPOLY_C
is irrelevant for this test. So please remove it from both the description and the code. This is full minus GCM and Chachapoly for PSA.
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.
The description says that MBEDTLS_CHACHAPOLY_C
is disabled (full -(minus) MBEDTLS_CHACHAPOLY_C
).
I think it is relevant for the test as without this I wasn't able to reproduce the issue( with BEDTLS_CHACHAPOLY_C
PSA_WANT_ALG_CHACHA20_POLY1305
is always defined):
https://github.com/ARMmbed/mbedtls/blob/2bb5e9c973cf7a37eacb50a65537c921b60f2fac/include/mbedtls/config_psa.h#L647-L650
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.
Changed -
to minus
in description.
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.
The status of MBEDTLS_CHACHAPOLY_C
is irrelevant, but the status of PSA_WANT_ALG_CHACHA20_POLY1305
is. There are two ways you can have PSA_WANT_ALG_CHACHA20_POLY1305
enabled:
MBEDTLS_CHACHAPOLY_C
enabled. (PSA chachapoly implemented with Mbed TLS's built-in implementation.)MBEDTLS_PSA_CRYPTO_CONFIG
enabled andMBEDTLS_PSA_ACCEL_ALG_CHACHA20_POLY1305
enabled. (PSA chachapoly implemented with a third-party driver.)
The test needs to pick one, but it's not particularly important which one it picks.
Signed-off-by: Przemyslaw Stekiel <[email protected]>
It seems that backport to |
The bug is in a part of the code that doesn't exist in 2.x, so there's no fix to backport. But please backport the new test. |
Created backport PR #5083 |
The latest pr-merge failed due to the known intermittent issue #3377. https://jenkins-mbedtls.oss.arm.com/blue/organizations/jenkins/mbed-tls-pr-merge/detail/PR-5072-merge/6/pipeline/ passed. |
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.
LGTM
backport 2.x: backport only new test in all.sh from #5072
The original goal (Mbed-TLS#5072) was to run a test with ChaChaPoly disabled in PSA. It was actually implemented with GCM also partially disabled (legacy GCM enabled but PSA GCM disabled), which distracted from the objective. It's actually useful to test both with and without GCM, so test both. Don't test inconsistencies between legacy and PSA support because that's not a common case and not one we have particular reasons to test. Signed-off-by: Gilles Peskine <[email protected]>
The original goal (Mbed-TLS#5072) was to run a test with ChaChaPoly disabled in PSA. It was actually implemented with GCM also partially disabled (legacy GCM enabled but PSA GCM disabled), which distracted from the objective. It's actually useful to test both with and without GCM, so test both. Don't test inconsistencies between legacy and PSA support because that's not a common case and not one we have particular reasons to test. Signed-off-by: Gilles Peskine <[email protected]>
The original goal (Mbed-TLS#5072) was to run a test with ChaChaPoly disabled in PSA. It was actually implemented with GCM also partially disabled (legacy GCM enabled but PSA GCM disabled), which distracted from the objective. It's actually useful to test both with and without GCM, so test both. Don't test inconsistencies between legacy and PSA support because that's not a common case and not one we have particular reasons to test. Signed-off-by: Gilles Peskine <[email protected]>
Description
Fixes #5065.
Without this fix added test component (
component_test_psa_crypto_config_chachapoly_disabled
) fails as follows:With the fix all tests pass for
component_test_psa_crypto_config_chachapoly_disabled
and there is no compilator warning.Status
READY
Requires Backporting
No
Migrations
NO
Additional comments
I'm not sure if the name and description of the added test component is consistent with the requirements.