cryptodev: fix KASUMI F9 expected parameters
[dpdk.git] / test / test / test_cryptodev_kasumi_hash_test_vectors.h
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) 2016-2017 Intel Corporation. All rights reserved.
5  *
6  *   Redistribution and use in source and binary forms, with or without
7  *   modification, are permitted provided that the following conditions
8  *   are met:
9  *
10  *       * Redistributions of source code must retain the above copyright
11  *         notice, this list of conditions and the following disclaimer.
12  *       * Redistributions in binary form must reproduce the above copyright
13  *         notice, this list of conditions and the following disclaimer in
14  *         the documentation and/or other materials provided with the
15  *         distribution.
16  *       * Neither the name of Intel Corporation nor the names of its
17  *         contributors may be used to endorse or promote products derived
18  *         from this software without specific prior written permission.
19  *
20  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33 #ifndef TEST_CRYPTODEV_KASUMI_HASH_TEST_VECTORS_H_
34 #define TEST_CRYPTODEV_KASUMI_HASH_TEST_VECTORS_H_
35
36 struct kasumi_hash_test_data {
37         struct {
38                 uint8_t data[16];
39                 unsigned len;
40         } key;
41
42         /*
43          * Includes COUNT (4 bytes), FRESH (4 bytes), message
44          * and DIRECTION (1 bit), plus 1 0*, with enough 0s,
45          * so total length is multiple of 8 or 64 bits
46          */
47         struct {
48                 uint8_t data[2056];
49                 unsigned len; /* length must be in Bits */
50         } plaintext;
51
52         struct {
53                 uint8_t data[64];
54                 unsigned len;
55         } digest;
56 };
57
58 struct kasumi_hash_test_data kasumi_hash_test_case_1 = {
59         .key = {
60                 .data = {
61                         0x2B, 0xD6, 0x45, 0x9F, 0x82, 0xC5, 0xB3, 0x00,
62                         0x95, 0x2C, 0x49, 0x10, 0x48, 0x81, 0xFF, 0x48
63                 },
64                 .len = 16
65         },
66         .plaintext = {
67                 .data = {
68                         0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49,
69                         0x6B, 0x22, 0x77, 0x37, 0x29, 0x6F, 0x39, 0x3C,
70                         0x80, 0x79, 0x35, 0x3E, 0xDC, 0x87, 0xE2, 0xE8,
71                         0x05, 0xD2, 0xEC, 0x49, 0xA4, 0xF2, 0xD8, 0xE2
72                 },
73                 .len = 256
74         },
75         .digest = {
76                 .data = {0xF6, 0x3B, 0xD7, 0x2C},
77                 .len  = 4
78         }
79 };
80
81 struct kasumi_hash_test_data kasumi_hash_test_case_2 = {
82         .key = {
83                 .data = {
84                         0xD4, 0x2F, 0x68, 0x24, 0x28, 0x20, 0x1C, 0xAF,
85                         0xCD, 0x9F, 0x97, 0x94, 0x5E, 0x6D, 0xE7, 0xB7
86                 },
87                 .len = 16
88         },
89         .plaintext = {
90                 .data = {
91                         0x3E, 0xDC, 0x87, 0xE2, 0xA4, 0xF2, 0xD8, 0xE2,
92                         0xB5, 0x92, 0x43, 0x84, 0x32, 0x8A, 0x4A, 0xE0,
93                         0x0B, 0x73, 0x71, 0x09, 0xF8, 0xB6, 0xC8, 0xDD,
94                         0x2B, 0x4D, 0xB6, 0x3D, 0xD5, 0x33, 0x98, 0x1C,
95                         0xEB, 0x19, 0xAA, 0xD5, 0x2A, 0x5B, 0x2B, 0xC3
96                 },
97                 .len = 320
98         },
99         .digest = {
100                 .data = {0xA9, 0xDA, 0xF1, 0xFF},
101                 .len  = 4
102         }
103 };
104
105 struct kasumi_hash_test_data kasumi_hash_test_case_3 = {
106         .key = {
107                 .data = {
108                         0xFD, 0xB9, 0xCF, 0xDF, 0x28, 0x93, 0x6C, 0xC4,
109                         0x83, 0xA3, 0x18, 0x69, 0xD8, 0x1B, 0x8F, 0xAB
110                 },
111                 .len = 16
112         },
113         .plaintext = {
114                 .data = {
115                         0x36, 0xAF, 0x61, 0x44, 0x98, 0x38, 0xF0, 0x3A,
116                         0x59, 0x32, 0xBC, 0x0A, 0xCE, 0x2B, 0x0A, 0xBA,
117                         0x33, 0xD8, 0xAC, 0x18, 0x8A, 0xC5, 0x4F, 0x34,
118                         0x6F, 0xAD, 0x10, 0xBF, 0x9D, 0xEE, 0x29, 0x20,
119                         0xB4, 0x3B, 0xD0, 0xC5, 0x3A, 0x91, 0x5C, 0xB7,
120                         0xDF, 0x6C, 0xAA, 0x72, 0x05, 0x3A, 0xBF, 0xF3,
121                         0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
122                 },
123                 .len = 448
124         },
125         .digest = {
126                 .data = {0x15, 0x37, 0xD3, 0x16},
127                 .len  = 4
128         }
129 };
130
131 struct kasumi_hash_test_data kasumi_hash_test_case_4 = {
132         .key = {
133                 .data = {
134                         0xC7, 0x36, 0xC6, 0xAA, 0xB2, 0x2B, 0xFF, 0xF9,
135                         0x1E, 0x26, 0x98, 0xD2, 0xE2, 0x2A, 0xD5, 0x7E
136                 },
137         .len = 16
138         },
139         .plaintext = {
140                 .data = {
141                         0x14, 0x79, 0x3E, 0x41, 0x03, 0x97, 0xE8, 0xFD,
142                         0xD0, 0xA7, 0xD4, 0x63, 0xDF, 0x9F, 0xB2, 0xB2,
143                         0x78, 0x83, 0x3F, 0xA0, 0x2E, 0x23, 0x5A, 0xA1,
144                         0x72, 0xBD, 0x97, 0x0C, 0x14, 0x73, 0xE1, 0x29,
145                         0x07, 0xFB, 0x64, 0x8B, 0x65, 0x99, 0xAA, 0xA0,
146                         0xB2, 0x4A, 0x03, 0x86, 0x65, 0x42, 0x2B, 0x20,
147                         0xA4, 0x99, 0x27, 0x6A, 0x50, 0x42, 0x70, 0x09,
148                         0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
149                 },
150                 .len = 512
151         },
152         .digest = {
153                 .data = {0xDD, 0x7D, 0xFA, 0xDD },
154                 .len  = 4
155         }
156 };
157
158 struct kasumi_hash_test_data kasumi_hash_test_case_5 = {
159         .key = {
160                 .data = {
161                         0xF4, 0xEB, 0xEC, 0x69, 0xE7, 0x3E, 0xAF, 0x2E,
162                         0xB2, 0xCF, 0x6A, 0xF4, 0xB3, 0x12, 0x0F, 0xFD
163                 },
164                 .len = 16
165         },
166         .plaintext = {
167                 .data = {
168                         0x29, 0x6F, 0x39, 0x3C, 0x6B, 0x22, 0x77, 0x37,
169                         0x10, 0xBF, 0xFF, 0x83, 0x9E, 0x0C, 0x71, 0x65,
170                         0x8D, 0xBB, 0x2D, 0x17, 0x07, 0xE1, 0x45, 0x72,
171                         0x4F, 0x41, 0xC1, 0x6F, 0x48, 0xBF, 0x40, 0x3C,
172                         0x3B, 0x18, 0xE3, 0x8F, 0xD5, 0xD1, 0x66, 0x3B,
173                         0x6F, 0x6D, 0x90, 0x01, 0x93, 0xE3, 0xCE, 0xA8,
174                         0xBB, 0x4F, 0x1B, 0x4F, 0x5B, 0xE8, 0x22, 0x03,
175                         0x22, 0x32, 0xA7, 0x8D, 0x7D, 0x75, 0x23, 0x8D,
176                         0x5E, 0x6D, 0xAE, 0xCD, 0x3B, 0x43, 0x22, 0xCF,
177                         0x59, 0xBC, 0x7E, 0xA8, 0x4A, 0xB1, 0x88, 0x11,
178                         0xB5, 0xBF, 0xB7, 0xBC, 0x55, 0x3F, 0x4F, 0xE4,
179                         0x44, 0x78, 0xCE, 0x28, 0x7A, 0x14, 0x87, 0x99,
180                         0x90, 0xD1, 0x8D, 0x12, 0xCA, 0x79, 0xD2, 0xC8,
181                         0x55, 0x14, 0x90, 0x21, 0xCD, 0x5C, 0xE8, 0xCA,
182                         0x03, 0x71, 0xCA, 0x04, 0xFC, 0xCE, 0x14, 0x3E,
183                         0x3D, 0x7C, 0xFE, 0xE9, 0x45, 0x85, 0xB5, 0x88,
184                         0x5C, 0xAC, 0x46, 0x06, 0x8B, 0xC0, 0x00, 0x00
185                 },
186                 .len = 1088
187         },
188         .digest = {
189                 .data = {0xC3, 0x83, 0x83, 0x9D},
190                 .len  = 4
191         }
192 };
193
194 struct kasumi_hash_test_data kasumi_hash_test_case_6 = {
195         .key = {
196                 .data = {
197                         0x83, 0xFD, 0x23, 0xA2, 0x44, 0xA7, 0x4C, 0xF3,
198                         0x58, 0xDA, 0x30, 0x19, 0xF1, 0x72, 0x26, 0x35
199                 },
200                 .len = 16
201         },
202         .plaintext = {
203                 .data = {
204                         0x36, 0xAF, 0x61, 0x44, 0x4F, 0x30, 0x2A, 0xD2,
205                         0x35, 0xC6, 0x87, 0x16, 0x63, 0x3C, 0x66, 0xFB,
206                         0x75, 0x0C, 0x26, 0x68, 0x65, 0xD5, 0x3C, 0x11,
207                         0xEA, 0x05, 0xB1, 0xE9, 0xFA, 0x49, 0xC8, 0x39,
208                         0x8D, 0x48, 0xE1, 0xEF, 0xA5, 0x90, 0x9D, 0x39,
209                         0x47, 0x90, 0x28, 0x37, 0xF5, 0xAE, 0x96, 0xD5,
210                         0xA0, 0x5B, 0xC8, 0xD6, 0x1C, 0xA8, 0xDB, 0xEF,
211                         0x1B, 0x13, 0xA4, 0xB4, 0xAB, 0xFE, 0x4F, 0xB1,
212                         0x00, 0x60, 0x45, 0xB6, 0x74, 0xBB, 0x54, 0x72,
213                         0x93, 0x04, 0xC3, 0x82, 0xBE, 0x53, 0xA5, 0xAF,
214                         0x05, 0x55, 0x61, 0x76, 0xF6, 0xEA, 0xA2, 0xEF,
215                         0x1D, 0x05, 0xE4, 0xB0, 0x83, 0x18, 0x1E, 0xE6,
216                         0x74, 0xCD, 0xA5, 0xA4, 0x85, 0xF7, 0x4D, 0x7A,
217                         0xC0
218                 },
219                 .len = 840
220         },
221         .digest = {
222                 .data = {0x95, 0xAE, 0x41, 0xBA},
223                 .len  = 4
224         }
225 };
226
227 struct kasumi_hash_test_data kasumi_hash_test_case_7 = {
228         .key = {
229                 .data = {
230                         0x5A, 0xCB, 0x1D, 0x64, 0x4C, 0x0D, 0x51, 0x20,
231                         0x4E, 0xA5, 0xF1, 0x45, 0x10, 0x10, 0xD8, 0x52
232                 },
233                 .len = 16
234         },
235         .plaintext = {
236                 .data = {
237                         0x38, 0xA6, 0xF0, 0x56, 0x05, 0xD2, 0xEC, 0x49,
238                         0xAD, 0x9C, 0x44, 0x1F, 0x89, 0x0B, 0x38, 0xC4,
239                         0x57, 0xA4, 0x9D, 0x42, 0x14, 0x07, 0xE8, 0xC0
240                 },
241                 .len = 192
242         },
243         .digest = {
244                 .data = {0x87, 0x5F, 0xE4, 0x89},
245                 .len  = 4
246         }
247 };
248 #endif /* TEST_CRYPTODEV_KASUMI_HASH_TEST_VECTORS_H_ */