Migrate UI cleanup phase 4 from MIPS into ARM
[tomato.git] / release / src-rt-6.x.4708 / bcmcrypto / aeskeywrap_vectors.h
blobfeb12ea4d6a1c6c9472b40c9618e6d423280e137
1 /*
2 * aeskeywrap_vectors.h
3 * AES keywrap test vectors
5 * Copyright (C) 2012, Broadcom Corporation
6 * All Rights Reserved.
7 *
8 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
9 * the contents of this file may not be disclosed to third parties, copied
10 * or duplicated in any form, in whole or in part, without the prior
11 * written permission of Broadcom Corporation.
13 * $Id: aeskeywrap_vectors.h 241182 2011-02-17 21:50:03Z $
16 #include <typedefs.h>
17 #include <bcmcrypto/aeskeywrap.h>
19 /* Test vector data from:
20 * RFC3394 Advanced Encryption Standard (AES) Key Wrap Algorithm
21 * Copyright (C) The Internet Society (2002). All Rights Reserved.
24 /* 4.1 Wrap 128 bits of Key Data with a 128-bit KEK */
25 uint8 key_00[] = {
26 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
27 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
30 uint8 input_00[] = {
31 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
32 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
35 uint8 ref_00[] = {
36 0x1F, 0xA6, 0x8B, 0x0A, 0x81, 0x12, 0xB4, 0x47,
37 0xAE, 0xF3, 0x4B, 0xD8, 0xFB, 0x5A, 0x7B, 0x82,
38 0x9D, 0x3E, 0x86, 0x23, 0x71, 0xD2, 0xCF, 0xE5
41 /* 4.2 Wrap 128 bits of Key Data with a 192-bit KEK */
42 uint8 key_01[] = {
43 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
44 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
45 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17
48 uint8 input_01[] = {
49 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
50 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
53 uint8 ref_01[] = {
54 0x96, 0x77, 0x8B, 0x25, 0xAE, 0x6C, 0xA4, 0x35,
55 0xF9, 0x2B, 0x5B, 0x97, 0xC0, 0x50, 0xAE, 0xD2,
56 0x46, 0x8A, 0xB8, 0xA1, 0x7A, 0xD8, 0x4E, 0x5D
59 /* 4.3 Wrap 128 bits of Key Data with a 256-bit KEK */
60 uint8 key_02[] = {
61 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
62 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
63 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
64 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F
67 uint8 input_02[] = {
68 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
69 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
72 uint8 ref_02[] = {
73 0x64, 0xE8, 0xC3, 0xF9, 0xCE, 0x0F, 0x5B, 0xA2,
74 0x63, 0xE9, 0x77, 0x79, 0x05, 0x81, 0x8A, 0x2A,
75 0x93, 0xC8, 0x19, 0x1E, 0x7D, 0x6E, 0x8A, 0xE7
78 /* 4.4 Wrap 192 bits of Key Data with a 192-bit KEK */
79 uint8 key_03[] = {
80 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
81 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
82 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17
85 uint8 input_03[] = {
86 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
87 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
88 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
91 uint8 ref_03[] = {
92 0x03, 0x1D, 0x33, 0x26, 0x4E, 0x15, 0xD3, 0x32,
93 0x68, 0xF2, 0x4E, 0xC2, 0x60, 0x74, 0x3E, 0xDC,
94 0xE1, 0xC6, 0xC7, 0xDD, 0xEE, 0x72, 0x5A, 0x93,
95 0x6B, 0xA8, 0x14, 0x91, 0x5C, 0x67, 0x62, 0xD2
98 /* 4.5 Wrap 192 bits of Key Data with a 256-bit KEK */
99 uint8 key_04[] = {
100 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
101 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
102 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
103 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F
106 uint8 input_04[] = {
107 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
108 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
109 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
112 uint8 ref_04[] = {
113 0xA8, 0xF9, 0xBC, 0x16, 0x12, 0xC6, 0x8B, 0x3F,
114 0xF6, 0xE6, 0xF4, 0xFB, 0xE3, 0x0E, 0x71, 0xE4,
115 0x76, 0x9C, 0x8B, 0x80, 0xA3, 0x2C, 0xB8, 0x95,
116 0x8C, 0xD5, 0xD1, 0x7D, 0x6B, 0x25, 0x4D, 0xA1
119 /* 4.6 Wrap 256 bits of Key Data with a 256-bit KEK */
120 uint8 key_05[] = {
121 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
122 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
123 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
124 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F
127 uint8 input_05[] = {
128 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
129 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
130 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
131 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
134 uint8 ref_05[] = {
135 0x28, 0xC9, 0xF4, 0x04, 0xC4, 0xB8, 0x10, 0xF4,
136 0xCB, 0xCC, 0xB3, 0x5C, 0xFB, 0x87, 0xF8, 0x26,
137 0x3F, 0x57, 0x86, 0xE2, 0xD8, 0x0E, 0xD3, 0x26,
138 0xCB, 0xC7, 0xF0, 0xE7, 0x1A, 0x99, 0xF4, 0x3B,
139 0xFB, 0x98, 0x8B, 0x9B, 0x7A, 0x02, 0xDD, 0x21
142 /* Test vectors generated at Broadcom */
143 /* Wrap 256 bits of Key Data with a 128-bit KEK */
144 uint8 key_06[] = {
145 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
146 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
149 uint8 input_06[] = {
150 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
151 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
152 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
153 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
156 uint8 ref_06[] = {
157 0x11, 0x82, 0x68, 0x40, 0x77, 0x4D, 0x99, 0x3F,
158 0xF9, 0xC2, 0xFA, 0x02, 0xCC, 0xA3, 0xCE, 0xA0,
159 0xE9, 0x3B, 0x1E, 0x1C, 0xF9, 0x63, 0x61, 0xF9,
160 0x3E, 0xA6, 0xDC, 0x2F, 0x34, 0x51, 0x94, 0xE7,
161 0xB3, 0x0F, 0x96, 0x4C, 0x79, 0xF9, 0xE6, 0x1D
164 /* aes_wrap failure test 1: input too long */
165 uint8 key_10[] = {
166 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
167 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
170 uint8 input_10[AKW_MAX_WRAP_LEN+1];
172 uint8 ref_10[] = "";
174 /* aes_wrap failure test 1: input length not multiple of block length */
175 uint8 key_11[] = {
176 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
177 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
180 uint8 input_11[] = {
181 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
182 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
183 0x00
186 uint8 ref_11[] = "";
188 /* aes_unwrap failure test 0: input too long */
189 uint8 key_20[] = {
190 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
191 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
194 uint8 input_20[AKW_MAX_WRAP_LEN+1];
196 uint8 ref_20[] = "";
198 /* aes_unwrap failure test 1: input length not multiple of block length */
199 uint8 key_21[] = {
200 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
201 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
204 uint8 input_21[] = {
205 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
206 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
207 0x00
210 uint8 ref_21[] = "";
212 /* aes_unwrap failure test 2: unwraped data incorrect */
213 uint8 key_22[] = {
214 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
215 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
218 uint8 input_22[] = {
219 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
220 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
223 uint8 ref_22[] = "";
226 typedef struct {
227 int kl;
228 uint8 *key;
229 int il;
230 uint8 *input;
231 uint8 *ref;
232 } akw_vector_t;
234 #define AKW_VECTOR_ENTRY(x) \
235 { sizeof(key_##x), key_##x, sizeof(input_##x), input_##x, ref_##x }
237 akw_vector_t akw_vec[] = {
238 AKW_VECTOR_ENTRY(00),
239 AKW_VECTOR_ENTRY(01),
240 AKW_VECTOR_ENTRY(02),
241 AKW_VECTOR_ENTRY(03),
242 AKW_VECTOR_ENTRY(04),
243 AKW_VECTOR_ENTRY(05),
244 AKW_VECTOR_ENTRY(06)
247 akw_vector_t akw_wrap_fail_vec[] = {
248 AKW_VECTOR_ENTRY(10),
249 AKW_VECTOR_ENTRY(11)
252 akw_vector_t akw_unwrap_fail_vec[] = {
253 AKW_VECTOR_ENTRY(20),
254 AKW_VECTOR_ENTRY(21),
255 AKW_VECTOR_ENTRY(22)