-
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
Test TLS 1.2 builds with each encryption type #6374
Conversation
Signed-off-by: Przemek Stekiel <[email protected]>
Both functions are used when MBEDTLS_SSL_SOME_SUITES_USE_MAC is defined not MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC. Signed-off-by: Przemek Stekiel <[email protected]>
…e() functions Both functions are calling mbedtls_cipher_auth_[encrypt/decrypt]_ext() functions. These functions are guarded with MBEDTLS_CIPHER_MODE_AEAD || MBEDTLS_NIST_KW_C flags - make it consistent. As a result ssl_server2 won't build now with MBEDTLS_SSL_SESSION_TICKETS enabled (mbedtls_cipher_auth_[encrypt/decrypt]_ext() functions not available). Mark MBEDTLS_SSL_SESSION_TICKETS as dependent on MBEDTLS_CIPHER_MODE_AEAD || MBEDTLS_NIST_KW_C and disable MBEDTLS_SSL_SESSION_TICKETS in stream cipher only build. Signed-off-by: Przemek Stekiel <[email protected]>
It is done to have MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH macro available (used in tests) Signed-off-by: Przemek Stekiel <[email protected]>
Signed-off-by: Przemek Stekiel <[email protected]>
@mpg I wasn't sure if this is going in the right direction a specially part with disabling
It is failing because Lines 3807 to 3812 in 5596c74
I assume that the check fails correctly as AEAD is disabled, so probably this test should be skipped. Lines 1041 to 1050 in 5596c74
|
Right, it makes sense that
Looks correct to me: all supported cipher suites either have a MAC or an AEAD tag (we don't implement the NULL_NULL cipher suite which has no security at all, only cipher suites with authentication but where the encryption may be NULL). If there are MAC cipher suites in the build then we check whether the selected cipher suite uses AEAD; if there are no MAC cipher suites then the selected cipher suite must be AEAD. |
Signed-off-by: Przemek Stekiel <[email protected]>
Signed-off-by: Przemek Stekiel <[email protected]>
Signed-off-by: Przemek Stekiel <[email protected]>
…cipher only Signed-off-by: Przemek Stekiel <[email protected]>
In full config TLS 1.2 is disabled. Signed-off-by: Przemek 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.
Just a first quick review for early feedback.
tests/scripts/all.sh
Outdated
@@ -1274,6 +1274,38 @@ component_test_crypto_full_no_cipher () { | |||
make test | |||
} | |||
|
|||
component_test_crypto_default_stream_cipher_only () { |
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.
Naming: I'm not sure "crypto" is meaningful here. Since this test (and the other two that are coming) are motivated by the risk for issues with TLS 1.2 when only one of its encryption modes is active, I think tls1_2
would make more sense.
tests/scripts/all.sh
Outdated
scripts/config.py unset MBEDTLS_CHACHAPOLY_C | ||
# CBC-legacy (controlled by MBEDTLS_CIPHER_MODE_CBC plus at least one block cipher (AES, ARIA, Camellia, DES)) | ||
scripts/config.py unset MBEDTLS_CIPHER_MODE_CBC | ||
scripts/config.py unset MBEDTLS_AES_C |
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.
I don't think you need to disable all those ciphers, just disabling CIPHER_MODE_CBC
is enough. I think also disabling the ciphers just add clutter (especially with things that depend on AES).
tests/scripts/all.sh
Outdated
# CBC-EtM (controlled by the same as CBC-legacy plus MBEDTLS_SSL_ENCRYPT_THEN_MAC) | ||
scripts/config.py unset MBEDTLS_SSL_ENCRYPT_THEN_MAC | ||
# stream (currently that's just the NULL pseudo-cipher (controlled by MBEDTLS_CIPHER_NULL_CIPHER) | ||
scripts/config.py unset MBEDTLS_CIPHER_NULL_CIPHER |
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.
I find it potentially confusing that unset this here and set is a few lines below.
Signed-off-by: Przemek Stekiel <[email protected]>
While addressing review comments and optimizing components setup I encountered strange failure:
Test case: mbedtls/tests/suites/test_suite_cmac.data Lines 31 to 33 in 77c691f
The test case description says |
Ah, each time we add tests we uncover new and in this case pretty unexpected bugs! I think test cases 5 to 7 are wrong in that they use a cipher ID where a cipher type is expected, as you say. I think cases 5 and 6 should use |
Signed-off-by: Przemek Stekiel <[email protected]>
… cipher components Signed-off-by: Przemek Stekiel <[email protected]>
…ket_parse() functions" This reverts commit a82290b. Signed-off-by: Przemek Stekiel <[email protected]>
Signed-off-by: Przemek 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.
LGTM
include/mbedtls/check_config.h
Outdated
@@ -874,6 +874,11 @@ | |||
#error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites" | |||
#endif | |||
|
|||
#if defined(MBEDTLS_SSL_TICKET_C) && \ | |||
!( defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CCM_C) || defined(MBEDTLS_CHACHAPOLY_C) ) | |||
#error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites" |
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.
Minor: double space
@@ -1404,7 +1404,7 @@ int main( int argc, char *argv[] ) | |||
#if defined(MBEDTLS_SSL_CACHE_C) | |||
mbedtls_ssl_cache_context cache; | |||
#endif | |||
#if defined(MBEDTLS_SSL_SESSION_TICKETS) | |||
#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_TICKET_C) |
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.
Ifdef at line 286 - missing MBEDTLS_SSL_TICKET_C
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.
@mprse I believe it's about the guards around USAGE_TICKETS
near the top of the file. It's not a major issue (the worst that will happen is that the usage message will mention options that are not actually available in some configs), but not that Andrzej spotted it, we might as well fix 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.
Yup. I hope it is ok now (force-pushed the last commit).
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.
Please fix the missing ifdef around the usage text.
Signed-off-by: Przemek 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.
LGTM
This one together with backport seems to be ready for merge, but I'm not sure about the CI. There is windows build failure, but looks unrelated. |
The Windows failure on OpenCI is an infrastructure glitch and the armcc failure is a known infrastructure issue. The Arm CI passed so this PR has passed the CI. |
Description
Resolves #6313
Status
READY
Requires Backporting
Yes/2.28
#6394
Migrations
NO
Additional comments
Any additional information that could be of interest
Todos