22 psa_key_handle_t key_handle;
23 psa_key_type_t key_type;
26 psa_key_usage_t usage;
27 psa_algorithm_t key_alg;
33 uint8_t expected_output[32];
34 size_t expected_output_length;
35 size_t expected_bit_length;
36 psa_status_t expected_status;
39 static const uint8_t rsa_384_keypair[1];
40 static const uint8_t rsa_384_keydata[1];
41 static const uint8_t rsa_256_keypair[1];
42 static const uint8_t rsa_256_keydata[1];
44 static const uint8_t ec_keydata[] = {
45 0x30, 0x49, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06,
46 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x01, 0x03, 0x32, 0x00, 0x04, 0xBC,
47 0x79, 0x7D, 0xB3, 0xAE, 0x7F, 0x08, 0xEC, 0x3D, 0x49, 0x6B, 0x4F, 0xB4, 0x11, 0xB3,
48 0xF6, 0x20, 0xA5, 0x58, 0xA5, 0x01, 0xE0, 0x22, 0x2D, 0x08, 0xCF, 0xE0, 0xDC, 0x8A,
49 0xEC, 0x8B, 0x1A, 0x7B, 0xF2, 0x4B, 0xE9, 0x29, 0x51, 0xCC, 0x5B, 0xA1, 0xBE, 0xBB,
50 0x24, 0x74, 0x90, 0x9A, 0xE0};
52 static const uint8_t ec_keypair[] = {
53 0x30, 0x5F, 0x02, 0x01, 0x01, 0x04, 0x18, 0x33, 0x8E, 0x86, 0xA8, 0x81, 0xE2, 0x38,
54 0xF5, 0x49, 0xBD, 0x6F, 0x05, 0x53, 0x49, 0x4B, 0x73, 0xE3, 0xD6, 0x11, 0x30, 0xFD,
55 0xC6, 0xC9, 0x6D, 0xA0, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01,
56 0x01, 0xA1, 0x34, 0x03, 0x32, 0x00, 0x04, 0x51, 0x75, 0xBC, 0xDF, 0x30, 0xA3, 0x70,
57 0xF3, 0x9D, 0x53, 0x93, 0xE6, 0x12, 0x72, 0x88, 0xD8, 0x01, 0x67, 0xB5, 0xF4, 0xB4,
58 0xB7, 0x76, 0xC6, 0x74, 0xF7, 0xC6, 0xF3, 0x54, 0xB7, 0xD2, 0x24, 0x06, 0x2C, 0x1F,
59 0x68, 0x54, 0xB5, 0xA7, 0xAF, 0x0F, 0xE5, 0x78, 0xEA, 0xF2, 0x58, 0xF0, 0x27};
61 static const uint8_t rsa_128_keydata[] = {
62 0x30, 0x81, 0x9f, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
63 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, 0x81, 0x89, 0x02,
64 0x81, 0x81, 0x00, 0xaf, 0x05, 0x7d, 0x39, 0x6e, 0xe8, 0x4f, 0xb7, 0x5f, 0xdb,
65 0xb5, 0xc2, 0xb1, 0x3c, 0x7f, 0xe5, 0xa6, 0x54, 0xaa, 0x8a, 0xa2, 0x47, 0x0b,
66 0x54, 0x1e, 0xe1, 0xfe, 0xb0, 0xb1, 0x2d, 0x25, 0xc7, 0x97, 0x11, 0x53, 0x12,
67 0x49, 0xe1, 0x12, 0x96, 0x28, 0x04, 0x2d, 0xbb, 0xb6, 0xc1, 0x20, 0xd1, 0x44,
68 0x35, 0x24, 0xef, 0x4c, 0x0e, 0x6e, 0x1d, 0x89, 0x56, 0xee, 0xb2, 0x07, 0x7a,
69 0xf1, 0x23, 0x49, 0xdd, 0xee, 0xe5, 0x44, 0x83, 0xbc, 0x06, 0xc2, 0xc6, 0x19,
70 0x48, 0xcd, 0x02, 0xb2, 0x02, 0xe7, 0x96, 0xae, 0xbd, 0x94, 0xd3, 0xa7, 0xcb,
71 0xf8, 0x59, 0xc2, 0xc1, 0x81, 0x9c, 0x32, 0x4c, 0xb8, 0x2b, 0x9c, 0xd3, 0x4e,
72 0xde, 0x26, 0x3a, 0x2a, 0xbf, 0xfe, 0x47, 0x33, 0xf0, 0x77, 0x86, 0x9e, 0x86,
73 0x60, 0xf7, 0xd6, 0x83, 0x4d, 0xa5, 0x3d, 0x69, 0x0e, 0xf7, 0x98, 0x5f, 0x6b,
74 0xc3, 0x02, 0x03, 0x01, 0x00, 0x01};
76 static const uint8_t rsa_128_keypair[] = {
77 0x30, 0x82, 0x02, 0x5e, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xaf, 0x05,
78 0x7d, 0x39, 0x6e, 0xe8, 0x4f, 0xb7, 0x5f, 0xdb, 0xb5, 0xc2, 0xb1, 0x3c, 0x7f,
79 0xe5, 0xa6, 0x54, 0xaa, 0x8a, 0xa2, 0x47, 0x0b, 0x54, 0x1e, 0xe1, 0xfe, 0xb0,
80 0xb1, 0x2d, 0x25, 0xc7, 0x97, 0x11, 0x53, 0x12, 0x49, 0xe1, 0x12, 0x96, 0x28,
81 0x04, 0x2d, 0xbb, 0xb6, 0xc1, 0x20, 0xd1, 0x44, 0x35, 0x24, 0xef, 0x4c, 0x0e,
82 0x6e, 0x1d, 0x89, 0x56, 0xee, 0xb2, 0x07, 0x7a, 0xf1, 0x23, 0x49, 0xdd, 0xee,
83 0xe5, 0x44, 0x83, 0xbc, 0x06, 0xc2, 0xc6, 0x19, 0x48, 0xcd, 0x02, 0xb2, 0x02,
84 0xe7, 0x96, 0xae, 0xbd, 0x94, 0xd3, 0xa7, 0xcb, 0xf8, 0x59, 0xc2, 0xc1, 0x81,
85 0x9c, 0x32, 0x4c, 0xb8, 0x2b, 0x9c, 0xd3, 0x4e, 0xde, 0x26, 0x3a, 0x2a, 0xbf,
86 0xfe, 0x47, 0x33, 0xf0, 0x77, 0x86, 0x9e, 0x86, 0x60, 0xf7, 0xd6, 0x83, 0x4d,
87 0xa5, 0x3d, 0x69, 0x0e, 0xf7, 0x98, 0x5f, 0x6b, 0xc3, 0x02, 0x03, 0x01, 0x00,
88 0x01, 0x02, 0x81, 0x81, 0x00, 0x87, 0x4b, 0xf0, 0xff, 0xc2, 0xf2, 0xa7, 0x1d,
89 0x14, 0x67, 0x1d, 0xdd, 0x01, 0x71, 0xc9, 0x54, 0xd7, 0xfd, 0xbf, 0x50, 0x28,
90 0x1e, 0x4f, 0x6d, 0x99, 0xea, 0x0e, 0x1e, 0xbc, 0xf8, 0x2f, 0xaa, 0x58, 0xe7,
91 0xb5, 0x95, 0xff, 0xb2, 0x93, 0xd1, 0xab, 0xe1, 0x7f, 0x11, 0x0b, 0x37, 0xc4,
92 0x8c, 0xc0, 0xf3, 0x6c, 0x37, 0xe8, 0x4d, 0x87, 0x66, 0x21, 0xd3, 0x27, 0xf6,
93 0x4b, 0xbe, 0x08, 0x45, 0x7d, 0x3e, 0xc4, 0x09, 0x8b, 0xa2, 0xfa, 0x0a, 0x31,
94 0x9f, 0xba, 0x41, 0x1c, 0x28, 0x41, 0xed, 0x7b, 0xe8, 0x31, 0x96, 0xa8, 0xcd,
95 0xf9, 0xda, 0xa5, 0xd0, 0x06, 0x94, 0xbc, 0x33, 0x5f, 0xc4, 0xc3, 0x22, 0x17,
96 0xfe, 0x04, 0x88, 0xbc, 0xe9, 0xcb, 0x72, 0x02, 0xe5, 0x94, 0x68, 0xb1, 0xea,
97 0xd1, 0x19, 0x00, 0x04, 0x77, 0xdb, 0x2c, 0xa7, 0x97, 0xfa, 0xc1, 0x9e, 0xda,
98 0x3f, 0x58, 0xc1, 0x02, 0x41, 0x00, 0xe2, 0xab, 0x76, 0x08, 0x41, 0xbb, 0x9d,
99 0x30, 0xa8, 0x1d, 0x22, 0x2d, 0xe1, 0xeb, 0x73, 0x81, 0xd8, 0x22, 0x14, 0x40,
100 0x7f, 0x1b, 0x97, 0x5c, 0xbb, 0xfe, 0x4e, 0x1a, 0x94, 0x67, 0xfd, 0x98, 0xad,
101 0xbd, 0x78, 0xf6, 0x07, 0x83, 0x6c, 0xa5, 0xbe, 0x19, 0x28, 0xb9, 0xd1, 0x60,
102 0xd9, 0x7f, 0xd4, 0x5c, 0x12, 0xd6, 0xb5, 0x2e, 0x2c, 0x98, 0x71, 0xa1, 0x74,
103 0xc6, 0x6b, 0x48, 0x81, 0x13, 0x02, 0x41, 0x00, 0xc5, 0xab, 0x27, 0x60, 0x21,
104 0x59, 0xae, 0x7d, 0x6f, 0x20, 0xc3, 0xc2, 0xee, 0x85, 0x1e, 0x46, 0xdc, 0x11,
105 0x2e, 0x68, 0x9e, 0x28, 0xd5, 0xfc, 0xbb, 0xf9, 0x90, 0xa9, 0x9e, 0xf8, 0xa9,
106 0x0b, 0x8b, 0xb4, 0x4f, 0xd3, 0x64, 0x67, 0xe7, 0xfc, 0x17, 0x89, 0xce, 0xb6,
107 0x63, 0xab, 0xda, 0x33, 0x86, 0x52, 0xc3, 0xc7, 0x3f, 0x11, 0x17, 0x74, 0x90,
108 0x2e, 0x84, 0x05, 0x65, 0x92, 0x70, 0x91, 0x02, 0x41, 0x00, 0xb6, 0xcd, 0xbd,
109 0x35, 0x4f, 0x7d, 0xf5, 0x79, 0xa6, 0x3b, 0x48, 0xb3, 0x64, 0x3e, 0x35, 0x3b,
110 0x84, 0x89, 0x87, 0x77, 0xb4, 0x8b, 0x15, 0xf9, 0x4e, 0x0b, 0xfc, 0x05, 0x67,
111 0xa6, 0xae, 0x59, 0x11, 0xd5, 0x7a, 0xd6, 0x40, 0x9c, 0xf7, 0x64, 0x7b, 0xf9,
112 0x62, 0x64, 0xe9, 0xbd, 0x87, 0xeb, 0x95, 0xe2, 0x63, 0xb7, 0x11, 0x0b, 0x9a,
113 0x1f, 0x9f, 0x94, 0xac, 0xce, 0xd0, 0xfa, 0xfa, 0x4d, 0x02, 0x40, 0x71, 0x19,
114 0x5e, 0xec, 0x37, 0xe8, 0xd2, 0x57, 0xde, 0xcf, 0xc6, 0x72, 0xb0, 0x7a, 0xe6,
115 0x39, 0xf1, 0x0c, 0xbb, 0x9b, 0x0c, 0x73, 0x9d, 0x0c, 0x80, 0x99, 0x68, 0xd6,
116 0x44, 0xa9, 0x4e, 0x3f, 0xd6, 0xed, 0x92, 0x87, 0x07, 0x7a, 0x14, 0x58, 0x3f,
117 0x37, 0x90, 0x58, 0xf7, 0x6a, 0x8a, 0xec, 0xd4, 0x3c, 0x62, 0xdc, 0x8c, 0x0f,
118 0x41, 0x76, 0x66, 0x50, 0xd7, 0x25, 0x27, 0x5a, 0xc4, 0xa1, 0x02, 0x41, 0x00,
119 0xbb, 0x32, 0xd1, 0x33, 0xed, 0xc2, 0xe0, 0x48, 0xd4, 0x63, 0x38, 0x8b, 0x7b,
120 0xe9, 0xcb, 0x4b, 0xe2, 0x9f, 0x4b, 0x62, 0x50, 0xbe, 0x60, 0x3e, 0x70, 0xe3,
121 0x64, 0x75, 0x01, 0xc9, 0x7d, 0xdd, 0xe2, 0x0a, 0x4e, 0x71, 0xbe, 0x95, 0xfd,
122 0x5e, 0x71, 0x78, 0x4e, 0x25, 0xac, 0xa4, 0xba, 0xf2, 0x5b, 0xe5, 0x73, 0x8a,
123 0xae, 0x59, 0xbb, 0xfe, 0x1c, 0x99, 0x77, 0x81, 0x44, 0x7a, 0x2b, 0x24};
126 #ifdef ARCH_TEST_RSA_1024 127 #ifdef ARCH_TEST_RSA_PKCS1V15_CRYPT 128 {
"Test psa_asymmetric_decrypt - RSA KEYPAIR PKCS1V15\n", 1, PSA_KEY_TYPE_RSA_KEYPAIR,
129 {0}, 610, PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT,
131 {0x99, 0xff, 0xde, 0x2f, 0xcc, 0x00, 0xc9, 0xcc, 0x01, 0x97, 0x2e, 0xbf, 0xa7,
132 0x77, 0x9b, 0x29, 0x8d, 0xbb, 0xaf, 0x7f, 0x50, 0x70, 0x7a, 0x74, 0x05, 0x29,
133 0x6d, 0xd2, 0x78, 0x34, 0x56, 0xfc, 0x79, 0x20, 0x02, 0xf4, 0x62, 0xe7, 0x60,
134 0x50, 0x0e, 0x02, 0xaf, 0xa2, 0x5a, 0x85, 0x9a, 0xce, 0x87, 0x01, 0xcb, 0x5d,
135 0x3b, 0x02, 0x62, 0x11, 0x64, 0x31, 0xc4, 0x3a, 0xf8, 0xeb, 0x08, 0xf5, 0xa8,
136 0x83, 0x01, 0x05, 0x7c, 0xf1, 0xc1, 0x56, 0xa2, 0xa5, 0x19, 0x3c, 0x14, 0x3e,
137 0x7a, 0x5b, 0x03, 0xfa, 0xc1, 0x32, 0xb7, 0xe8, 0x9e, 0x6d, 0xcd, 0x8f, 0x4c,
138 0x82, 0xc9, 0xb2, 0x84, 0x52, 0x32, 0x9c, 0x26, 0x0d, 0x30, 0xbc, 0x39, 0xb3,
139 0x81, 0x6b, 0x7c, 0x46, 0xb4, 0x1b, 0x37, 0xb4, 0x85, 0x0d, 0x2a, 0xe7, 0x4e,
140 0x72, 0x9f, 0x99, 0xc6, 0x62, 0x1f, 0xbb, 0xe2, 0xe4, 0x68, 0x72},
142 {0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
143 0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10,
144 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad},
145 32, 1024, PSA_SUCCESS
149 #ifdef ARCH_TEST_SHA256 150 #ifdef ARCH_TEST_RSA_OAEP 151 {
"Test psa_asymmetric_decrypt - RSA KEYPAIR OAEP SHA256\n", 2, PSA_KEY_TYPE_RSA_KEYPAIR,
152 {0}, 610, PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_OAEP(PSA_ALG_SHA_256),
154 {0x3d, 0x31, 0x46, 0xb1, 0xc9, 0x82, 0x00, 0x42, 0x73, 0xa9, 0xeb, 0xb9, 0xb0,
155 0x63, 0xe6, 0xae, 0x53, 0xb1, 0xa8, 0x5b, 0xfc, 0x80, 0x23, 0x24, 0xbc, 0xdd,
156 0x04, 0xfa, 0xa0, 0xf7, 0x21, 0x1f, 0xb2, 0xbd, 0xee, 0xa4, 0x03, 0x58, 0x09,
157 0x55, 0x54, 0xdf, 0x9c, 0x25, 0x08, 0x66, 0xc7, 0x36, 0x1e, 0x73, 0x8f, 0x0d,
158 0x27, 0x0e, 0xaa, 0x27, 0x73, 0x8e, 0x87, 0x92, 0x8c, 0x5e, 0x31, 0x81, 0x55,
159 0x06, 0x34, 0x67, 0x27, 0x90, 0x0f, 0xf0, 0x3c, 0xef, 0x0b, 0xe6, 0xf9, 0xdd,
160 0x6b, 0xba, 0x63, 0xce, 0x89, 0x07, 0x4e, 0x81, 0x94, 0xfe, 0x68, 0xb5, 0xa5,
161 0x73, 0x94, 0x22, 0xd4, 0xf1, 0x38, 0xbb, 0xbb, 0x61, 0xf4, 0x9b, 0x76, 0xcf,
162 0x1f, 0x18, 0xde, 0xf2, 0xc9, 0x93, 0xe3, 0x11, 0x3b, 0x08, 0xc1, 0x91, 0xea,
163 0x1d, 0xa0, 0xfe, 0xb9, 0x4f, 0x8f, 0xd9, 0xb3, 0x01, 0x09, 0xa1},
169 {
"Test psa_asymmetric_decrypt - RSA KEYPAIR OAEP SHA256 with label\n", 3,
170 PSA_KEY_TYPE_RSA_KEYPAIR,
171 {0}, 610, PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_OAEP(PSA_ALG_SHA_256),
172 {0x74, 0x68, 0x69, 0x73, 0x00, 0x69, 0x73, 0x00, 0x61, 0x00, 0x6c, 0x61, 0x62,
173 0x65, 0x6c, 0x00}, 16,
174 {0x46, 0xed, 0xc9, 0x98, 0x4a, 0x6d, 0x4b, 0x7c, 0x7f, 0xd8, 0x8f, 0xda, 0x9e,
175 0xa9, 0x1d, 0xdb, 0xd3, 0x0b, 0x28, 0xa0, 0x79, 0x3c, 0xc7, 0x5a, 0x9f, 0xcd,
176 0xd9, 0x4d, 0x86, 0x7c, 0x69, 0x09, 0x0a, 0x69, 0x7d, 0x46, 0xa6, 0xf3, 0x36,
177 0xa3, 0xe4, 0x8a, 0x12, 0x2d, 0xd3, 0xee, 0x3b, 0x51, 0x56, 0x6b, 0x44, 0x5f,
178 0xf7, 0x8a, 0xdb, 0x61, 0x3d, 0x09, 0xb7, 0xd8, 0xc5, 0x9c, 0x25, 0xa2, 0x7d,
179 0x8c, 0xf7, 0xf5, 0xe3, 0x64, 0x55, 0xf2, 0xe7, 0x1f, 0xf6, 0xc6, 0xee, 0x98,
180 0xd5, 0x74, 0x0e, 0x66, 0xb2, 0x37, 0x94, 0xac, 0xc7, 0x29, 0x06, 0x56, 0x19,
181 0x51, 0xc2, 0xbe, 0x50, 0x64, 0xf6, 0xa2, 0x50, 0x64, 0x6a, 0xb6, 0x27, 0xec,
182 0xbf, 0xa4, 0x8c, 0x02, 0xf8, 0x2c, 0x29, 0xfe, 0x9b, 0x8c, 0x8e, 0x6b, 0xe8,
183 0xeb, 0x75, 0x24, 0x32, 0x12, 0x49, 0x74, 0x37, 0x3b, 0x54, 0x2c},
185 {0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x20, 0x73, 0x71,
186 0x75, 0x65, 0x61, 0x6d, 0x69, 0x73, 0x68, 0x20, 0x6f, 0x73, 0x73, 0x69, 0x66,
187 0x72, 0x61, 0x67, 0x65},
188 30, 1024, PSA_SUCCESS
193 #ifdef ARCH_TEST_RSA_PKCS1V15_CRYPT 194 {
"Test psa_asymmetric_decrypt - Invalid key type (RSA public key)\n", 4,
195 PSA_KEY_TYPE_RSA_PUBLIC_KEY,
196 {0}, 162, PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT,
198 {0x3d, 0x31, 0x46, 0xb1, 0xc9, 0x82, 0x00, 0x42, 0x73, 0xa9, 0xeb, 0xb9, 0xb0,
199 0x63, 0xe6, 0xae, 0x53, 0xb1, 0xa8, 0x5b, 0xfc, 0x80, 0x23, 0x24, 0xbc, 0xdd,
200 0x04, 0xfa, 0xa0, 0xf7, 0x21, 0x1f, 0xb2, 0xbd, 0xee, 0xa4, 0x03, 0x58, 0x09,
201 0x55, 0x54, 0xdf, 0x9c, 0x25, 0x08, 0x66, 0xc7, 0x36, 0x1e, 0x73, 0x8f, 0x0d,
202 0x27, 0x0e, 0xaa, 0x27, 0x73, 0x8e, 0x87, 0x92, 0x8c, 0x5e, 0x31, 0x81, 0x55,
203 0x06, 0x34, 0x67, 0x27, 0x90, 0x0f, 0xf0, 0x3c, 0xef, 0x0b, 0xe6, 0xf9, 0xdd,
204 0x6b, 0xba, 0x63, 0xce, 0x89, 0x07, 0x4e, 0x81, 0x94, 0xfe, 0x68, 0xb5, 0xa5,
205 0x73, 0x94, 0x22, 0xd4, 0xf1, 0x38, 0xbb, 0xbb, 0x61, 0xf4, 0x9b, 0x76, 0xcf,
206 0x1f, 0x18, 0xde, 0xf2, 0xc9, 0x93, 0xe3, 0x11, 0x3b, 0x08, 0xc1, 0x91, 0xea,
207 0x1d, 0xa0, 0xfe, 0xb9, 0x4f, 0x8f, 0xd9, 0xb3, 0x01, 0x09, 0xa1},
210 0, 1024, PSA_ERROR_INVALID_ARGUMENT
213 {
"Test psa_asymmetric_decrypt - Small output buffer\n", 5, PSA_KEY_TYPE_RSA_KEYPAIR,
214 {0}, 610, PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT,
216 {0x99, 0xff, 0xde, 0x2f, 0xcc, 0x00, 0xc9, 0xcc, 0x01, 0x97, 0x2e, 0xbf, 0xa7,
217 0x77, 0x9b, 0x29, 0x8d, 0xbb, 0xaf, 0x7f, 0x50, 0x70, 0x7a, 0x74, 0x05, 0x29,
218 0x6d, 0xd2, 0x78, 0x34, 0x56, 0xfc, 0x79, 0x20, 0x02, 0xf4, 0x62, 0xe7, 0x60,
219 0x50, 0x0e, 0x02, 0xaf, 0xa2, 0x5a, 0x85, 0x9a, 0xce, 0x87, 0x01, 0xcb, 0x5d,
220 0x3b, 0x02, 0x62, 0x11, 0x64, 0x31, 0xc4, 0x3a, 0xf8, 0xeb, 0x08, 0xf5, 0xa8,
221 0x83, 0x01, 0x05, 0x7c, 0xf1, 0xc1, 0x56, 0xa2, 0xa5, 0x19, 0x3c, 0x14, 0x3e,
222 0x7a, 0x5b, 0x03, 0xfa, 0xc1, 0x32, 0xb7, 0xe8, 0x9e, 0x6d, 0xcd, 0x8f, 0x4c,
223 0x82, 0xc9, 0xb2, 0x84, 0x52, 0x32, 0x9c, 0x26, 0x0d, 0x30, 0xbc, 0x39, 0xb3,
224 0x81, 0x6b, 0x7c, 0x46, 0xb4, 0x1b, 0x37, 0xb4, 0x85, 0x0d, 0x2a, 0xe7, 0x4e,
225 0x72, 0x9f, 0x99, 0xc6, 0x62, 0x1f, 0xbb, 0xe2, 0xe4, 0x68, 0x72},
227 {0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
228 0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10,
229 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad},
230 32, 1024, PSA_ERROR_BUFFER_TOO_SMALL
234 #ifdef ARCH_TEST_SHA256 235 {
"Test psa_asymmetric_decrypt - Invalid algorithm\n", 6, PSA_KEY_TYPE_RSA_KEYPAIR,
236 {0}, 610, PSA_KEY_USAGE_DECRYPT, PSA_ALG_SHA_256,
238 {0x99, 0xff, 0xde, 0x2f, 0xcc, 0x00, 0xc9, 0xcc, 0x01, 0x97, 0x2e, 0xbf, 0xa7,
239 0x77, 0x9b, 0x29, 0x8d, 0xbb, 0xaf, 0x7f, 0x50, 0x70, 0x7a, 0x74, 0x05, 0x29,
240 0x6d, 0xd2, 0x78, 0x34, 0x56, 0xfc, 0x79, 0x20, 0x02, 0xf4, 0x62, 0xe7, 0x60,
241 0x50, 0x0e, 0x02, 0xaf, 0xa2, 0x5a, 0x85, 0x9a, 0xce, 0x87, 0x01, 0xcb, 0x5d,
242 0x3b, 0x02, 0x62, 0x11, 0x64, 0x31, 0xc4, 0x3a, 0xf8, 0xeb, 0x08, 0xf5, 0xa8,
243 0x83, 0x01, 0x05, 0x7c, 0xf1, 0xc1, 0x56, 0xa2, 0xa5, 0x19, 0x3c, 0x14, 0x3e,
244 0x7a, 0x5b, 0x03, 0xfa, 0xc1, 0x32, 0xb7, 0xe8, 0x9e, 0x6d, 0xcd, 0x8f, 0x4c,
245 0x82, 0xc9, 0xb2, 0x84, 0x52, 0x32, 0x9c, 0x26, 0x0d, 0x30, 0xbc, 0x39, 0xb3,
246 0x81, 0x6b, 0x7c, 0x46, 0xb4, 0x1b, 0x37, 0xb4, 0x85, 0x0d, 0x2a, 0xe7, 0x4e,
247 0x72, 0x9f, 0x99, 0xc6, 0x62, 0x1f, 0xbb, 0xe2, 0xe4, 0x68, 0x72},
249 {0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
250 0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10,
251 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad},
252 32, 1024, PSA_ERROR_INVALID_ARGUMENT
257 #ifdef ARCH_TEST_RSA_PKCS1V15_CRYPT 258 #ifdef ARCH_TEST_AES_128 259 {
"Test psa_asymmetric_decrypt - Invalid key type (AES Key)\n", 7, PSA_KEY_TYPE_AES,
260 {0x30, 0x82, 0x02, 0x5e, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xaf, 0x05,
261 0x7d, 0x39, 0x6e}, AES_16B_KEY_SIZE, PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT,
263 {0x99, 0xff, 0xde, 0x2f, 0xcc, 0x00, 0xc9, 0xcc, 0x01, 0x97, 0x2e, 0xbf, 0xa7,
264 0x77, 0x9b, 0x29, 0x8d, 0xbb, 0xaf, 0x7f, 0x50, 0x70, 0x7a, 0x74, 0x05, 0x29,
265 0x6d, 0xd2, 0x78, 0x34, 0x56, 0xfc, 0x79, 0x20, 0x02, 0xf4, 0x62, 0xe7, 0x60,
266 0x50, 0x0e, 0x02, 0xaf, 0xa2, 0x5a, 0x85, 0x9a, 0xce, 0x87, 0x01, 0xcb, 0x5d,
267 0x3b, 0x02, 0x62, 0x11, 0x64, 0x31, 0xc4, 0x3a, 0xf8, 0xeb, 0x08, 0xf5, 0xa8,
268 0x83, 0x01, 0x05, 0x7c, 0xf1, 0xc1, 0x56, 0xa2, 0xa5, 0x19, 0x3c, 0x14, 0x3e,
269 0x7a, 0x5b, 0x03, 0xfa, 0xc1, 0x32, 0xb7, 0xe8, 0x9e, 0x6d, 0xcd, 0x8f, 0x4c,
270 0x82, 0xc9, 0xb2, 0x84, 0x52, 0x32, 0x9c, 0x26, 0x0d, 0x30, 0xbc, 0x39, 0xb3,
271 0x81, 0x6b, 0x7c, 0x46, 0xb4, 0x1b, 0x37, 0xb4, 0x85, 0x0d, 0x2a, 0xe7, 0x4e,
272 0x72, 0x9f, 0x99, 0xc6, 0x62, 0x1f, 0xbb, 0xe2, 0xe4, 0x68, 0x72},
274 {0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
275 0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10,
276 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad},
277 32, BYTES_TO_BITS(AES_16B_KEY_SIZE), PSA_ERROR_INVALID_ARGUMENT
281 #ifdef ARCH_TEST_RSA_1024 282 {
"Test psa_asymmetric_decrypt - Invalid usage\n", 8, PSA_KEY_TYPE_RSA_KEYPAIR,
283 {0}, 610, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT,
285 {0x99, 0xff, 0xde, 0x2f, 0xcc, 0x00, 0xc9, 0xcc, 0x01, 0x97, 0x2e, 0xbf, 0xa7,
286 0x77, 0x9b, 0x29, 0x8d, 0xbb, 0xaf, 0x7f, 0x50, 0x70, 0x7a, 0x74, 0x05, 0x29,
287 0x6d, 0xd2, 0x78, 0x34, 0x56, 0xfc, 0x79, 0x20, 0x02, 0xf4, 0x62, 0xe7, 0x60,
288 0x50, 0x0e, 0x02, 0xaf, 0xa2, 0x5a, 0x85, 0x9a, 0xce, 0x87, 0x01, 0xcb, 0x5d,
289 0x3b, 0x02, 0x62, 0x11, 0x64, 0x31, 0xc4, 0x3a, 0xf8, 0xeb, 0x08, 0xf5, 0xa8,
290 0x83, 0x01, 0x05, 0x7c, 0xf1, 0xc1, 0x56, 0xa2, 0xa5, 0x19, 0x3c, 0x14, 0x3e,
291 0x7a, 0x5b, 0x03, 0xfa, 0xc1, 0x32, 0xb7, 0xe8, 0x9e, 0x6d, 0xcd, 0x8f, 0x4c,
292 0x82, 0xc9, 0xb2, 0x84, 0x52, 0x32, 0x9c, 0x26, 0x0d, 0x30, 0xbc, 0x39, 0xb3,
293 0x81, 0x6b, 0x7c, 0x46, 0xb4, 0x1b, 0x37, 0xb4, 0x85, 0x0d, 0x2a, 0xe7, 0x4e,
294 0x72, 0x9f, 0x99, 0xc6, 0x62, 0x1f, 0xbb, 0xe2, 0xe4, 0x68, 0x72},
296 {0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
297 0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10,
298 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad},
299 32, 1024, PSA_ERROR_NOT_PERMITTED
306 #ifdef ARCH_TEST_RSA_PKCS1V15_CRYPT 307 #ifdef ARCH_TEST_RSA_1024 308 {
"Test psa_asymmetric_decrypt - Negative case\n", 1, PSA_KEY_TYPE_RSA_KEYPAIR,
309 {0}, 610, PSA_KEY_USAGE_DECRYPT, PSA_ALG_RSA_PKCS1V15_CRYPT,
311 {0x99, 0xff, 0xde, 0x2f, 0xcc, 0x00, 0xc9, 0xcc, 0x01, 0x97, 0x2e, 0xbf, 0xa7,
312 0x77, 0x9b, 0x29, 0x8d, 0xbb, 0xaf, 0x7f, 0x50, 0x70, 0x7a, 0x74, 0x05, 0x29,
313 0x6d, 0xd2, 0x78, 0x34, 0x56, 0xfc, 0x79, 0x20, 0x02, 0xf4, 0x62, 0xe7, 0x60,
314 0x50, 0x0e, 0x02, 0xaf, 0xa2, 0x5a, 0x85, 0x9a, 0xce, 0x87, 0x01, 0xcb, 0x5d,
315 0x3b, 0x02, 0x62, 0x11, 0x64, 0x31, 0xc4, 0x3a, 0xf8, 0xeb, 0x08, 0xf5, 0xa8,
316 0x83, 0x01, 0x05, 0x7c, 0xf1, 0xc1, 0x56, 0xa2, 0xa5, 0x19, 0x3c, 0x14, 0x3e,
317 0x7a, 0x5b, 0x03, 0xfa, 0xc1, 0x32, 0xb7, 0xe8, 0x9e, 0x6d, 0xcd, 0x8f, 0x4c,
318 0x82, 0xc9, 0xb2, 0x84, 0x52, 0x32, 0x9c, 0x26, 0x0d, 0x30, 0xbc, 0x39, 0xb3,
319 0x81, 0x6b, 0x7c, 0x46, 0xb4, 0x1b, 0x37, 0xb4, 0x85, 0x0d, 0x2a, 0xe7, 0x4e,
320 0x72, 0x9f, 0x99, 0xc6, 0x62, 0x1f, 0xbb, 0xe2, 0xe4, 0x68, 0x72},
322 {0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d,
323 0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10,
324 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad},
325 32, 1024, PSA_SUCCESS
Copyright (c) 2018-2019, Arm Limited or its affiliates.