Mistake on this page?
Report an issue in GitHub or email us
compliance_crypto/test_c034/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  size_t iv_size;
29  size_t expected_iv_length;
30  psa_status_t expected_status;
31 } test_data;
32 
33 static test_data check1[] = {
34 #ifdef ARCH_TEST_CIPER_MODE_CTR
35 #ifdef ARCH_TEST_AES_128
36 {"Test psa_cipher_generate_iv 16 Byte AES\n", 1, PSA_KEY_TYPE_AES,
37 {0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
38  0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE,
39  PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR, 16, 16,
40  PSA_SUCCESS
41 },
42 #endif
43 
44 #ifdef ARCH_TEST_AES_192
45 {"Test psa_cipher_generate_iv 24 Byte AES\n", 2, PSA_KEY_TYPE_AES,
46 {0x24, 0x13, 0x61, 0x47, 0x61, 0xB8, 0xC8, 0xF0, 0xDF, 0xAB, 0x5A, 0x0E, 0x87,
47  0x40, 0xAC, 0xA3, 0x90, 0x77, 0x83, 0x52, 0x31, 0x74, 0xF9}, AES_24B_KEY_SIZE,
48  PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR, 16, 16,
49  PSA_SUCCESS
50 },
51 #endif
52 
53 #ifdef ARCH_TEST_AES_256
54 {"Test psa_cipher_generate_iv 32 Byte AES\n", 3, PSA_KEY_TYPE_AES,
55 {0xEA, 0xD5, 0xE6, 0xC8, 0x51, 0xF9, 0xEC, 0xBB, 0x9B, 0x57, 0x7C, 0xED, 0xD2,
56  0x4B, 0x82, 0x84, 0x9F, 0x9F, 0xE6, 0x73, 0x21, 0x3D, 0x1A, 0x05, 0xC9, 0xED,
57  0xDF, 0x25, 0x17, 0x68, 0x86, 0xAE}, AES_32B_KEY_SIZE,
58  PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR, 16, 16,
59  PSA_SUCCESS
60 },
61 #endif
62 #endif
63 
64 #ifdef ARCH_TEST_CBC_NO_PADDING
65 #ifdef ARCH_TEST_DES_1KEY
66 {"Test psa_cipher_generate_iv DES 64 bit key\n", 4, PSA_KEY_TYPE_DES,
67  {0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
68  DES_8B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
69  8, 8,
70  PSA_SUCCESS
71 },
72 #endif
73 
74 #ifdef ARCH_TEST_DES_2KEY
75 {"Test psa_cipher_generate_iv Triple DES 2-Key\n", 5, PSA_KEY_TYPE_DES,
76 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
77  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
78  DES3_2KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
79  8, 8,
80  PSA_SUCCESS
81 },
82 #endif
83 
84 #ifdef ARCH_TEST_DES_3KEY
85 {"Test psa_cipher_generate_iv Triple DES 3-Key\n", 6, PSA_KEY_TYPE_DES,
86 {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
87  0xF1, 0xE0, 0xD3, 0xC2, 0xB5, 0xA4, 0x97, 0x86,
88  0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10},
89  DES3_3KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
90  8, 8,
91  PSA_SUCCESS
92 },
93 #endif
94 #endif
95 
96 #ifdef ARCH_TEST_CIPER_MODE_CTR
97 #ifdef ARCH_TEST_AES_128
98 {"Test psa_cipher_generate_iv AES - small iv buffer\n", 7, PSA_KEY_TYPE_AES,
99 {0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
100  0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE,
101  PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR, 8, 16,
102  PSA_ERROR_BUFFER_TOO_SMALL
103 },
104 #endif
105 #endif
106 
107 #ifdef ARCH_TEST_CBC_NO_PADDING
108 #ifdef ARCH_TEST_DES_1KEY
109 {"Test psa_cipher_generate_iv DES - small iv buffer\n", 8, PSA_KEY_TYPE_DES,
110  {0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
111  DES_8B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
112  4, 8,
113  PSA_ERROR_BUFFER_TOO_SMALL
114 },
115 #endif
116 #endif
117 
118 #ifdef ARCH_TEST_CIPER_MODE_CTR
119 #ifdef ARCH_TEST_AES_128
120 {"Test psa_cipher_generate_iv AES - large iv buffer\n", 9, PSA_KEY_TYPE_AES,
121 {0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
122  0x5F, 0xC9, 0xD0}, AES_16B_KEY_SIZE,
123  PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CTR, 32, 16,
124  PSA_SUCCESS
125 },
126 #endif
127 #endif
128 
129 #ifdef ARCH_TEST_CBC_NO_PADDING
130 #ifdef ARCH_TEST_DES_1KEY
131 {"Test psa_cipher_generate_iv DES - large iv buffer\n", 10, PSA_KEY_TYPE_DES,
132  {0x70, 0x24, 0x55, 0x0C, 0x14, 0x9D, 0xED, 0x29},
133  DES_8B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CBC_NO_PADDING,
134  16, 8,
135  PSA_SUCCESS
136 },
137 #endif
138 #endif
139 };
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.