3 * AES keywrap test vectors
5 * Copyright (C) 2012, Broadcom Corporation
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 $
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 */
26 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
27 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
31 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
32 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
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 */
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
49 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
50 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
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 */
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
68 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
69 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
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 */
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
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
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 */
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
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
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 */
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
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
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 */
145 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
146 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
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
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 */
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];
174 /* aes_wrap failure test 1: input length not multiple of block length */
176 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
177 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
181 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
182 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
188 /* aes_unwrap failure test 0: input too long */
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];
198 /* aes_unwrap failure test 1: input length not multiple of block length */
200 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
201 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
205 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
206 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
212 /* aes_unwrap failure test 2: unwraped data incorrect */
214 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
215 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
219 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
220 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
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),
247 akw_vector_t akw_wrap_fail_vec
[] = {
248 AKW_VECTOR_ENTRY(10),
252 akw_vector_t akw_unwrap_fail_vec
[] = {
253 AKW_VECTOR_ENTRY(20),
254 AKW_VECTOR_ENTRY(21),