mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-24 15:02:55 +00:00
test: psa: minor improvements to test
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
This commit is contained in:
parent
d5fa0bfb85
commit
f11e05a413
@ -7989,6 +7989,8 @@ run_test "ECJPAKE: server not configured" \
|
|||||||
-C "found ecjpake_kkpp extension" \
|
-C "found ecjpake_kkpp extension" \
|
||||||
-s "SSL - The handshake negotiation failed"
|
-s "SSL - The handshake negotiation failed"
|
||||||
|
|
||||||
|
# Note: if the name of this test is changed, then please adjust the corresponding
|
||||||
|
# filtering label in "test_tls1_2_ecjpake_compatibility" (in "all.sh")
|
||||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
|
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
|
||||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||||
run_test "ECJPAKE: working, TLS" \
|
run_test "ECJPAKE: working, TLS" \
|
||||||
@ -8028,6 +8030,8 @@ run_test "ECJPAKE: opaque password client+server, working, TLS" \
|
|||||||
-S "SSL - The handshake negotiation failed" \
|
-S "SSL - The handshake negotiation failed" \
|
||||||
-S "SSL - Verification of the message MAC failed"
|
-S "SSL - Verification of the message MAC failed"
|
||||||
|
|
||||||
|
# Note: if the name of this test is changed, then please adjust the corresponding
|
||||||
|
# filtering label in "test_tls1_2_ecjpake_compatibility" (in "all.sh")
|
||||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
|
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
|
||||||
requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
|
requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
|
||||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||||
@ -8049,6 +8053,8 @@ run_test "ECJPAKE: opaque password client only, working, TLS" \
|
|||||||
-S "SSL - The handshake negotiation failed" \
|
-S "SSL - The handshake negotiation failed" \
|
||||||
-S "SSL - Verification of the message MAC failed"
|
-S "SSL - Verification of the message MAC failed"
|
||||||
|
|
||||||
|
# Note: if the name of this test is changed, then please adjust the corresponding
|
||||||
|
# filtering label in "test_tls1_2_ecjpake_compatibility" (in "all.sh")
|
||||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
|
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
|
||||||
requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
|
requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
|
||||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||||
|
@ -2590,12 +2590,12 @@ int tweak_tls13_certificate_msg_vector_len(
|
|||||||
ret = ( use_opaque_arg ) ? \
|
ret = ( use_opaque_arg ) ? \
|
||||||
mbedtls_ssl_set_hs_ecjpake_password_opaque( &ssl, pwd_slot ) : \
|
mbedtls_ssl_set_hs_ecjpake_password_opaque( &ssl, pwd_slot ) : \
|
||||||
mbedtls_ssl_set_hs_ecjpake_password( &ssl, pwd_string, pwd_len ); \
|
mbedtls_ssl_set_hs_ecjpake_password( &ssl, pwd_string, pwd_len ); \
|
||||||
TEST_ASSERT( ret == exp_ret_val )
|
TEST_EQUAL( ret, exp_ret_val )
|
||||||
#else
|
#else
|
||||||
#define ECJPAKE_TEST_SET_PASSWORD( exp_ret_val ) \
|
#define ECJPAKE_TEST_SET_PASSWORD( exp_ret_val ) \
|
||||||
ret = mbedtls_ssl_set_hs_ecjpake_password( &ssl, \
|
ret = mbedtls_ssl_set_hs_ecjpake_password( &ssl, \
|
||||||
pwd_string, pwd_len ); \
|
pwd_string, pwd_len ); \
|
||||||
TEST_ASSERT( ret == exp_ret_val )
|
TEST_EQUAL( ret, exp_ret_val )
|
||||||
#endif
|
#endif
|
||||||
/* END_HEADER */
|
/* END_HEADER */
|
||||||
|
|
||||||
@ -6219,13 +6219,12 @@ void ssl_ecjpake_set_password( int use_opaque_arg )
|
|||||||
|
|
||||||
mbedtls_ssl_config_init( &conf );
|
mbedtls_ssl_config_init( &conf );
|
||||||
|
|
||||||
TEST_ASSERT( mbedtls_ssl_config_defaults( &conf,
|
TEST_EQUAL( mbedtls_ssl_config_defaults( &conf,
|
||||||
MBEDTLS_SSL_IS_CLIENT,
|
MBEDTLS_SSL_IS_CLIENT,
|
||||||
MBEDTLS_SSL_TRANSPORT_STREAM,
|
MBEDTLS_SSL_TRANSPORT_STREAM,
|
||||||
MBEDTLS_SSL_PRESET_DEFAULT )
|
MBEDTLS_SSL_PRESET_DEFAULT ), 0 );
|
||||||
== 0 );
|
|
||||||
|
|
||||||
TEST_ASSERT( mbedtls_ssl_setup( &ssl, &conf ) == 0 );
|
TEST_EQUAL( mbedtls_ssl_setup( &ssl, &conf ), 0 );
|
||||||
|
|
||||||
/* test with empty password or unitialized password key (depending on use_opaque_arg) */
|
/* test with empty password or unitialized password key (depending on use_opaque_arg) */
|
||||||
ECJPAKE_TEST_SET_PASSWORD( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
ECJPAKE_TEST_SET_PASSWORD( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||||
@ -6242,8 +6241,8 @@ void ssl_ecjpake_set_password( int use_opaque_arg )
|
|||||||
psa_set_key_algorithm( &attributes, PSA_ALG_JPAKE );
|
psa_set_key_algorithm( &attributes, PSA_ALG_JPAKE );
|
||||||
psa_set_key_type( &attributes, PSA_KEY_TYPE_PASSWORD );
|
psa_set_key_type( &attributes, PSA_KEY_TYPE_PASSWORD );
|
||||||
|
|
||||||
TEST_ASSERT( psa_import_key( &attributes, pwd_string,
|
PSA_ASSERT( psa_import_key( &attributes, pwd_string,
|
||||||
pwd_len, &pwd_slot ) == PSA_SUCCESS );
|
pwd_len, &pwd_slot ) );
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user