1/* BEGIN_HEADER */ 2 3#include "psa/crypto.h" 4#include "test/psa_crypto_helpers.h" 5 6#define INVALID_KEY_ID mbedtls_svc_key_id_make( 0, 0xfedcba98 ) 7 8/* END_HEADER */ 9 10/* BEGIN_DEPENDENCIES 11 * depends_on:MBEDTLS_PSA_CRYPTO_C 12 * END_DEPENDENCIES 13 */ 14 15/* BEGIN_CASE */ 16void import_not_supported( int key_type, data_t *key_material ) 17{ 18 psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; 19 mbedtls_svc_key_id_t key_id = INVALID_KEY_ID; 20 21 PSA_ASSERT( psa_crypto_init( ) ); 22 psa_set_key_type( &attributes, key_type ); 23 TEST_EQUAL( psa_import_key( &attributes, 24 key_material->x, key_material->len, 25 &key_id ), 26 PSA_ERROR_NOT_SUPPORTED ); 27 TEST_ASSERT( mbedtls_svc_key_id_equal( key_id, MBEDTLS_SVC_KEY_ID_INIT ) ); 28 29exit: 30 psa_destroy_key( key_id ); 31 PSA_DONE( ); 32} 33/* END_CASE */ 34 35/* BEGIN_CASE */ 36void generate_not_supported( int key_type, int bits ) 37{ 38 psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; 39 mbedtls_svc_key_id_t key_id = INVALID_KEY_ID; 40 41 PSA_ASSERT( psa_crypto_init( ) ); 42 psa_set_key_type( &attributes, key_type ); 43 psa_set_key_bits( &attributes, bits ); 44 TEST_EQUAL( psa_generate_key( &attributes, &key_id ), 45 PSA_ERROR_NOT_SUPPORTED ); 46 TEST_ASSERT( mbedtls_svc_key_id_equal( key_id, MBEDTLS_SVC_KEY_ID_INIT ) ); 47 48exit: 49 psa_destroy_key( key_id ); 50 PSA_DONE( ); 51} 52/* END_CASE */ 53