mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-26 03:35:35 +00:00
Add unit tests
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
parent
1d172a3483
commit
1f45b67474
@ -340,3 +340,8 @@ pk_psa_sign:MBEDTLS_ECP_DP_BP384R1:PSA_ECC_FAMILY_BRAINPOOL_P_R1:384
|
||||
PSA wrapped sign: BP512R1
|
||||
depends_on:MBEDTLS_ECP_DP_BP512R1_ENABLED
|
||||
pk_psa_sign:MBEDTLS_ECP_DP_BP512R1:PSA_ECC_FAMILY_BRAINPOOL_P_R1:512
|
||||
|
||||
PK test valid mebdtls_pk_sign_ext
|
||||
depends_on:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA512_C
|
||||
pk_psa_sign_ext:MBEDTLS_PK_RSA:2048:MBEDTLS_PK_RSASSA_PSS:MBEDTLS_MD_SHA512
|
||||
|
||||
|
@ -1087,3 +1087,33 @@ exit:
|
||||
USE_PSA_DONE( );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_USE_PSA_CRYPTO */
|
||||
void pk_psa_sign_ext( int pk_type, int parameter, int key_pk_type, int md_alg )
|
||||
{
|
||||
mbedtls_pk_context pk;
|
||||
size_t sig_len;
|
||||
unsigned char sig[MBEDTLS_PK_SIGNATURE_MAX_SIZE];
|
||||
unsigned char hash[MBEDTLS_MD_MAX_SIZE];
|
||||
size_t hash_len = sizeof( hash );
|
||||
|
||||
memset( hash, 0x2a, sizeof hash );
|
||||
memset( sig, 0, sizeof sig );
|
||||
|
||||
mbedtls_pk_init( &pk );
|
||||
USE_PSA_INIT();
|
||||
|
||||
TEST_ASSERT( mbedtls_pk_setup( &pk, mbedtls_pk_info_from_type( pk_type ) ) == 0 );
|
||||
|
||||
TEST_ASSERT( pk_genkey( &pk, parameter ) == 0 );
|
||||
|
||||
TEST_ASSERT( mbedtls_pk_sign_ext( key_pk_type, &pk, md_alg, hash, hash_len,
|
||||
sig, sizeof sig , &sig_len,
|
||||
mbedtls_test_rnd_std_rand, NULL ) == 0 );
|
||||
|
||||
exit:
|
||||
mbedtls_pk_free( &pk );
|
||||
USE_PSA_DONE( );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user