mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-03-22 15:25:07 +00:00
Test that failure of import_key preserves metadata
This commit is contained in:
parent
d7c75707b8
commit
a426168cbf
|
@ -323,6 +323,10 @@ PSA import EC keypair: valid key but RSA
|
|||
depends_on:MBEDTLS_PK_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_BP512R1_ENABLED:MBEDTLS_RSA_C
|
||||
import:"3082013b020100024100ee2b131d6b1818a94ca8e91c42387eb15a7c271f57b89e7336b144d4535b16c83097ecdefbbb92d1b5313b5a37214d0e8f25922dca778b424b25295fc8a1a7070203010001024100978ac8eadb0dc6035347d6aba8671215ff21283385396f7897c04baf5e2a835f3b53ef80a82ed36ae687a925380b55a0c73eb85656e989dcf0ed7fb4887024e1022100fdad8e1c6853563f8b921d2d112462ae7d6b176082d2ba43e87e1a37fc1a8b33022100f0592cf4c55ba44307b18981bcdbda376c51e590ffa5345ba866f6962dca94dd02201995f1a967d44ff4a4cd1de837bc65bf97a2bf7eda730a9a62cea53254591105022027f96cf4b8ee68ff8d04062ec1ce7f18c0b74e4b3379b29f9bfea3fc8e592731022100cefa6d220496b43feb83194255d8fb930afcf46f36606e3aa0eb7a93ad88c10c":PSA_KEY_TYPE_ECC_KEYPAIR(PSA_ECC_CURVE_BRAINPOOL_P512R1):PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
PSA import failure preserves policy
|
||||
depends_on:MBEDTLS_PK_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15
|
||||
import_twice:PSA_ALG_RSA_PKCS1V15_SIGN_RAW:PSA_KEY_USAGE_VERIFY:PSA_KEY_TYPE_RSA_PUBLIC_KEY:"":PSA_ERROR_INVALID_ARGUMENT:PSA_KEY_TYPE_RSA_PUBLIC_KEY:"30819f300d06092a864886f70d010101050003818d0030818902818100af057d396ee84fb75fdbb5c2b13c7fe5a654aa8aa2470b541ee1feb0b12d25c79711531249e1129628042dbbb6c120d1443524ef4c0e6e1d8956eeb2077af12349ddeee54483bc06c2c61948cd02b202e796aebd94d3a7cbf859c2c1819c324cb82b9cd34ede263a2abffe4733f077869e8660f7d6834da53d690ef7985f6bc30203010001":PSA_SUCCESS
|
||||
|
||||
PSA import RSA key pair: maximum size exceeded
|
||||
depends_on:MBEDTLS_PK_PARSE_C:MBEDTLS_RSA_C
|
||||
import_rsa_made_up:PSA_VENDOR_RSA_MAX_KEY_BITS+8:1:PSA_ERROR_NOT_SUPPORTED
|
||||
|
|
|
@ -948,6 +948,45 @@ exit:
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void import_twice( int alg_arg, int usage_arg,
|
||||
int type1_arg, data_t *data1,
|
||||
int expected_import1_status_arg,
|
||||
int type2_arg, data_t *data2,
|
||||
int expected_import2_status_arg )
|
||||
{
|
||||
int slot = 1;
|
||||
psa_algorithm_t alg = alg_arg;
|
||||
psa_key_usage_t usage = usage_arg;
|
||||
psa_key_type_t type1 = type1_arg;
|
||||
psa_status_t expected_import1_status = expected_import1_status_arg;
|
||||
psa_key_type_t type2 = type2_arg;
|
||||
psa_status_t expected_import2_status = expected_import2_status_arg;
|
||||
psa_key_policy_t policy;
|
||||
psa_status_t status;
|
||||
|
||||
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
|
||||
|
||||
psa_key_policy_init( &policy );
|
||||
psa_key_policy_set_usage( &policy, usage, alg );
|
||||
TEST_ASSERT( psa_set_key_policy( slot, &policy ) == PSA_SUCCESS );
|
||||
|
||||
status = psa_import_key( slot, type1, data1->x, data1->len );
|
||||
TEST_ASSERT( status == expected_import1_status );
|
||||
status = psa_import_key( slot, type2, data2->x, data2->len );
|
||||
TEST_ASSERT( status == expected_import2_status );
|
||||
|
||||
if( expected_import1_status == PSA_SUCCESS ||
|
||||
expected_import2_status == PSA_SUCCESS )
|
||||
{
|
||||
TEST_ASSERT( exercise_key( slot, usage, alg ) );
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_psa_crypto_free( );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void import_rsa_made_up( int bits_arg, int keypair, int expected_status_arg )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue