Add pk_sign_ext unit tests
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
parent
dddf5a0e18
commit
e2c882518c
@ -341,11 +341,39 @@ PSA wrapped sign: BP512R1
|
|||||||
depends_on:MBEDTLS_ECP_DP_BP512R1_ENABLED
|
depends_on:MBEDTLS_ECP_DP_BP512R1_ENABLED
|
||||||
pk_psa_sign:MBEDTLS_ECP_DP_BP512R1:PSA_ECC_FAMILY_BRAINPOOL_P_R1:512
|
pk_psa_sign:MBEDTLS_ECP_DP_BP512R1:PSA_ECC_FAMILY_BRAINPOOL_P_R1:512
|
||||||
|
|
||||||
PK Sign ext:RSA2048,PK_RSASSA_PSS,MD_SHA512
|
PK Sign ext:RSA2048,PK_RSA,MD_SHA256
|
||||||
depends_on:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA512_C
|
depends_on:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C
|
||||||
pk_psa_sign_ext:MBEDTLS_PK_RSA:2048:MBEDTLS_PK_RSASSA_PSS:MBEDTLS_MD_SHA512
|
pk_psa_sign_ext:MBEDTLS_PK_RSA:2048:MBEDTLS_PK_RSA:MBEDTLS_MD_SHA256
|
||||||
|
|
||||||
PK Sign ext:RSA2048,PK_RSA,MD_SHA512
|
PK Sign ext:RSA2048,PK_RSASSA_PSS,MD_SHA256
|
||||||
depends_on:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA512_C:MBEDTLS_PKCS1_V15
|
depends_on:MBEDTLS_PKCS1_V21:MBEDTLS_SHA256_C
|
||||||
pk_psa_sign_ext:MBEDTLS_PK_RSA:2048:MBEDTLS_PK_RSA:MBEDTLS_MD_SHA512
|
pk_psa_sign_ext:MBEDTLS_PK_RSA:2048:MBEDTLS_PK_RSASSA_PSS:MBEDTLS_MD_SHA256
|
||||||
|
|
||||||
|
PK Sign ext:RSA3072,PK_RSA,MD_SHA384
|
||||||
|
depends_on:MBEDTLS_PKCS1_V15:MBEDTLS_SHA384_C
|
||||||
|
pk_psa_sign_ext:MBEDTLS_PK_RSA:3072:MBEDTLS_PK_RSA:MBEDTLS_MD_SHA384
|
||||||
|
|
||||||
|
PK Sign ext:RSA3072,PK_RSASSA_PSS,MD_SHA384
|
||||||
|
depends_on:MBEDTLS_PKCS1_V21:MBEDTLS_SHA384_C
|
||||||
|
pk_psa_sign_ext:MBEDTLS_PK_RSA:3072:MBEDTLS_PK_RSASSA_PSS:MBEDTLS_MD_SHA384
|
||||||
|
|
||||||
|
PK Sign ext:RSA4096,PK_RSA,MD_SHA512
|
||||||
|
depends_on:MBEDTLS_PKCS1_V15:MBEDTLS_SHA512_C
|
||||||
|
pk_psa_sign_ext:MBEDTLS_PK_RSA:4096:MBEDTLS_PK_RSA:MBEDTLS_MD_SHA512
|
||||||
|
|
||||||
|
PK Sign ext:RSA4096,PK_RSASSA_PSS,MD_SHA512
|
||||||
|
depends_on:MBEDTLS_PKCS1_V21:MBEDTLS_SHA512_C
|
||||||
|
pk_psa_sign_ext:MBEDTLS_PK_RSA:4096:MBEDTLS_PK_RSASSA_PSS:MBEDTLS_MD_SHA512
|
||||||
|
|
||||||
|
PK Sign ext:SECP256R1,PK_ECDSA,MD_SHA256
|
||||||
|
depends_on:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C
|
||||||
|
pk_psa_sign_ext:MBEDTLS_PK_ECDSA:MBEDTLS_ECP_DP_SECP256R1:MBEDTLS_PK_ECDSA:MBEDTLS_MD_SHA256
|
||||||
|
|
||||||
|
PK Sign ext:SECP384R1,PK_ECDSA,MD_SHA384
|
||||||
|
depends_on:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA384_C
|
||||||
|
pk_psa_sign_ext:MBEDTLS_PK_ECDSA:MBEDTLS_ECP_DP_SECP384R1:MBEDTLS_PK_ECDSA:MBEDTLS_MD_SHA384
|
||||||
|
|
||||||
|
PK Sign ext:SECP521R1,PK_ECDSA,MD_SHA512
|
||||||
|
depends_on:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP521R1_ENABLED:MBEDTLS_SHA512_C
|
||||||
|
pk_psa_sign_ext:MBEDTLS_PK_ECDSA:MBEDTLS_ECP_DP_SECP521R1:MBEDTLS_PK_ECDSA:MBEDTLS_MD_SHA512
|
||||||
|
|
||||||
|
@ -1095,7 +1095,8 @@ void pk_psa_sign_ext( int pk_type, int parameter, int key_pk_type, int md_alg )
|
|||||||
size_t sig_len;
|
size_t sig_len;
|
||||||
unsigned char sig[MBEDTLS_PK_SIGNATURE_MAX_SIZE];
|
unsigned char sig[MBEDTLS_PK_SIGNATURE_MAX_SIZE];
|
||||||
unsigned char hash[MBEDTLS_MD_MAX_SIZE];
|
unsigned char hash[MBEDTLS_MD_MAX_SIZE];
|
||||||
size_t hash_len = sizeof( hash );
|
const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type( md_alg );
|
||||||
|
size_t hash_len = mbedtls_md_get_size( md_info );
|
||||||
void const *options = NULL;
|
void const *options = NULL;
|
||||||
#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT)
|
#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT)
|
||||||
mbedtls_pk_rsassa_pss_options rsassa_pss_options;
|
mbedtls_pk_rsassa_pss_options rsassa_pss_options;
|
||||||
@ -1125,7 +1126,7 @@ void pk_psa_sign_ext( int pk_type, int parameter, int key_pk_type, int md_alg )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
TEST_ASSERT( mbedtls_pk_verify_ext( key_pk_type, options, &pk, md_alg,
|
TEST_ASSERT( mbedtls_pk_verify_ext( key_pk_type, options, &pk, md_alg,
|
||||||
hash, sizeof( hash ), sig, sig_len ) == 0 );
|
hash, hash_len, sig, sig_len ) == 0 );
|
||||||
exit:
|
exit:
|
||||||
PSA_DONE( );
|
PSA_DONE( );
|
||||||
mbedtls_pk_free( &pk );
|
mbedtls_pk_free( &pk );
|
||||||
|
Loading…
Reference in New Issue
Block a user