Mistake on this page?
Report an issue in GitHub or email us
compliance_crypto/test_c028/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_data[64];
29  size_t mac_size;
30  size_t expected_length;
31  psa_key_usage_t usage;
32  psa_algorithm_t key_alg;
33  psa_status_t expected_status;
34 } test_data;
35 
36 static test_data check1[] = {
37 #ifdef ARCH_TEST_HMAC
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,
45  0x4b, 0x22}, 64, 28,
46  PSA_KEY_USAGE_SIGN, PSA_ALG_HMAC(PSA_ALG_SHA_224),
47  PSA_SUCCESS
48 },
49 #endif
50 
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),
60  PSA_SUCCESS
61 },
62 #endif
63 
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),
75  PSA_SUCCESS
76 },
77 #endif
78 
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),
86  PSA_SUCCESS
87 },
88 #endif
89 #endif
90 
91 #ifdef ARCH_TEST_AES_128
92 #ifdef ARCH_TEST_CMAC
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,
100  PSA_SUCCESS
101 },
102 
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
111 },
112 #endif
113 #endif
114 };
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.