Mistake on this page?
Report an issue in GitHub or email us
compliance_crypto/test_c030/test_data.h
Go to the documentation of this file.
1 /** @file
2  * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
3  * SPDX-License-Identifier : Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16 **/
17 
18 #include "val_crypto.h"
19 
20 typedef struct {
21  char test_desc[75];
22  psa_key_handle_t key_handle;
23  psa_key_type_t key_type;
24  uint8_t key_data[64];
25  uint32_t key_length;
26  uint8_t data[16];
27  size_t data_size;
28  uint8_t expected_mac[64];
29  size_t mac_size;
30  psa_key_usage_t usage;
31  psa_algorithm_t key_alg;
32  psa_status_t expected_status;
33 } test_data;
34 
35 static test_data check1[] = {
36 #ifdef ARCH_TEST_HMAC
37 #ifdef ARCH_TEST_SHA224
38 {"Test psa_mac_verify_finish HMAC SHA 224\n", 1, PSA_KEY_TYPE_HMAC,
39 {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
40  0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
41 {0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
42 {0x89, 0x6f, 0xb1, 0x12, 0x8a, 0xbb, 0xdf, 0x19, 0x68, 0x32, 0x10, 0x7c, 0xd4,
43  0x9d, 0xf3, 0x3f, 0x47, 0xb4, 0xb1, 0x16, 0x99, 0x12, 0xba, 0x4f, 0x53, 0x68,
44  0x4b, 0x22}, 28,
45  PSA_KEY_USAGE_VERIFY, PSA_ALG_HMAC(PSA_ALG_SHA_224),
46  PSA_SUCCESS
47 },
48 #endif
49 
50 #ifdef ARCH_TEST_SHA256
51 {"Test psa_mac_verify_finish HMAC SHA 256\n", 2, PSA_KEY_TYPE_HMAC,
52 {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
53  0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
54 {0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
55 {0xb0, 0x34, 0x4c, 0x61, 0xd8, 0xdb, 0x38, 0x53, 0x5c, 0xa8, 0xaf, 0xce, 0xaf,
56  0x0b, 0xf1, 0x2b, 0x88, 0x1d, 0xc2, 0x00, 0xc9, 0x83, 0x3d, 0xa7, 0x26, 0xe9,
57  0x37, 0x6c, 0x2e, 0x32, 0xcf, 0xf7}, 32,
58  PSA_KEY_USAGE_VERIFY, PSA_ALG_HMAC(PSA_ALG_SHA_256),
59  PSA_SUCCESS
60 },
61 #endif
62 
63 #ifdef ARCH_TEST_SHA512
64 {"Test psa_mac_verify_finish HMAC SHA 512\n", 3, PSA_KEY_TYPE_HMAC,
65 {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
66  0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
67 {0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
68 {0x87, 0xaa, 0x7c, 0xde, 0xa5, 0xef, 0x61, 0x9d, 0x4f, 0xf0, 0xb4, 0x24, 0x1a,
69  0x1d, 0x6c, 0xb0, 0x23, 0x79, 0xf4, 0xe2, 0xce, 0x4e, 0xc2, 0x78, 0x7a, 0xd0,
70  0xb3, 0x05, 0x45, 0xe1, 0x7c, 0xde, 0xda, 0xa8, 0x33, 0xb7, 0xd6, 0xb8, 0xa7,
71  0x02, 0x03, 0x8b, 0x27, 0x4e, 0xae, 0xa3, 0xf4, 0xe4, 0xbe, 0x9d, 0x91, 0x4e,
72  0xeb, 0x61, 0xf1, 0x70, 0x2e, 0x69, 0x6c, 0x20, 0x3a, 0x12, 0x68, 0x54}, 64,
73  PSA_KEY_USAGE_VERIFY, PSA_ALG_HMAC(PSA_ALG_SHA_512),
74  PSA_SUCCESS
75 },
76 #endif
77 
78 #ifdef ARCH_TEST_SHA224
79 {"Test psa_mac_verify_finish HMAC SHA 224 (truncated to 8 Byte)\n", 4, PSA_KEY_TYPE_HMAC,
80 {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
81  0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
82 {0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
83 {0x89, 0x6f, 0xb1, 0x12, 0x8a, 0xbb, 0xdf, 0x19, 0x68}, 8,
84  PSA_KEY_USAGE_VERIFY, PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_224), 8),
85  PSA_SUCCESS
86 },
87 #endif
88 #endif
89 
90 #ifdef ARCH_TEST_AES_128
91 #ifdef ARCH_TEST_CMAC
92 {"Test psa_mac_verify_finish CMAC AES 128\n", 5, PSA_KEY_TYPE_AES,
93 {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09,
94  0xcf, 0x4f, 0x3c}, 16,
95 {0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
96 {0x9A, 0x8F, 0xFF, 0x8D, 0xA3, 0x5B, 0x97, 0xCB, 0x4C, 0x95, 0xF0, 0xFA, 0x6A,
97  0xE7, 0xE0, 0x77}, 16,
98  PSA_KEY_USAGE_VERIFY, PSA_ALG_CMAC,
99  PSA_SUCCESS
100 },
101 #endif
102 #endif
103 
104 #ifdef ARCH_TEST_HMAC
105 #ifdef ARCH_TEST_SHA256
106 {"Test psa_mac_verify_finish small size buffer\n", 6, PSA_KEY_TYPE_HMAC,
107 {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
108  0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
109 {0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
110 {0xb0, 0x34, 0x4c, 0x61, 0xd8, 0xdb, 0x38, 0x53, 0x5c, 0xa8, 0xaf, 0xce, 0xaf,
111  0x0b, 0xf1, 0x2b, 0x88, 0x1d, 0xc2, 0x00, 0xc9, 0x83, 0x3d, 0xa7, 0x26, 0xe9,
112  0x37, 0x6c, 0x2e, 0x32, 0xcf, 0xf7}, 30,
113  PSA_KEY_USAGE_VERIFY, PSA_ALG_HMAC(PSA_ALG_SHA_256),
114  PSA_ERROR_INVALID_SIGNATURE
115 },
116 #endif
117 
118 #ifdef ARCH_TEST_SHA224
119 {"Test psa_mac_verify_finish incorrect expected MAC\n", 7, PSA_KEY_TYPE_HMAC,
120 {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
121  0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}, 20,
122 {0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65}, 8,
123 {0x89, 0x6f, 0xb1, 0x12, 0x8a, 0xbb, 0xdf, 0x19, 0x68, 0x32, 0x10, 0x7c, 0xd4,
124  0x9d, 0xf3, 0x3f, 0x47, 0xb4, 0xb1, 0x16, 0x99, 0x12, 0xba, 0x4f, 0x53, 0x68,
125  0x4b, 0x20}, 28,
126  PSA_KEY_USAGE_VERIFY, PSA_ALG_HMAC(PSA_ALG_SHA_224),
127  PSA_ERROR_INVALID_SIGNATURE
128 },
129 #endif
130 #endif
131 };
Copyright (c) 2018-2019, Arm Limited or its affiliates.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.