22 psa_key_handle_t key_handle;
23 psa_key_type_t key_type;
24 psa_key_usage_t usage;
25 psa_algorithm_t key_alg;
29 uint32_t expected_bit_length;
30 uint32_t expected_key_length;
31 psa_status_t expected_status;
35 static uint32_t rsa_extra = 3;
39 #ifdef ARCH_TEST_CIPER_MODE_CTR 40 #ifdef ARCH_TEST_AES_128 41 {
"Test psa_generate_key 16 Byte AES\n", 1, PSA_KEY_TYPE_AES,
42 PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
43 BYTES_TO_BITS(AES_16B_KEY_SIZE), NULL, 0,
44 BYTES_TO_BITS(AES_16B_KEY_SIZE), AES_16B_KEY_SIZE, PSA_SUCCESS
48 #ifdef ARCH_TEST_AES_192 49 {
"Test psa_generate_key 24 Byte AES\n", 2, PSA_KEY_TYPE_AES,
50 PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
51 BYTES_TO_BITS(AES_24B_KEY_SIZE), NULL, 0,
52 BYTES_TO_BITS(AES_24B_KEY_SIZE), AES_24B_KEY_SIZE, PSA_SUCCESS
56 #ifdef ARCH_TEST_AES_256 57 {
"Test psa_generate_key 32 Byte AES\n", 3, PSA_KEY_TYPE_AES,
58 PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
59 BYTES_TO_BITS(AES_32B_KEY_SIZE), NULL, 0,
60 BYTES_TO_BITS(AES_32B_KEY_SIZE), AES_32B_KEY_SIZE, PSA_SUCCESS
64 #ifdef ARCH_TEST_DES_1KEY 65 {
"Test psa_generate_key with DES 64 bit key\n", 4, PSA_KEY_TYPE_DES,
66 PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
67 BYTES_TO_BITS(DES_8B_KEY_SIZE), NULL, 0,
68 BYTES_TO_BITS(DES_8B_KEY_SIZE), DES_8B_KEY_SIZE, PSA_SUCCESS
72 #ifdef ARCH_TEST_DES_2KEY 73 {
"Test psa_generate_key with Triple DES 2-Key\n", 5, PSA_KEY_TYPE_DES,
74 PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
75 BYTES_TO_BITS(DES3_2KEY_SIZE), NULL, 0,
76 BYTES_TO_BITS(DES3_2KEY_SIZE), DES3_2KEY_SIZE, PSA_SUCCESS
80 #ifdef ARCH_TEST_DES_3KEY 81 {
"Test psa_generate_key with Triple DES 3-Key\n", 6, PSA_KEY_TYPE_DES,
82 PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
83 BYTES_TO_BITS(DES3_3KEY_SIZE), NULL, 0,
84 BYTES_TO_BITS(DES3_3KEY_SIZE), DES3_3KEY_SIZE, PSA_SUCCESS
88 #ifdef ARCH_TEST_AES_256 89 {
"Test psa_generate_key with Null extra and Non-Zero extra size\n", 7, PSA_KEY_TYPE_AES,
90 PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
91 BYTES_TO_BITS(AES_32B_KEY_SIZE), NULL,
sizeof(uint32_t),
92 0, 0, PSA_ERROR_INVALID_ARGUMENT
98 {
"Test psa_generate_key with RSA 2048 Keypair\n", 8, PSA_KEY_TYPE_RSA_KEYPAIR,
99 PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_SIGN | PSA_KEY_USAGE_VERIFY, PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
101 2048, 1193, PSA_SUCCESS
105 #ifdef ARCH_TEST_ECC_CURVE_SECP224R1 106 #ifdef ARCH_TEST_ASYMMETRIC_ENCRYPTION 107 {
"Test psa_generate_key with ECC KeyPair\n", 9,
108 PSA_KEY_TYPE_ECC_KEYPAIR(PSA_ECC_CURVE_SECP224R1),
109 PSA_KEY_USAGE_EXPORT, PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION,
116 #ifdef FUTURE_SUPPORT 117 {
"Test psa_generate_key with Non-Null extra for 32 Byte AES key\n", 10, PSA_KEY_TYPE_AES,
118 PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
119 BYTES_TO_BITS(AES_32B_KEY_SIZE), &rsa_extra,
sizeof(uint32_t),
120 0, 0, PSA_ERROR_INVALID_ARGUMENT
124 #ifdef ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
125 #ifdef ARCH_TEST_RSA_2048
126 {
"Test psa_generate_key with RSA 2048 Public key\n", 11, PSA_KEY_TYPE_RSA_PUBLIC_KEY,
127 PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_SIGN | PSA_KEY_USAGE_VERIFY, PSA_ALG_RSA_PKCS1V15_SIGN_RAW,
129 2048, 1193, PSA_ERROR_NOT_SUPPORTED
136 #ifdef ARCH_TEST_CIPER_MODE_CTR 137 #ifdef ARCH_TEST_AES_128 138 {
"Test psa_generate_key negative cases\n", 12, PSA_KEY_TYPE_AES,
139 PSA_KEY_USAGE_EXPORT, PSA_ALG_CTR,
140 BYTES_TO_BITS(AES_16B_KEY_SIZE), NULL, 0,
141 BYTES_TO_BITS(AES_16B_KEY_SIZE), AES_16B_KEY_SIZE, PSA_SUCCESS
Copyright (c) 2018-2019, Arm Limited or its affiliates.