Mistake on this page?
Report an issue in GitHub or email us
compliance_crypto/test_c018/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[32];
25  uint32_t key_length;
26  psa_key_usage_t usage;
27  psa_algorithm_t key_alg;
28  uint8_t salt[16];
29  size_t salt_length;
30  uint8_t label[16];
31  size_t label_length;
32  size_t capacity;
33  size_t size;
34  psa_status_t expected_status;
35 } test_data;
36 
37 static test_data check1[] = {
38 /* Covers the following cases
39  * - 16 Byte key
40  * - SHA 256
41  * - Output size less than generator capacity
42  */
43 #ifdef ARCH_TEST_HKDF
44 #ifdef ARCH_TEST_SHA256
45 {"Test psa_generator_read to get 16 Byte data with SHA-256\n", 1, PSA_KEY_TYPE_DERIVE,
46 {0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
47  0x5F, 0xC9},
48  AES_16B_KEY_SIZE, PSA_KEY_USAGE_DERIVE, PSA_ALG_HKDF(PSA_ALG_SHA_256),
49  {0}, 0, {0}, 0, 32,
50  16, PSA_SUCCESS
51 },
52 #endif
53 /* Covers the following cases
54  * - 32 Byte key
55  * - SHA 512
56  * - Output size equal to generator capacity
57  */
58 #ifdef ARCH_TEST_SHA512
59 {"Test psa_generator_read to get 32 Byte data with SHA-512\n", 2, PSA_KEY_TYPE_DERIVE,
60 {0xEA, 0xD5, 0xE6, 0xC8, 0x51, 0xF9, 0xEC, 0xBB, 0x9B, 0x57, 0x7C, 0xED, 0xD2,
61  0x4B, 0x82, 0x84, 0x9F, 0x9F, 0xE6, 0x73, 0x21, 0x3D, 0x1A, 0x05, 0xC9, 0xED,
62  0xDF, 0x25, 0x17, 0x68, 0x86, 0xAE},
63  AES_32B_KEY_SIZE, PSA_KEY_USAGE_DERIVE, PSA_ALG_HKDF(PSA_ALG_SHA_512),
64  {0}, 0, {0}, 0, 64,
65  64, PSA_SUCCESS
66 },
67 #endif
68 
69 /* Covers the following cases
70  * - 8 Byte Key
71  * - SHA 1
72  * - Output size greater than the generator capacity
73  */
74 #ifdef ARCH_TEST_SHA1
75 {"Test psa_generator_read to get 8 Byte data with SHA-1\n", 3, PSA_KEY_TYPE_DERIVE,
76 {0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
77  DES_8B_KEY_SIZE, PSA_KEY_USAGE_DERIVE, PSA_ALG_HKDF(PSA_ALG_SHA_1),
78  {0}, 0, {0}, 0, 64,
79  70, PSA_ERROR_INSUFFICIENT_CAPACITY
80 },
81 
82 {"Test psa_generator_read to request maximum capacity\n", 4, PSA_KEY_TYPE_DERIVE,
83 {0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
84  DES_8B_KEY_SIZE, PSA_KEY_USAGE_DERIVE, PSA_ALG_HKDF(PSA_ALG_SHA_1),
85  {0}, 0, {0}, 0, (255 * 20),
86  (255 * 20), PSA_SUCCESS
87 },
88 
89 {"Test psa_generator_read to request maximum capacity +1\n", 5, PSA_KEY_TYPE_DERIVE,
90 {0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
91  DES_8B_KEY_SIZE, PSA_KEY_USAGE_DERIVE, PSA_ALG_HKDF(PSA_ALG_SHA_1),
92  {0}, 0, {0}, 0, (255 * 20),
93  ((255 * 20) + 1), PSA_ERROR_INSUFFICIENT_CAPACITY
94 },
95 #endif
96 #endif
97 };
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.