Merge remote-tracking branch 'psa/pr/27' into feature-psa
This commit is contained in:
commit
8605428dcf
4 changed files with 615 additions and 62 deletions
|
@ -551,7 +551,7 @@ typedef uint32_t psa_algorithm_t;
|
|||
#define PSA_ALG_RSA_OAEP_MGF1(hash_alg) \
|
||||
(PSA_ALG_RSA_OAEP_MGF1_RAW | ((hash_alg) & PSA_ALG_HASH_MASK))
|
||||
#define PSA_ALG_IS_RSA_OAEP_MGF1(alg) \
|
||||
(((alg) & ~PSA_ALG_HASH_MASK) == PSA_ALG_RSA_OAEP_MGF1_RAW)
|
||||
(((alg) & ~PSA_ALG_HASH_MASK) == PSA_ALG_RSA_OAEP_MGF1_BASE)
|
||||
#define PSA_ALG_RSA_GET_HASH(alg) \
|
||||
(((alg) & PSA_ALG_HASH_MASK) | PSA_ALG_CATEGORY_HASH)
|
||||
|
||||
|
@ -1656,11 +1656,13 @@ psa_status_t psa_asymmetric_verify(psa_key_slot_t key,
|
|||
(PSA_KEY_TYPE_IS_RSA(key_type) ? \
|
||||
((void)alg, PSA_BITS_TO_BYTES(key_bits)) : \
|
||||
0)
|
||||
#define PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE(key_type, key_bits, alg) \
|
||||
#define PSA_RSA_MINIMUM_PADDING_SIZE(alg) \
|
||||
(PSA_ALG_IS_RSA_OAEP_MGF1(alg) ? \
|
||||
2 * PSA_HASH_FINAL_SIZE(PSA_ALG_RSA_GET_HASH(alg)) + 1 : \
|
||||
11 /*PKCS#1v1.5*/)
|
||||
#define PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE(key_type, key_bits, alg) \
|
||||
(PSA_KEY_TYPE_IS_RSA(key_type) ? \
|
||||
PSA_BITS_TO_BYTES(key_bits) - ((alg) == PSA_ALG_IS_RSA_OAEP_MGF1 ? \
|
||||
2 * (PSA_ALG_RSA_GET_HASH(alg) + 1) : \
|
||||
11 /*PKCS#1v1.5*/) : \
|
||||
PSA_BITS_TO_BYTES(key_bits) - PSA_RSA_MINIMUM_PADDING_SIZE(alg) : \
|
||||
0)
|
||||
|
||||
/**
|
||||
|
|
|
@ -1234,18 +1234,44 @@ psa_status_t psa_mac_verify( psa_mac_operation_t *operation,
|
|||
/* Asymmetric cryptography */
|
||||
/****************************************************************/
|
||||
|
||||
psa_status_t psa_asymmetric_sign(psa_key_slot_t key,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *hash,
|
||||
size_t hash_length,
|
||||
const uint8_t *salt,
|
||||
size_t salt_length,
|
||||
uint8_t *signature,
|
||||
size_t signature_size,
|
||||
size_t *signature_length)
|
||||
/* Decode the hash algorithm from alg and store the mbedtls encoding in
|
||||
* md_alg. Verify that the hash length is consistent. */
|
||||
static psa_status_t psa_rsa_decode_md_type( psa_algorithm_t alg,
|
||||
size_t hash_length,
|
||||
mbedtls_md_type_t *md_alg )
|
||||
{
|
||||
psa_algorithm_t hash_alg = PSA_ALG_RSA_GET_HASH( alg );
|
||||
const mbedtls_md_info_t *md_info = mbedtls_md_info_from_psa( hash_alg );
|
||||
*md_alg = hash_alg == 0 ? MBEDTLS_MD_NONE : mbedtls_md_get_type( md_info );
|
||||
if( *md_alg == MBEDTLS_MD_NONE )
|
||||
{
|
||||
#if SIZE_MAX > UINT_MAX
|
||||
if( hash_length > UINT_MAX )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if( mbedtls_md_get_size( md_info ) != hash_length )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
if( md_info == NULL )
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
return( PSA_SUCCESS );
|
||||
}
|
||||
|
||||
psa_status_t psa_asymmetric_sign( psa_key_slot_t key,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *hash,
|
||||
size_t hash_length,
|
||||
const uint8_t *salt,
|
||||
size_t salt_length,
|
||||
uint8_t *signature,
|
||||
size_t signature_size,
|
||||
size_t *signature_length )
|
||||
{
|
||||
key_slot_t *slot;
|
||||
|
||||
psa_status_t status;
|
||||
*signature_length = 0;
|
||||
(void) salt;
|
||||
(void) salt_length;
|
||||
|
@ -1257,7 +1283,7 @@ psa_status_t psa_asymmetric_sign(psa_key_slot_t key,
|
|||
return( PSA_ERROR_EMPTY_SLOT );
|
||||
if( ! PSA_KEY_TYPE_IS_KEYPAIR( slot->type ) )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
if( !( slot->policy.usage & PSA_KEY_USAGE_SIGN ) )
|
||||
if( ! ( slot->policy.usage & PSA_KEY_USAGE_SIGN ) )
|
||||
return( PSA_ERROR_NOT_PERMITTED );
|
||||
|
||||
#if defined(MBEDTLS_RSA_C)
|
||||
|
@ -1265,24 +1291,11 @@ psa_status_t psa_asymmetric_sign(psa_key_slot_t key,
|
|||
{
|
||||
mbedtls_rsa_context *rsa = slot->data.rsa;
|
||||
int ret;
|
||||
psa_algorithm_t hash_alg = PSA_ALG_RSA_GET_HASH( alg );
|
||||
const mbedtls_md_info_t *md_info = mbedtls_md_info_from_psa( hash_alg );
|
||||
mbedtls_md_type_t md_alg =
|
||||
hash_alg == 0 ? MBEDTLS_MD_NONE : mbedtls_md_get_type( md_info );
|
||||
if( md_alg == MBEDTLS_MD_NONE )
|
||||
{
|
||||
#if SIZE_MAX > UINT_MAX
|
||||
if( hash_length > UINT_MAX )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if( mbedtls_md_get_size( md_info ) != hash_length )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
if( md_info == NULL )
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
mbedtls_md_type_t md_alg;
|
||||
status = psa_rsa_decode_md_type( alg, hash_length, &md_alg );
|
||||
if( status != PSA_SUCCESS )
|
||||
return( status );
|
||||
|
||||
if( signature_size < rsa->len )
|
||||
return( PSA_ERROR_BUFFER_TOO_SMALL );
|
||||
#if defined(MBEDTLS_PKCS1_V15)
|
||||
|
@ -1333,8 +1346,9 @@ psa_status_t psa_asymmetric_sign(psa_key_slot_t key,
|
|||
md_info = mbedtls_md_info_from_psa( alg );
|
||||
md_alg = mbedtls_md_get_type( md_info );
|
||||
ret = mbedtls_ecdsa_write_signature( ecdsa, md_alg, hash, hash_length,
|
||||
signature, signature_length, mbedtls_ctr_drbg_random,
|
||||
&global_data.ctr_drbg );
|
||||
signature, signature_length,
|
||||
mbedtls_ctr_drbg_random,
|
||||
&global_data.ctr_drbg );
|
||||
return( mbedtls_to_psa_error( ret ) );
|
||||
}
|
||||
else
|
||||
|
@ -1354,6 +1368,7 @@ psa_status_t psa_asymmetric_verify( psa_key_slot_t key,
|
|||
size_t signature_size )
|
||||
{
|
||||
key_slot_t *slot;
|
||||
psa_status_t status;
|
||||
(void) salt;
|
||||
(void) salt_length;
|
||||
|
||||
|
@ -1362,19 +1377,68 @@ psa_status_t psa_asymmetric_verify( psa_key_slot_t key,
|
|||
slot = &global_data.key_slots[key];
|
||||
if( slot->type == PSA_KEY_TYPE_NONE )
|
||||
return( PSA_ERROR_EMPTY_SLOT );
|
||||
if( ! PSA_KEY_TYPE_IS_KEYPAIR( slot->type ) )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
if( !( slot->policy.usage & PSA_KEY_USAGE_VERIFY ) )
|
||||
if( ! ( slot->policy.usage & PSA_KEY_USAGE_VERIFY ) )
|
||||
return( PSA_ERROR_NOT_PERMITTED );
|
||||
|
||||
#if defined(MBEDTLS_RSA_C)
|
||||
if( ( slot->type == PSA_KEY_TYPE_RSA_KEYPAIR ) ||
|
||||
( slot->type == PSA_KEY_TYPE_RSA_PUBLIC_KEY ) )
|
||||
{
|
||||
mbedtls_rsa_context *rsa = slot->data.rsa;
|
||||
int ret;
|
||||
mbedtls_md_type_t md_alg;
|
||||
status = psa_rsa_decode_md_type( alg, hash_length, &md_alg );
|
||||
if( status != PSA_SUCCESS )
|
||||
return( status );
|
||||
|
||||
if( signature_size < rsa->len )
|
||||
return( PSA_ERROR_BUFFER_TOO_SMALL );
|
||||
#if defined(MBEDTLS_PKCS1_V15)
|
||||
if( PSA_ALG_IS_RSA_PKCS1V15_SIGN( alg ) )
|
||||
{
|
||||
mbedtls_rsa_set_padding( rsa, MBEDTLS_RSA_PKCS_V15,
|
||||
MBEDTLS_MD_NONE );
|
||||
|
||||
ret = mbedtls_rsa_pkcs1_verify( rsa,
|
||||
mbedtls_ctr_drbg_random,
|
||||
&global_data.ctr_drbg,
|
||||
MBEDTLS_RSA_PUBLIC,
|
||||
md_alg,
|
||||
hash_length,
|
||||
hash,
|
||||
signature );
|
||||
|
||||
}
|
||||
else
|
||||
#endif /* MBEDTLS_PKCS1_V15 */
|
||||
#if defined(MBEDTLS_PKCS1_V21)
|
||||
if( alg == PSA_ALG_RSA_PSS_MGF1 )
|
||||
{
|
||||
mbedtls_rsa_set_padding( rsa, MBEDTLS_RSA_PKCS_V21, md_alg );
|
||||
ret = mbedtls_rsa_rsassa_pss_verify( rsa,
|
||||
mbedtls_ctr_drbg_random,
|
||||
&global_data.ctr_drbg,
|
||||
MBEDTLS_RSA_PUBLIC,
|
||||
md_alg, hash_length, hash,
|
||||
signature );
|
||||
}
|
||||
else
|
||||
#endif /* MBEDTLS_PKCS1_V21 */
|
||||
{
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
}
|
||||
return( mbedtls_to_psa_error( ret ) );
|
||||
}
|
||||
else
|
||||
#endif /* defined(MBEDTLS_RSA_C) */
|
||||
#if defined(MBEDTLS_ECP_C)
|
||||
if( PSA_KEY_TYPE_IS_ECC( slot->type ) )
|
||||
{
|
||||
mbedtls_ecp_keypair *ecdsa = slot->data.ecp;
|
||||
int ret;
|
||||
(void) alg;
|
||||
ret = mbedtls_ecdsa_read_signature( ecdsa, hash, hash_length, signature,
|
||||
signature_size );
|
||||
(void)alg;
|
||||
ret = mbedtls_ecdsa_read_signature( ecdsa, hash, hash_length,
|
||||
signature, signature_size );
|
||||
return( mbedtls_to_psa_error( ret ) );
|
||||
}
|
||||
else
|
||||
|
@ -1384,6 +1448,142 @@ psa_status_t psa_asymmetric_verify( psa_key_slot_t key,
|
|||
}
|
||||
}
|
||||
|
||||
psa_status_t psa_asymmetric_encrypt( psa_key_slot_t key,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *input,
|
||||
size_t input_length,
|
||||
const uint8_t *salt,
|
||||
size_t salt_length,
|
||||
uint8_t *output,
|
||||
size_t output_size,
|
||||
size_t *output_length )
|
||||
{
|
||||
key_slot_t *slot;
|
||||
(void) salt;
|
||||
(void) salt_length;
|
||||
*output_length = 0;
|
||||
|
||||
if( key == 0 || key > MBEDTLS_PSA_KEY_SLOT_COUNT )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
slot = &global_data.key_slots[key];
|
||||
if( slot->type == PSA_KEY_TYPE_NONE )
|
||||
return( PSA_ERROR_EMPTY_SLOT );
|
||||
if( ! PSA_KEY_TYPE_IS_KEYPAIR( slot->type ) )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
if( ! ( slot->policy.usage & PSA_KEY_USAGE_ENCRYPT ) )
|
||||
return( PSA_ERROR_NOT_PERMITTED );
|
||||
|
||||
#if defined(MBEDTLS_RSA_C)
|
||||
if( ( slot->type == PSA_KEY_TYPE_RSA_KEYPAIR ) ||
|
||||
( slot->type == PSA_KEY_TYPE_RSA_PUBLIC_KEY ) )
|
||||
{
|
||||
mbedtls_rsa_context *rsa = slot->data.rsa;
|
||||
int ret;
|
||||
if( output_size < rsa->len )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
#if defined(MBEDTLS_PKCS1_V15)
|
||||
if( alg == PSA_ALG_RSA_PKCS1V15_CRYPT )
|
||||
{
|
||||
ret = mbedtls_rsa_pkcs1_encrypt( rsa,
|
||||
mbedtls_ctr_drbg_random,
|
||||
&global_data.ctr_drbg,
|
||||
MBEDTLS_RSA_PUBLIC,
|
||||
input_length,
|
||||
input,
|
||||
output );
|
||||
}
|
||||
else
|
||||
#endif /* MBEDTLS_PKCS1_V15 */
|
||||
#if defined(MBEDTLS_PKCS1_V21)
|
||||
if( PSA_ALG_IS_RSA_OAEP_MGF1( alg ) )
|
||||
{
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
else
|
||||
#endif /* MBEDTLS_PKCS1_V21 */
|
||||
{
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
}
|
||||
if( ret == 0 )
|
||||
*output_length = rsa->len;
|
||||
return( mbedtls_to_psa_error( ret ) );
|
||||
}
|
||||
else
|
||||
#endif /* defined(MBEDTLS_RSA_C) */
|
||||
{
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
psa_status_t psa_asymmetric_decrypt( psa_key_slot_t key,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *input,
|
||||
size_t input_length,
|
||||
const uint8_t *salt,
|
||||
size_t salt_length,
|
||||
uint8_t *output,
|
||||
size_t output_size,
|
||||
size_t *output_length )
|
||||
{
|
||||
key_slot_t *slot;
|
||||
(void) salt;
|
||||
(void) salt_length;
|
||||
*output_length = 0;
|
||||
|
||||
if( key == 0 || key > MBEDTLS_PSA_KEY_SLOT_COUNT )
|
||||
return( PSA_ERROR_EMPTY_SLOT );
|
||||
slot = &global_data.key_slots[key];
|
||||
if( slot->type == PSA_KEY_TYPE_NONE )
|
||||
return( PSA_ERROR_EMPTY_SLOT );
|
||||
if( ! PSA_KEY_TYPE_IS_KEYPAIR( slot->type ) )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
if( ! ( slot->policy.usage & PSA_KEY_USAGE_DECRYPT ) )
|
||||
return( PSA_ERROR_NOT_PERMITTED );
|
||||
|
||||
#if defined(MBEDTLS_RSA_C)
|
||||
if( slot->type == PSA_KEY_TYPE_RSA_KEYPAIR )
|
||||
{
|
||||
mbedtls_rsa_context *rsa = slot->data.rsa;
|
||||
int ret;
|
||||
|
||||
if( input_length != rsa->len )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
|
||||
#if defined(MBEDTLS_PKCS1_V15)
|
||||
if( alg == PSA_ALG_RSA_PKCS1V15_CRYPT )
|
||||
{
|
||||
ret = mbedtls_rsa_pkcs1_decrypt( rsa,
|
||||
mbedtls_ctr_drbg_random,
|
||||
&global_data.ctr_drbg,
|
||||
MBEDTLS_RSA_PRIVATE,
|
||||
output_length,
|
||||
input,
|
||||
output,
|
||||
output_size );
|
||||
}
|
||||
else
|
||||
#endif /* MBEDTLS_PKCS1_V15 */
|
||||
#if defined(MBEDTLS_PKCS1_V21)
|
||||
if( PSA_ALG_IS_RSA_OAEP_MGF1( alg ) )
|
||||
{
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
else
|
||||
#endif /* MBEDTLS_PKCS1_V21 */
|
||||
{
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
}
|
||||
|
||||
return( mbedtls_to_psa_error( ret ) );
|
||||
}
|
||||
else
|
||||
#endif /* defined(MBEDTLS_RSA_C) */
|
||||
{
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************/
|
||||
/* Symmetric cryptography */
|
||||
|
@ -1683,13 +1883,13 @@ psa_status_t psa_set_key_policy(psa_key_slot_t key,
|
|||
|
||||
if( key == 0 || key > MBEDTLS_PSA_KEY_SLOT_COUNT || policy == NULL )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
|
||||
|
||||
slot = &global_data.key_slots[key];
|
||||
if( slot->type != PSA_KEY_TYPE_NONE )
|
||||
return( PSA_ERROR_OCCUPIED_SLOT );
|
||||
|
||||
if( ( policy->usage & ~( PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_ENCRYPT
|
||||
| PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_SIGN
|
||||
if( ( policy->usage & ~( PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_ENCRYPT
|
||||
| PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_SIGN
|
||||
| PSA_KEY_USAGE_VERIFY ) ) != 0 )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
|
||||
|
@ -1707,7 +1907,7 @@ psa_status_t psa_get_key_policy(psa_key_slot_t key,
|
|||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
|
||||
slot = &global_data.key_slots[key];
|
||||
|
||||
|
||||
*policy = slot->policy;
|
||||
|
||||
return( PSA_SUCCESS );
|
||||
|
@ -1728,7 +1928,7 @@ psa_status_t psa_get_key_lifetime(psa_key_slot_t key,
|
|||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
|
||||
slot = &global_data.key_slots[key];
|
||||
|
||||
|
||||
*lifetime = slot->lifetime;
|
||||
|
||||
return( PSA_SUCCESS );
|
||||
|
@ -1742,8 +1942,8 @@ psa_status_t psa_set_key_lifetime(psa_key_slot_t key,
|
|||
if( key == 0 || key > MBEDTLS_PSA_KEY_SLOT_COUNT )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
|
||||
if( lifetime != PSA_KEY_LIFETIME_VOLATILE &&
|
||||
lifetime != PSA_KEY_LIFETIME_PERSISTENT &&
|
||||
if( lifetime != PSA_KEY_LIFETIME_VOLATILE &&
|
||||
lifetime != PSA_KEY_LIFETIME_PERSISTENT &&
|
||||
lifetime != PSA_KEY_LIFETIME_WRITE_ONCE)
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
|
||||
|
@ -1753,7 +1953,7 @@ psa_status_t psa_set_key_lifetime(psa_key_slot_t key,
|
|||
|
||||
if( lifetime != PSA_KEY_LIFETIME_VOLATILE )
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
|
||||
|
||||
slot->lifetime = lifetime;
|
||||
|
||||
return( PSA_SUCCESS );
|
||||
|
|
|
@ -264,6 +264,18 @@ key_policy_fail:PSA_KEY_USAGE_SIGN:PSA_ALG_RSA_PKCS1V15_SIGN_RAW:PSA_ERROR_NOT_P
|
|||
PSA Key Lifetime set and get volatile
|
||||
key_lifetime:PSA_KEY_LIFETIME_VOLATILE
|
||||
|
||||
PSA verify RSA PKCS#1 v1.5 signature
|
||||
depends_on:MBEDTLS_PK_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15
|
||||
asymmetric_verify:PSA_KEY_TYPE_RSA_KEYPAIR:"3082025e02010002818100af057d396ee84fb75fdbb5c2b13c7fe5a654aa8aa2470b541ee1feb0b12d25c79711531249e1129628042dbbb6c120d1443524ef4c0e6e1d8956eeb2077af12349ddeee54483bc06c2c61948cd02b202e796aebd94d3a7cbf859c2c1819c324cb82b9cd34ede263a2abffe4733f077869e8660f7d6834da53d690ef7985f6bc3020301000102818100874bf0ffc2f2a71d14671ddd0171c954d7fdbf50281e4f6d99ea0e1ebcf82faa58e7b595ffb293d1abe17f110b37c48cc0f36c37e84d876621d327f64bbe08457d3ec4098ba2fa0a319fba411c2841ed7be83196a8cdf9daa5d00694bc335fc4c32217fe0488bce9cb7202e59468b1ead119000477db2ca797fac19eda3f58c1024100e2ab760841bb9d30a81d222de1eb7381d82214407f1b975cbbfe4e1a9467fd98adbd78f607836ca5be1928b9d160d97fd45c12d6b52e2c9871a174c66b488113024100c5ab27602159ae7d6f20c3c2ee851e46dc112e689e28d5fcbbf990a99ef8a90b8bb44fd36467e7fc1789ceb663abda338652c3c73f111774902e840565927091024100b6cdbd354f7df579a63b48b3643e353b84898777b48b15f94e0bfc0567a6ae5911d57ad6409cf7647bf96264e9bd87eb95e263b7110b9a1f9f94acced0fafa4d024071195eec37e8d257decfc672b07ae639f10cbb9b0c739d0c809968d644a94e3fd6ed9287077a14583f379058f76a8aecd43c62dc8c0f41766650d725275ac4a1024100bb32d133edc2e048d463388b7be9cb4be29f4b6250be603e70e3647501c97ddde20a4e71be95fd5e71784e25aca4baf25be5738aae59bbfe1c997781447a2b24":PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256):"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad":"a73664d55b39c7ea6c1e5b5011724a11e1d7073d3a68f48c836fad153a1d91b6abdbc8f69da13b206cc96af6363b114458b026af14b24fab8929ed634c6a2acace0bcc62d9bb6a984afbcbfcd3a0608d32a2bae535b9cd1ecdf9dd281db1e0025c3bfb5512963ec3b98ddaa69e38bc3c84b1b61a04e5648640856aacc6fc7311"
|
||||
|
||||
PSA verify RSA PKCS#1 v1.5 SHA-256, wrong hash
|
||||
depends_on:MBEDTLS_PK_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15
|
||||
asymmetric_verify_fail:PSA_KEY_TYPE_RSA_KEYPAIR:"3082025e02010002818100af057d396ee84fb75fdbb5c2b13c7fe5a654aa8aa2470b541ee1feb0b12d25c79711531249e1129628042dbbb6c120d1443524ef4c0e6e1d8956eeb2077af12349ddeee54483bc06c2c61948cd02b202e796aebd94d3a7cbf859c2c1819c324cb82b9cd34ede263a2abffe4733f077869e8660f7d6834da53d690ef7985f6bc3020301000102818100874bf0ffc2f2a71d14671ddd0171c954d7fdbf50281e4f6d99ea0e1ebcf82faa58e7b595ffb293d1abe17f110b37c48cc0f36c37e84d876621d327f64bbe08457d3ec4098ba2fa0a319fba411c2841ed7be83196a8cdf9daa5d00694bc335fc4c32217fe0488bce9cb7202e59468b1ead119000477db2ca797fac19eda3f58c1024100e2ab760841bb9d30a81d222de1eb7381d82214407f1b975cbbfe4e1a9467fd98adbd78f607836ca5be1928b9d160d97fd45c12d6b52e2c9871a174c66b488113024100c5ab27602159ae7d6f20c3c2ee851e46dc112e689e28d5fcbbf990a99ef8a90b8bb44fd36467e7fc1789ceb663abda338652c3c73f111774902e840565927091024100b6cdbd354f7df579a63b48b3643e353b84898777b48b15f94e0bfc0567a6ae5911d57ad6409cf7647bf96264e9bd87eb95e263b7110b9a1f9f94acced0fafa4d024071195eec37e8d257decfc672b07ae639f10cbb9b0c739d0c809968d644a94e3fd6ed9287077a14583f379058f76a8aecd43c62dc8c0f41766650d725275ac4a1024100bb32d133edc2e048d463388b7be9cb4be29f4b6250be603e70e3647501c97ddde20a4e71be95fd5e71784e25aca4baf25be5738aae59bbfe1c997781447a2b24":PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_1):"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad":"a73664d55b39c7ea6c1e5b5011724a11e1d7073d3a68f48c836fad153a1d91b6abdbc8f69da13b206cc96af6363b114458b026af14b24fab8929ed634c6a2acace0bcc62d9bb6a984afbcbfcd3a0608d32a2bae535b9cd1ecdf9dd281db1e0025c3bfb5512963ec3b98ddaa69e38bc3c84b1b61a04e5648640856aacc6fc7311":PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
PSA verify RSA PKCS#1 v1.5 SHA-256, wrong signature
|
||||
depends_on:MBEDTLS_PK_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15
|
||||
asymmetric_verify_fail:PSA_KEY_TYPE_RSA_KEYPAIR:"3082025e02010002818100af057d396ee84fb75fdbb5c2b13c7fe5a654aa8aa2470b541ee1feb0b12d25c79711531249e1129628042dbbb6c120d1443524ef4c0e6e1d8956eeb2077af12349ddeee54483bc06c2c61948cd02b202e796aebd94d3a7cbf859c2c1819c324cb82b9cd34ede263a2abffe4733f077869e8660f7d6834da53d690ef7985f6bc3020301000102818100874bf0ffc2f2a71d14671ddd0171c954d7fdbf50281e4f6d99ea0e1ebcf82faa58e7b595ffb293d1abe17f110b37c48cc0f36c37e84d876621d327f64bbe08457d3ec4098ba2fa0a319fba411c2841ed7be83196a8cdf9daa5d00694bc335fc4c32217fe0488bce9cb7202e59468b1ead119000477db2ca797fac19eda3f58c1024100e2ab760841bb9d30a81d222de1eb7381d82214407f1b975cbbfe4e1a9467fd98adbd78f607836ca5be1928b9d160d97fd45c12d6b52e2c9871a174c66b488113024100c5ab27602159ae7d6f20c3c2ee851e46dc112e689e28d5fcbbf990a99ef8a90b8bb44fd36467e7fc1789ceb663abda338652c3c73f111774902e840565927091024100b6cdbd354f7df579a63b48b3643e353b84898777b48b15f94e0bfc0567a6ae5911d57ad6409cf7647bf96264e9bd87eb95e263b7110b9a1f9f94acced0fafa4d024071195eec37e8d257decfc672b07ae639f10cbb9b0c739d0c809968d644a94e3fd6ed9287077a14583f379058f76a8aecd43c62dc8c0f41766650d725275ac4a1024100bb32d133edc2e048d463388b7be9cb4be29f4b6250be603e70e3647501c97ddde20a4e71be95fd5e71784e25aca4baf25be5738aae59bbfe1c997781447a2b24":PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256):"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad":"111164d55b39c7ea6c1e5b5011724a11e1d7073d3a68f48c836fad153a1d91b6abdbc8f69da13b206cc96af6363b114458b026af14b24fab8929ed634c6a2acace0bcc62d9bb6a984afbcbfcd3a0608d32a2bae535b9cd1ecdf9dd281db1e0025c3bfb5512963ec3b98ddaa69e38bc3c84b1b61a04e5648640856aacc6fc7311":PSA_ERROR_INVALID_SIGNATURE
|
||||
|
||||
PSA Key Lifetime set fail, invalid key slot
|
||||
key_lifetime_set_fail:0:PSA_KEY_LIFETIME_VOLATILE:PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
|
@ -284,3 +296,43 @@ sign_fail:PSA_KEY_TYPE_ECC_KEYPAIR(PSA_KEY_TYPE_ECC_CURVE_NISTP256R1):"307802010
|
|||
PSA verify ECDSA SECP256R1 SHA-256
|
||||
depends_on:MBEDTLS_PK_C:MBEDTLS_PK_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
||||
asymmetric_verify:PSA_KEY_TYPE_ECC_KEYPAIR(PSA_KEY_TYPE_ECC_CURVE_NISTP256R1):"3078020101042100ab45435712649cb30bbddac49197eebf2740ffc7f874d9244c3460f54f322d3aa00a06082a8648ce3d030107a14403420004dea5e45d0ea37fc566232a508f4ad20ea13d47e4bf5fa4d54a57a0ba012042087097496efc583fed8b24a5b9be9a51de063f5a00a8b698a16fd7f29b5485f320":PSA_ALG_SHA_256:"9ac4335b469bbd791439248504dd0d49c71349a295fee5a1c68507f45a9e1c7b":"304502206a3399f69421ffe1490377adf2ea1f117d81a63cf5bf22e918d51175eb259151022100ce95d7c26cc04e25503e2f7a1ec3573e3c2412534bb4a19b3a7811742f49f50f"
|
||||
|
||||
PSA encrypt-decrypt using RSA PKCS#1 v1.5 vector #1
|
||||
depends_on:MBEDTLS_PK_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15
|
||||
asymmetric_encrypt_decrypt:PSA_KEY_TYPE_RSA_KEYPAIR:"3082025e02010002818100af057d396ee84fb75fdbb5c2b13c7fe5a654aa8aa2470b541ee1feb0b12d25c79711531249e1129628042dbbb6c120d1443524ef4c0e6e1d8956eeb2077af12349ddeee54483bc06c2c61948cd02b202e796aebd94d3a7cbf859c2c1819c324cb82b9cd34ede263a2abffe4733f077869e8660f7d6834da53d690ef7985f6bc3020301000102818100874bf0ffc2f2a71d14671ddd0171c954d7fdbf50281e4f6d99ea0e1ebcf82faa58e7b595ffb293d1abe17f110b37c48cc0f36c37e84d876621d327f64bbe08457d3ec4098ba2fa0a319fba411c2841ed7be83196a8cdf9daa5d00694bc335fc4c32217fe0488bce9cb7202e59468b1ead119000477db2ca797fac19eda3f58c1024100e2ab760841bb9d30a81d222de1eb7381d82214407f1b975cbbfe4e1a9467fd98adbd78f607836ca5be1928b9d160d97fd45c12d6b52e2c9871a174c66b488113024100c5ab27602159ae7d6f20c3c2ee851e46dc112e689e28d5fcbbf990a99ef8a90b8bb44fd36467e7fc1789ceb663abda338652c3c73f111774902e840565927091024100b6cdbd354f7df579a63b48b3643e353b84898777b48b15f94e0bfc0567a6ae5911d57ad6409cf7647bf96264e9bd87eb95e263b7110b9a1f9f94acced0fafa4d024071195eec37e8d257decfc672b07ae639f10cbb9b0c739d0c809968d644a94e3fd6ed9287077a14583f379058f76a8aecd43c62dc8c0f41766650d725275ac4a1024100bb32d133edc2e048d463388b7be9cb4be29f4b6250be603e70e3647501c97ddde20a4e71be95fd5e71784e25aca4baf25be5738aae59bbfe1c997781447a2b24":PSA_ALG_RSA_PKCS1V15_CRYPT:"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"
|
||||
|
||||
PSA encrypt-decrypt using RSA PKCS#1 v1.5 vector #2
|
||||
depends_on:MBEDTLS_PK_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15
|
||||
asymmetric_encrypt_decrypt:PSA_KEY_TYPE_RSA_KEYPAIR:"3082025e02010002818100af057d396ee84fb75fdbb5c2b13c7fe5a654aa8aa2470b541ee1feb0b12d25c79711531249e1129628042dbbb6c120d1443524ef4c0e6e1d8956eeb2077af12349ddeee54483bc06c2c61948cd02b202e796aebd94d3a7cbf859c2c1819c324cb82b9cd34ede263a2abffe4733f077869e8660f7d6834da53d690ef7985f6bc3020301000102818100874bf0ffc2f2a71d14671ddd0171c954d7fdbf50281e4f6d99ea0e1ebcf82faa58e7b595ffb293d1abe17f110b37c48cc0f36c37e84d876621d327f64bbe08457d3ec4098ba2fa0a319fba411c2841ed7be83196a8cdf9daa5d00694bc335fc4c32217fe0488bce9cb7202e59468b1ead119000477db2ca797fac19eda3f58c1024100e2ab760841bb9d30a81d222de1eb7381d82214407f1b975cbbfe4e1a9467fd98adbd78f607836ca5be1928b9d160d97fd45c12d6b52e2c9871a174c66b488113024100c5ab27602159ae7d6f20c3c2ee851e46dc112e689e28d5fcbbf990a99ef8a90b8bb44fd36467e7fc1789ceb663abda338652c3c73f111774902e840565927091024100b6cdbd354f7df579a63b48b3643e353b84898777b48b15f94e0bfc0567a6ae5911d57ad6409cf7647bf96264e9bd87eb95e263b7110b9a1f9f94acced0fafa4d024071195eec37e8d257decfc672b07ae639f10cbb9b0c739d0c809968d644a94e3fd6ed9287077a14583f379058f76a8aecd43c62dc8c0f41766650d725275ac4a1024100bb32d133edc2e048d463388b7be9cb4be29f4b6250be603e70e3647501c97ddde20a4e71be95fd5e71784e25aca4baf25be5738aae59bbfe1c997781447a2b24":PSA_ALG_RSA_PKCS1V15_CRYPT:"99e8a6144bcb9a29660303bdc4305bb5eca8c64b96788cad062be9967bdab2f7ffff"
|
||||
|
||||
PSA encrypt using RSA PKCS#1 v1.5 fail - invalid algorithm
|
||||
depends_on:MBEDTLS_PK_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15
|
||||
asymmetric_encrypt_fail:PSA_KEY_TYPE_RSA_KEYPAIR:"3082025e02010002818100af057d396ee84fb75fdbb5c2b13c7fe5a654aa8aa2470b541ee1feb0b12d25c79711531249e1129628042dbbb6c120d1443524ef4c0e6e1d8956eeb2077af12349ddeee54483bc06c2c61948cd02b202e796aebd94d3a7cbf859c2c1819c324cb82b9cd34ede263a2abffe4733f077869e8660f7d6834da53d690ef7985f6bc3020301000102818100874bf0ffc2f2a71d14671ddd0171c954d7fdbf50281e4f6d99ea0e1ebcf82faa58e7b595ffb293d1abe17f110b37c48cc0f36c37e84d876621d327f64bbe08457d3ec4098ba2fa0a319fba411c2841ed7be83196a8cdf9daa5d00694bc335fc4c32217fe0488bce9cb7202e59468b1ead119000477db2ca797fac19eda3f58c1024100e2ab760841bb9d30a81d222de1eb7381d82214407f1b975cbbfe4e1a9467fd98adbd78f607836ca5be1928b9d160d97fd45c12d6b52e2c9871a174c66b488113024100c5ab27602159ae7d6f20c3c2ee851e46dc112e689e28d5fcbbf990a99ef8a90b8bb44fd36467e7fc1789ceb663abda338652c3c73f111774902e840565927091024100b6cdbd354f7df579a63b48b3643e353b84898777b48b15f94e0bfc0567a6ae5911d57ad6409cf7647bf96264e9bd87eb95e263b7110b9a1f9f94acced0fafa4d024071195eec37e8d257decfc672b07ae639f10cbb9b0c739d0c809968d644a94e3fd6ed9287077a14583f379058f76a8aecd43c62dc8c0f41766650d725275ac4a1024100bb32d133edc2e048d463388b7be9cb4be29f4b6250be603e70e3647501c97ddde20a4e71be95fd5e71784e25aca4baf25be5738aae59bbfe1c997781447a2b24":PSA_ALG_SHA_256:"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad":PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
PSA encrypt using RSA PKCS#1 v1.5 fail - mangled key and incorrect key type
|
||||
depends_on:MBEDTLS_PK_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15
|
||||
asymmetric_encrypt_fail:PSA_KEY_TYPE_AES:"3082025e02010002818100af057d396ee84fb75fdbb5c2b13c7fe5a654aa8aa2470b541ee1feb0b12d25c79711531249e1129628042dbbb6c120d1443524ef4c0e6e1d8956eeb2077af12349ddeee54483bc06c2c61948cd02b202e796aebd94d3a7cbf859c2c1819c324cb82b9cd34ede263a2abffe4733f077869e8660f7d6834da53d690ef7985f6bc3020301000102818100874bf0ffc2f2a71d14671ddd0171c954d7fdbf50281e4f6d99ea0e1ebcf82faa58e7b595ffb293d1abe17f110b37c48cc0f36c37e84d876621d327f64bbe08457d3ec4098ba2fa0a319fba411c2841ed7be83196a8cdf9daa5d00694bc335fc4c32217fe0488bce9cb7202e59468b1ead119000477db2ca797fac19eda3f58c1024100e2ab760841bb9d30a81d222de1eb7381d82214407f1b975cbbfe4e1a9467fd98adbd78f607836ca5be1928b9d160d97fd45c12d6b52e2c9871a174c66b488113024100c5ab27602159ae7d6f20c3c2ee851e46dc112e689e28d5fcbbf990a99ef8a90b8bb44fd36467e7fc1789ceb663abda338652c3c73f111774902e840565927091024100b6cdbd354f7df579a63b48b3643e353b84898777b48b15f94e0bfc0567a6ae5911d57ad6409cf7647bf96264e9bd87eb95e263b7110b9a1f9f94acced0fafa4d024071195eec37e8d257decfc672b07ae639f10cbb9b0c739d0c809968d644a94e3fd6ed9287077a14583f379058f76a8aecd43c62dc8c0f41766650d725275ac4a1024100bb32d133edc2e048d463388b7be9cb4be29f4b6250be603e70e3647501c97ddde20a4e71be95fd5e71784e25aca4baf25be5738aae59bbfe1c997781447a2b24":PSA_ALG_RSA_PKCS1V15_CRYPT:"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad":PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
PSA decrypt using RSA PKCS#1 v1.5 vector #1
|
||||
depends_on:MBEDTLS_PK_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15
|
||||
asymmetric_decrypt:PSA_KEY_TYPE_RSA_KEYPAIR:"3082025e02010002818100af057d396ee84fb75fdbb5c2b13c7fe5a654aa8aa2470b541ee1feb0b12d25c79711531249e1129628042dbbb6c120d1443524ef4c0e6e1d8956eeb2077af12349ddeee54483bc06c2c61948cd02b202e796aebd94d3a7cbf859c2c1819c324cb82b9cd34ede263a2abffe4733f077869e8660f7d6834da53d690ef7985f6bc3020301000102818100874bf0ffc2f2a71d14671ddd0171c954d7fdbf50281e4f6d99ea0e1ebcf82faa58e7b595ffb293d1abe17f110b37c48cc0f36c37e84d876621d327f64bbe08457d3ec4098ba2fa0a319fba411c2841ed7be83196a8cdf9daa5d00694bc335fc4c32217fe0488bce9cb7202e59468b1ead119000477db2ca797fac19eda3f58c1024100e2ab760841bb9d30a81d222de1eb7381d82214407f1b975cbbfe4e1a9467fd98adbd78f607836ca5be1928b9d160d97fd45c12d6b52e2c9871a174c66b488113024100c5ab27602159ae7d6f20c3c2ee851e46dc112e689e28d5fcbbf990a99ef8a90b8bb44fd36467e7fc1789ceb663abda338652c3c73f111774902e840565927091024100b6cdbd354f7df579a63b48b3643e353b84898777b48b15f94e0bfc0567a6ae5911d57ad6409cf7647bf96264e9bd87eb95e263b7110b9a1f9f94acced0fafa4d024071195eec37e8d257decfc672b07ae639f10cbb9b0c739d0c809968d644a94e3fd6ed9287077a14583f379058f76a8aecd43c62dc8c0f41766650d725275ac4a1024100bb32d133edc2e048d463388b7be9cb4be29f4b6250be603e70e3647501c97ddde20a4e71be95fd5e71784e25aca4baf25be5738aae59bbfe1c997781447a2b24":PSA_ALG_RSA_PKCS1V15_CRYPT:"99ffde2fcc00c9cc01972ebfa7779b298dbbaf7f50707a7405296dd2783456fc792002f462e760500e02afa25a859ace8701cb5d3b0262116431c43af8eb08f5a88301057cf1c156a2a5193c143e7a5b03fac132b7e89e6dcd8f4c82c9b28452329c260d30bc39b3816b7c46b41b37b4850d2ae74e729f99c6621fbbe2e46872":"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad":32
|
||||
|
||||
PSA decrypt using RSA PKCS#1 v1.5 vector #2
|
||||
depends_on:MBEDTLS_PK_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15
|
||||
asymmetric_decrypt:PSA_KEY_TYPE_RSA_KEYPAIR:"3082025e02010002818100af057d396ee84fb75fdbb5c2b13c7fe5a654aa8aa2470b541ee1feb0b12d25c79711531249e1129628042dbbb6c120d1443524ef4c0e6e1d8956eeb2077af12349ddeee54483bc06c2c61948cd02b202e796aebd94d3a7cbf859c2c1819c324cb82b9cd34ede263a2abffe4733f077869e8660f7d6834da53d690ef7985f6bc3020301000102818100874bf0ffc2f2a71d14671ddd0171c954d7fdbf50281e4f6d99ea0e1ebcf82faa58e7b595ffb293d1abe17f110b37c48cc0f36c37e84d876621d327f64bbe08457d3ec4098ba2fa0a319fba411c2841ed7be83196a8cdf9daa5d00694bc335fc4c32217fe0488bce9cb7202e59468b1ead119000477db2ca797fac19eda3f58c1024100e2ab760841bb9d30a81d222de1eb7381d82214407f1b975cbbfe4e1a9467fd98adbd78f607836ca5be1928b9d160d97fd45c12d6b52e2c9871a174c66b488113024100c5ab27602159ae7d6f20c3c2ee851e46dc112e689e28d5fcbbf990a99ef8a90b8bb44fd36467e7fc1789ceb663abda338652c3c73f111774902e840565927091024100b6cdbd354f7df579a63b48b3643e353b84898777b48b15f94e0bfc0567a6ae5911d57ad6409cf7647bf96264e9bd87eb95e263b7110b9a1f9f94acced0fafa4d024071195eec37e8d257decfc672b07ae639f10cbb9b0c739d0c809968d644a94e3fd6ed9287077a14583f379058f76a8aecd43c62dc8c0f41766650d725275ac4a1024100bb32d133edc2e048d463388b7be9cb4be29f4b6250be603e70e3647501c97ddde20a4e71be95fd5e71784e25aca4baf25be5738aae59bbfe1c997781447a2b24":PSA_ALG_RSA_PKCS1V15_CRYPT:"adeecba2db7f867a733853f0136c554e5e01c7a2015721a9bfe30c3ad163b93a9c7589170311209f91420ad8a1a8280c7e890a6d7bca3c500b4da4f53a17bd84a21d58f979a9b4b8f2246b482d930804f12b3aeb2ac8b5ac7938d452ca13be8eb8e973c4e2b19fd454058cbae037bcef7ef68a5fbabf050de5f283cf1998c695":"99e8a6144bcb9a29660303bdc4305bb5eca8c64b96788cad062be9967bdab2f7ffff":34
|
||||
|
||||
PSA decrypt using RSA PKCS#1 v1.5 fail - invalid algorithm
|
||||
depends_on:MBEDTLS_PK_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15
|
||||
asymmetric_decrypt_fail:PSA_KEY_TYPE_RSA_KEYPAIR:"3082025e02010002818100af057d396ee84fb75fdbb5c2b13c7fe5a654aa8aa2470b541ee1feb0b12d25c79711531249e1129628042dbbb6c120d1443524ef4c0e6e1d8956eeb2077af12349ddeee54483bc06c2c61948cd02b202e796aebd94d3a7cbf859c2c1819c324cb82b9cd34ede263a2abffe4733f077869e8660f7d6834da53d690ef7985f6bc3020301000102818100874bf0ffc2f2a71d14671ddd0171c954d7fdbf50281e4f6d99ea0e1ebcf82faa58e7b595ffb293d1abe17f110b37c48cc0f36c37e84d876621d327f64bbe08457d3ec4098ba2fa0a319fba411c2841ed7be83196a8cdf9daa5d00694bc335fc4c32217fe0488bce9cb7202e59468b1ead119000477db2ca797fac19eda3f58c1024100e2ab760841bb9d30a81d222de1eb7381d82214407f1b975cbbfe4e1a9467fd98adbd78f607836ca5be1928b9d160d97fd45c12d6b52e2c9871a174c66b488113024100c5ab27602159ae7d6f20c3c2ee851e46dc112e689e28d5fcbbf990a99ef8a90b8bb44fd36467e7fc1789ceb663abda338652c3c73f111774902e840565927091024100b6cdbd354f7df579a63b48b3643e353b84898777b48b15f94e0bfc0567a6ae5911d57ad6409cf7647bf96264e9bd87eb95e263b7110b9a1f9f94acced0fafa4d024071195eec37e8d257decfc672b07ae639f10cbb9b0c739d0c809968d644a94e3fd6ed9287077a14583f379058f76a8aecd43c62dc8c0f41766650d725275ac4a1024100bb32d133edc2e048d463388b7be9cb4be29f4b6250be603e70e3647501c97ddde20a4e71be95fd5e71784e25aca4baf25be5738aae59bbfe1c997781447a2b24":PSA_ALG_SHA_256:"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad":PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
PSA decrypt using RSA PKCS#1 v1.5 fail - mangled key and incorrect key type
|
||||
depends_on:MBEDTLS_PK_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15
|
||||
asymmetric_decrypt_fail:PSA_KEY_TYPE_AES:"3082025e02010002818100af057d396ee84fb75fdbb5c2b13c7fe5a654aa8aa2470b541ee1feb0b12d25c79711531249e1129628042dbbb6c120d1443524ef4c0e6e1d8956eeb2077af12349ddeee54483bc06c2c61948cd02b202e796aebd94d3a7cbf859c2c1819c324cb82b9cd34ede263a2abffe4733f077869e8660f7d6834da53d690ef7985f6bc3020301000102818100874bf0ffc2f2a71d14671ddd0171c954d7fdbf50281e4f6d99ea0e1ebcf82faa58e7b595ffb293d1abe17f110b37c48cc0f36c37e84d876621d327f64bbe08457d3ec4098ba2fa0a319fba411c2841ed7be83196a8cdf9daa5d00694bc335fc4c32217fe0488bce9cb7202e59468b1ead119000477db2ca797fac19eda3f58c1024100e2ab760841bb9d30a81d222de1eb7381d82214407f1b975cbbfe4e1a9467fd98adbd78f607836ca5be1928b9d160d97fd45c12d6b52e2c9871a174c66b488113024100c5ab27602159ae7d6f20c3c2ee851e46dc112e689e28d5fcbbf990a99ef8a90b8bb44fd36467e7fc1789ceb663abda338652c3c73f111774902e840565927091024100b6cdbd354f7df579a63b48b3643e353b84898777b48b15f94e0bfc0567a6ae5911d57ad6409cf7647bf96264e9bd87eb95e263b7110b9a1f9f94acced0fafa4d024071195eec37e8d257decfc672b07ae639f10cbb9b0c739d0c809968d644a94e3fd6ed9287077a14583f379058f76a8aecd43c62dc8c0f41766650d725275ac4a1024100bb32d133edc2e048d463388b7be9cb4be29f4b6250be603e70e3647501c97ddde20a4e71be95fd5e71784e25aca4baf25be5738aae59bbfe1c997781447a2b24":PSA_ALG_RSA_PKCS1V15_CRYPT:"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad":PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
PSA decrypt using RSA PKCS#1 v1.5 fail - input buffer too small
|
||||
depends_on:MBEDTLS_PK_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15
|
||||
asymmetric_decrypt_fail:PSA_KEY_TYPE_RSA_KEYPAIR:"3082025e02010002818100af057d396ee84fb75fdbb5c2b13c7fe5a654aa8aa2470b541ee1feb0b12d25c79711531249e1129628042dbbb6c120d1443524ef4c0e6e1d8956eeb2077af12349ddeee54483bc06c2c61948cd02b202e796aebd94d3a7cbf859c2c1819c324cb82b9cd34ede263a2abffe4733f077869e8660f7d6834da53d690ef7985f6bc3020301000102818100874bf0ffc2f2a71d14671ddd0171c954d7fdbf50281e4f6d99ea0e1ebcf82faa58e7b595ffb293d1abe17f110b37c48cc0f36c37e84d876621d327f64bbe08457d3ec4098ba2fa0a319fba411c2841ed7be83196a8cdf9daa5d00694bc335fc4c32217fe0488bce9cb7202e59468b1ead119000477db2ca797fac19eda3f58c1024100e2ab760841bb9d30a81d222de1eb7381d82214407f1b975cbbfe4e1a9467fd98adbd78f607836ca5be1928b9d160d97fd45c12d6b52e2c9871a174c66b488113024100c5ab27602159ae7d6f20c3c2ee851e46dc112e689e28d5fcbbf990a99ef8a90b8bb44fd36467e7fc1789ceb663abda338652c3c73f111774902e840565927091024100b6cdbd354f7df579a63b48b3643e353b84898777b48b15f94e0bfc0567a6ae5911d57ad6409cf7647bf96264e9bd87eb95e263b7110b9a1f9f94acced0fafa4d024071195eec37e8d257decfc672b07ae639f10cbb9b0c739d0c809968d644a94e3fd6ed9287077a14583f379058f76a8aecd43c62dc8c0f41766650d725275ac4a1024100bb32d133edc2e048d463388b7be9cb4be29f4b6250be603e70e3647501c97ddde20a4e71be95fd5e71784e25aca4baf25be5738aae59bbfe1c997781447a2b24":PSA_ALG_RSA_PKCS1V15_CRYPT:"ffde2fcc00c9cc01972ebfa7779b298dbbaf7f50707a7405296dd2783456fc792002f462e760500e02afa25a859ace8701cb5d3b0262116431c43af8eb08f5a88301057cf1c156a2a5193c143e7a5b03fac132b7e89e6dcd8f4c82c9b28452329c260d30bc39b3816b7c46b41b37b4850d2ae74e729f99c6621fbbe2e46872":PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
PSA decrypt using RSA PKCS#1 v1.5 fail - input buffer too large
|
||||
depends_on:MBEDTLS_PK_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15
|
||||
asymmetric_decrypt_fail:PSA_KEY_TYPE_RSA_KEYPAIR:"3082025e02010002818100af057d396ee84fb75fdbb5c2b13c7fe5a654aa8aa2470b541ee1feb0b12d25c79711531249e1129628042dbbb6c120d1443524ef4c0e6e1d8956eeb2077af12349ddeee54483bc06c2c61948cd02b202e796aebd94d3a7cbf859c2c1819c324cb82b9cd34ede263a2abffe4733f077869e8660f7d6834da53d690ef7985f6bc3020301000102818100874bf0ffc2f2a71d14671ddd0171c954d7fdbf50281e4f6d99ea0e1ebcf82faa58e7b595ffb293d1abe17f110b37c48cc0f36c37e84d876621d327f64bbe08457d3ec4098ba2fa0a319fba411c2841ed7be83196a8cdf9daa5d00694bc335fc4c32217fe0488bce9cb7202e59468b1ead119000477db2ca797fac19eda3f58c1024100e2ab760841bb9d30a81d222de1eb7381d82214407f1b975cbbfe4e1a9467fd98adbd78f607836ca5be1928b9d160d97fd45c12d6b52e2c9871a174c66b488113024100c5ab27602159ae7d6f20c3c2ee851e46dc112e689e28d5fcbbf990a99ef8a90b8bb44fd36467e7fc1789ceb663abda338652c3c73f111774902e840565927091024100b6cdbd354f7df579a63b48b3643e353b84898777b48b15f94e0bfc0567a6ae5911d57ad6409cf7647bf96264e9bd87eb95e263b7110b9a1f9f94acced0fafa4d024071195eec37e8d257decfc672b07ae639f10cbb9b0c739d0c809968d644a94e3fd6ed9287077a14583f379058f76a8aecd43c62dc8c0f41766650d725275ac4a1024100bb32d133edc2e048d463388b7be9cb4be29f4b6250be603e70e3647501c97ddde20a4e71be95fd5e71784e25aca4baf25be5738aae59bbfe1c997781447a2b24":PSA_ALG_RSA_PKCS1V15_CRYPT:"0099ffde2fcc00c9cc01972ebfa7779b298dbbaf7f50707a7405296dd2783456fc792002f462e760500e02afa25a859ace8701cb5d3b0262116431c43af8eb08f5a88301057cf1c156a2a5193c143e7a5b03fac132b7e89e6dcd8f4c82c9b28452329c260d30bc39b3816b7c46b41b37b4850d2ae74e729f99c6621fbbe2e46872":PSA_ERROR_INVALID_ARGUMENT
|
||||
|
|
323
tests/suites/test_suite_psa_crypto.function
Executable file → Normal file
323
tests/suites/test_suite_psa_crypto.function
Executable file → Normal file
|
@ -1201,9 +1201,9 @@ void key_policy( int usage_arg, int alg_arg )
|
|||
unsigned char key[32] = {0};
|
||||
psa_key_policy_t policy_set = {0};
|
||||
psa_key_policy_t policy_get = {0};
|
||||
|
||||
|
||||
memset( key, 0x2a, sizeof( key ) );
|
||||
|
||||
|
||||
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
|
||||
|
||||
psa_key_policy_init(& policy_set );
|
||||
|
@ -1240,7 +1240,7 @@ void key_policy_fail( int usage_arg, int alg_arg, int expected_status, char *key
|
|||
size_t signature_length = 0;
|
||||
psa_key_policy_t policy = {0};
|
||||
int actual_status = PSA_SUCCESS;
|
||||
|
||||
|
||||
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
|
||||
|
||||
psa_key_policy_init( &policy );
|
||||
|
@ -1255,11 +1255,11 @@ void key_policy_fail( int usage_arg, int alg_arg, int expected_status, char *key
|
|||
TEST_ASSERT( keypair != NULL );
|
||||
TEST_ASSERT( psa_import_key( key_slot, PSA_KEY_TYPE_RSA_KEYPAIR,
|
||||
keypair, key_size ) == PSA_SUCCESS );
|
||||
actual_status = psa_asymmetric_sign( key_slot,
|
||||
( psa_algorithm_t )alg_arg, NULL, 0, NULL, 0,
|
||||
actual_status = psa_asymmetric_sign( key_slot,
|
||||
( psa_algorithm_t )alg_arg, NULL, 0, NULL, 0,
|
||||
NULL, 0, &signature_length );
|
||||
}
|
||||
|
||||
|
||||
if( usage_arg & PSA_KEY_USAGE_SIGN )
|
||||
{
|
||||
keypair = unhexify_alloc( key_hex, &key_size );
|
||||
|
@ -1288,19 +1288,19 @@ void key_lifetime( int lifetime_arg )
|
|||
psa_key_lifetime_t lifetime_get;
|
||||
|
||||
memset( key, 0x2a, sizeof( key ) );
|
||||
|
||||
|
||||
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
|
||||
|
||||
TEST_ASSERT( psa_set_key_lifetime( key_slot,
|
||||
TEST_ASSERT( psa_set_key_lifetime( key_slot,
|
||||
lifetime_set ) == PSA_SUCCESS );
|
||||
|
||||
TEST_ASSERT( psa_import_key( key_slot, key_type,
|
||||
key, sizeof( key ) ) == PSA_SUCCESS );
|
||||
|
||||
TEST_ASSERT( psa_get_key_lifetime( key_slot,
|
||||
|
||||
TEST_ASSERT( psa_get_key_lifetime( key_slot,
|
||||
&lifetime_get ) == PSA_SUCCESS );
|
||||
|
||||
TEST_ASSERT( lifetime_get == lifetime_set );
|
||||
TEST_ASSERT( lifetime_get == lifetime_set );
|
||||
|
||||
exit:
|
||||
psa_destroy_key( key_slot );
|
||||
|
@ -1323,7 +1323,7 @@ void key_lifetime_set_fail( int key_slot_arg, int lifetime_arg, int expected_sta
|
|||
|
||||
if( actual_status == PSA_SUCCESS )
|
||||
actual_status = psa_set_key_lifetime( key_slot_arg, lifetime_set );
|
||||
|
||||
|
||||
TEST_ASSERT( expected_status == actual_status );
|
||||
|
||||
exit:
|
||||
|
@ -1378,3 +1378,302 @@ exit:
|
|||
mbedtls_psa_crypto_free( );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void asymmetric_verify_fail( int key_type_arg, char *key_hex,
|
||||
int alg_arg, char *hash_hex, char *signature_hex,
|
||||
int expected_status_arg )
|
||||
{
|
||||
|
||||
int slot = 1;
|
||||
psa_key_type_t key_type = key_type_arg;
|
||||
psa_algorithm_t alg = alg_arg;
|
||||
unsigned char *key_data = NULL;
|
||||
size_t key_size;
|
||||
unsigned char *hash_data = NULL;
|
||||
size_t hash_size;
|
||||
unsigned char *signature_data = NULL;
|
||||
size_t signature_size;
|
||||
psa_status_t actual_status;
|
||||
psa_status_t expected_status = expected_status_arg;
|
||||
psa_key_policy_t policy = {0};
|
||||
|
||||
key_data = unhexify_alloc( key_hex, &key_size );
|
||||
TEST_ASSERT( key_data != NULL );
|
||||
hash_data = unhexify_alloc( hash_hex, &hash_size );
|
||||
TEST_ASSERT( hash_data != NULL );
|
||||
signature_data = unhexify_alloc( signature_hex, &signature_size );
|
||||
TEST_ASSERT( signature_data != NULL );
|
||||
|
||||
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
|
||||
|
||||
psa_key_policy_init( &policy );
|
||||
|
||||
psa_key_policy_set_usage( &policy, PSA_KEY_USAGE_VERIFY, alg_arg );
|
||||
|
||||
TEST_ASSERT( psa_set_key_policy( slot, &policy ) == PSA_SUCCESS );
|
||||
|
||||
TEST_ASSERT( psa_import_key( slot, key_type,
|
||||
key_data, key_size ) == PSA_SUCCESS );
|
||||
|
||||
actual_status = psa_asymmetric_verify( slot, alg,
|
||||
hash_data, hash_size,
|
||||
NULL, 0,
|
||||
signature_data, signature_size );
|
||||
|
||||
|
||||
TEST_ASSERT( actual_status == expected_status );
|
||||
|
||||
exit:
|
||||
psa_destroy_key( slot );
|
||||
mbedtls_free( key_data );
|
||||
mbedtls_free( hash_data );
|
||||
mbedtls_free( signature_data );
|
||||
mbedtls_psa_crypto_free( );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void asymmetric_encrypt_decrypt( int key_type_arg, char *key_hex,
|
||||
int alg_arg, char *input_hex )
|
||||
{
|
||||
int slot = 1;
|
||||
psa_key_type_t key_type = key_type_arg;
|
||||
psa_algorithm_t alg = alg_arg;
|
||||
unsigned char *key_data = NULL;
|
||||
size_t key_size;
|
||||
unsigned char *input_data = NULL;
|
||||
size_t input_size;
|
||||
unsigned char *output = NULL;
|
||||
size_t output_size = 0;
|
||||
size_t output_length = 0;
|
||||
unsigned char *output2 = NULL;
|
||||
size_t output2_size = 0;
|
||||
size_t output2_length = 0;
|
||||
psa_key_policy_t policy = {0};
|
||||
|
||||
key_data = unhexify_alloc( key_hex, &key_size );
|
||||
TEST_ASSERT( key_data != NULL );
|
||||
output_size = key_size;
|
||||
output2_size = key_size;
|
||||
input_data = unhexify_alloc( input_hex, &input_size );
|
||||
TEST_ASSERT( input_data != NULL );
|
||||
output = mbedtls_calloc( 1, output_size );
|
||||
TEST_ASSERT( output != NULL );
|
||||
output2 = mbedtls_calloc( 1, output2_size );
|
||||
TEST_ASSERT( output2 != NULL );
|
||||
|
||||
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
|
||||
|
||||
psa_key_policy_init( &policy );
|
||||
psa_key_policy_set_usage( &policy, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT, alg_arg );
|
||||
TEST_ASSERT( psa_set_key_policy( slot, &policy ) == PSA_SUCCESS );
|
||||
|
||||
TEST_ASSERT( psa_import_key( slot, key_type,
|
||||
key_data, key_size ) == PSA_SUCCESS );
|
||||
|
||||
/* We test encryption by checking that encrypt-then-decrypt gives back
|
||||
* the original plaintext because of the non-optional random
|
||||
* part of encryption process which prevents using fixed vectors. */
|
||||
TEST_ASSERT( psa_asymmetric_encrypt(slot, alg,
|
||||
input_data,
|
||||
input_size,
|
||||
NULL, 0,
|
||||
output,
|
||||
output_size,
|
||||
&output_length) == PSA_SUCCESS );
|
||||
|
||||
TEST_ASSERT( psa_asymmetric_decrypt(slot, alg,
|
||||
output,
|
||||
output_length,
|
||||
NULL, 0,
|
||||
output2,
|
||||
output2_size,
|
||||
&output2_length) == PSA_SUCCESS );
|
||||
TEST_ASSERT( memcmp( input_data, output2, input_size ) == 0 );
|
||||
|
||||
exit:
|
||||
psa_destroy_key( slot );
|
||||
mbedtls_free( key_data );
|
||||
mbedtls_free( input_data );
|
||||
mbedtls_free( output);
|
||||
mbedtls_free( output2);
|
||||
mbedtls_psa_crypto_free( );
|
||||
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void asymmetric_encrypt_fail( int key_type_arg, char *key_hex,
|
||||
int alg_arg, char *input_hex,
|
||||
int expected_status_arg )
|
||||
{
|
||||
|
||||
|
||||
int slot = 1;
|
||||
psa_key_type_t key_type = key_type_arg;
|
||||
psa_algorithm_t alg = alg_arg;
|
||||
unsigned char *key_data = NULL;
|
||||
size_t key_size;
|
||||
unsigned char *input_data = NULL;
|
||||
size_t input_size;
|
||||
unsigned char *output = NULL;
|
||||
size_t output_size = 0;
|
||||
size_t output_length = 0;
|
||||
psa_status_t actual_status;
|
||||
psa_status_t expected_status = expected_status_arg;
|
||||
psa_key_policy_t policy = {0};
|
||||
|
||||
key_data = unhexify_alloc( key_hex, &key_size );
|
||||
TEST_ASSERT( key_data != NULL );
|
||||
output_size = key_size;
|
||||
input_data = unhexify_alloc( input_hex, &input_size );
|
||||
TEST_ASSERT( input_data != NULL );
|
||||
output = mbedtls_calloc( 1, output_size );
|
||||
TEST_ASSERT( output != NULL );
|
||||
|
||||
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
|
||||
|
||||
psa_key_policy_init( &policy );
|
||||
psa_key_policy_set_usage( &policy, PSA_KEY_USAGE_ENCRYPT, alg_arg );
|
||||
TEST_ASSERT( psa_set_key_policy( slot, &policy ) == PSA_SUCCESS );
|
||||
|
||||
TEST_ASSERT( psa_import_key( slot, key_type,
|
||||
key_data, key_size ) == PSA_SUCCESS );
|
||||
|
||||
actual_status = psa_asymmetric_encrypt(slot, alg,
|
||||
input_data,
|
||||
input_size,
|
||||
NULL, 0,
|
||||
output,
|
||||
output_size,
|
||||
&output_length);
|
||||
TEST_ASSERT( actual_status == expected_status );
|
||||
|
||||
exit:
|
||||
psa_destroy_key( slot );
|
||||
mbedtls_free( key_data );
|
||||
mbedtls_free( input_data );
|
||||
mbedtls_free( output);
|
||||
mbedtls_psa_crypto_free( );
|
||||
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void asymmetric_decrypt( int key_type_arg, char *key_hex,
|
||||
int alg_arg, char *input_hex,
|
||||
char *expected_hex, int expected_size )
|
||||
{
|
||||
int slot = 1;
|
||||
psa_key_type_t key_type = key_type_arg;
|
||||
psa_algorithm_t alg = alg_arg;
|
||||
unsigned char *key_data = NULL;
|
||||
size_t key_size;
|
||||
unsigned char *input_data = NULL;
|
||||
size_t input_size;
|
||||
unsigned char *expected_data = NULL;
|
||||
size_t expected_data_size;
|
||||
unsigned char *output = NULL;
|
||||
size_t output_size = 0;
|
||||
size_t output_length = 0;
|
||||
psa_key_policy_t policy = {0};
|
||||
|
||||
key_data = unhexify_alloc( key_hex, &key_size );
|
||||
TEST_ASSERT( key_data != NULL );
|
||||
output_size = key_size;
|
||||
input_data = unhexify_alloc( input_hex, &input_size );
|
||||
TEST_ASSERT( input_data != NULL );
|
||||
expected_data = unhexify_alloc( expected_hex, &expected_data_size );
|
||||
TEST_ASSERT( expected_data != NULL );
|
||||
output = mbedtls_calloc( 1, output_size );
|
||||
TEST_ASSERT( output != NULL );
|
||||
|
||||
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
|
||||
|
||||
psa_key_policy_init( &policy );
|
||||
psa_key_policy_set_usage( &policy, PSA_KEY_USAGE_DECRYPT, alg_arg );
|
||||
TEST_ASSERT( psa_set_key_policy( slot, &policy ) == PSA_SUCCESS );
|
||||
|
||||
TEST_ASSERT( psa_import_key( slot, key_type,
|
||||
key_data, key_size ) == PSA_SUCCESS );
|
||||
|
||||
TEST_ASSERT( psa_asymmetric_decrypt( slot, alg,
|
||||
input_data,
|
||||
input_size,
|
||||
NULL, 0,
|
||||
output,
|
||||
output_size,
|
||||
&output_length) == PSA_SUCCESS );
|
||||
TEST_ASSERT( ((size_t)expected_size) == output_length );
|
||||
TEST_ASSERT( memcmp( expected_data, output, (output_length) ) == 0 );
|
||||
|
||||
exit:
|
||||
psa_destroy_key( slot );
|
||||
mbedtls_free( key_data );
|
||||
mbedtls_free( input_data );
|
||||
mbedtls_free( expected_data );
|
||||
mbedtls_free( output);
|
||||
mbedtls_psa_crypto_free( );
|
||||
|
||||
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void asymmetric_decrypt_fail( int key_type_arg, char *key_hex,
|
||||
int alg_arg, char *input_hex,
|
||||
int expected_status_arg )
|
||||
{
|
||||
|
||||
int slot = 1;
|
||||
psa_key_type_t key_type = key_type_arg;
|
||||
psa_algorithm_t alg = alg_arg;
|
||||
unsigned char *key_data = NULL;
|
||||
size_t key_size;
|
||||
unsigned char *input_data = NULL;
|
||||
size_t input_size;
|
||||
unsigned char *output = NULL;
|
||||
size_t output_size = 0;
|
||||
size_t output_length = 0;
|
||||
psa_status_t actual_status;
|
||||
psa_status_t expected_status = expected_status_arg;
|
||||
psa_key_policy_t policy = {0};
|
||||
|
||||
key_data = unhexify_alloc( key_hex, &key_size );
|
||||
TEST_ASSERT( key_data != NULL );
|
||||
output_size = key_size;
|
||||
input_data = unhexify_alloc( input_hex, &input_size );
|
||||
TEST_ASSERT( input_data != NULL );
|
||||
output = mbedtls_calloc( 1, output_size );
|
||||
TEST_ASSERT( output != NULL );
|
||||
|
||||
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
|
||||
|
||||
psa_key_policy_init( &policy );
|
||||
psa_key_policy_set_usage( &policy, PSA_KEY_USAGE_DECRYPT, alg_arg );
|
||||
TEST_ASSERT( psa_set_key_policy( slot, &policy ) == PSA_SUCCESS );
|
||||
|
||||
TEST_ASSERT( psa_import_key( slot, key_type,
|
||||
key_data, key_size ) == PSA_SUCCESS );
|
||||
|
||||
actual_status = psa_asymmetric_decrypt(slot, alg,
|
||||
input_data,
|
||||
input_size,
|
||||
NULL, 0,
|
||||
output,
|
||||
output_size,
|
||||
&output_length);
|
||||
TEST_ASSERT( actual_status == expected_status );
|
||||
|
||||
exit:
|
||||
psa_destroy_key( slot );
|
||||
mbedtls_free( key_data );
|
||||
mbedtls_free( input_data );
|
||||
mbedtls_free( output);
|
||||
mbedtls_psa_crypto_free( );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
|
Loading…
Reference in a new issue