22 psa_key_handle_t key_handle;
23 psa_key_type_t key_type;
28 uint8_t expected_data[64];
30 size_t expected_length;
31 psa_key_usage_t usage;
32 psa_algorithm_t key_alg;
33 psa_status_t expected_status;
38 #ifdef ARCH_TEST_SHA224 39 {
"Test psa_mac_sign_finish HMAC SHA 224\n", 1, PSA_KEY_TYPE_HMAC,
40 {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
41 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
42 {0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
43 {0x89, 0x6f, 0xb1, 0x12, 0x8a, 0xbb, 0xdf, 0x19, 0x68, 0x32, 0x10, 0x7c, 0xd4,
44 0x9d, 0xf3, 0x3f, 0x47, 0xb4, 0xb1, 0x16, 0x99, 0x12, 0xba, 0x4f, 0x53, 0x68,
46 PSA_KEY_USAGE_SIGN, PSA_ALG_HMAC(PSA_ALG_SHA_224),
51 #ifdef ARCH_TEST_SHA256 52 {
"Test psa_mac_sign_finish HMAC SHA 256\n", 2, PSA_KEY_TYPE_HMAC,
53 {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
54 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
55 {0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
56 {0xb0, 0x34, 0x4c, 0x61, 0xd8, 0xdb, 0x38, 0x53, 0x5c, 0xa8, 0xaf, 0xce, 0xaf,
57 0x0b, 0xf1, 0x2b, 0x88, 0x1d, 0xc2, 0x00, 0xc9, 0x83, 0x3d, 0xa7, 0x26, 0xe9,
58 0x37, 0x6c, 0x2e, 0x32, 0xcf, 0xf7}, 64, 32,
59 PSA_KEY_USAGE_SIGN, PSA_ALG_HMAC(PSA_ALG_SHA_256),
64 #ifdef ARCH_TEST_SHA512 65 {
"Test psa_mac_sign_finish HMAC SHA 512\n", 3, PSA_KEY_TYPE_HMAC,
66 {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
67 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
68 {0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
69 {0x87, 0xaa, 0x7c, 0xde, 0xa5, 0xef, 0x61, 0x9d, 0x4f, 0xf0, 0xb4, 0x24, 0x1a,
70 0x1d, 0x6c, 0xb0, 0x23, 0x79, 0xf4, 0xe2, 0xce, 0x4e, 0xc2, 0x78, 0x7a, 0xd0,
71 0xb3, 0x05, 0x45, 0xe1, 0x7c, 0xde, 0xda, 0xa8, 0x33, 0xb7, 0xd6, 0xb8, 0xa7,
72 0x02, 0x03, 0x8b, 0x27, 0x4e, 0xae, 0xa3, 0xf4, 0xe4, 0xbe, 0x9d, 0x91, 0x4e,
73 0xeb, 0x61, 0xf1, 0x70, 0x2e, 0x69, 0x6c, 0x20, 0x3a, 0x12, 0x68, 0x54}, 64, 64,
74 PSA_KEY_USAGE_SIGN, PSA_ALG_HMAC(PSA_ALG_SHA_512),
79 #ifdef ARCH_TEST_SHA224 80 {
"Test psa_mac_sign_finish HMAC SHA 224 (truncated to 8 Byte)\n", 4, PSA_KEY_TYPE_HMAC,
81 {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
82 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
83 {0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
84 {0x89, 0x6f, 0xb1, 0x12, 0x8a, 0xbb, 0xdf, 0x19, 0x68}, 64, 8,
85 PSA_KEY_USAGE_SIGN, PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_224), 8),
91 #ifdef ARCH_TEST_AES_128 93 {
"Test psa_mac_sign_finish CMAC AES 128\n", 5, PSA_KEY_TYPE_AES,
94 {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
95 0xcf, 0x4f, 0x3c}, 16,
96 {0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
97 {0x9A, 0x8F, 0xFF, 0x8D, 0xA3, 0x5B, 0x97, 0xCB, 0x4C, 0x95, 0xF0, 0xFA, 0x6A,
98 0xE7, 0xE0, 0x77}, 64, 16,
99 PSA_KEY_USAGE_SIGN, PSA_ALG_CMAC,
103 {
"Test psa_mac_sign_finish small size buffer\n", 6, PSA_KEY_TYPE_AES,
104 {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
105 0xcf, 0x4f, 0x3c}, 16,
106 {0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
107 {0x9A, 0x8F, 0xFF, 0x8D, 0xA3, 0x5B, 0x97, 0xCB, 0x4C, 0x95, 0xF0, 0xFA, 0x6A,
108 0xE7, 0xE0, 0x77}, 8, 16,
109 PSA_KEY_USAGE_SIGN, PSA_ALG_CMAC,
110 PSA_ERROR_BUFFER_TOO_SMALL
Copyright (c) 2018-2019, Arm Limited or its affiliates.