~ubuntu-branches/ubuntu/gutsy/wpasupplicant/gutsy

« back to all changes in this revision

Viewing changes to src/hlr_auc_gw/milenage.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler, Alexander Sack
  • Date: 2007-08-26 16:06:57 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20070826160657-2m8pxoweuxe8f93t
Tags: 0.6.0+0.5.8-0ubuntu1
* New upstream release
* remove patch 11_erroneous_manpage_ref, applied upstream
* remove patch 25_wpas_dbus_unregister_iface_fix, applied upstream

[ Alexander Sack ]
* bumping upstream version to replace development version 0.6.0 with
  this package from stable release branch.
* attempt to fix wierd timeout and high latency issues by going
  back to stable upstream version (0.5.9) (LP: #140763,
  LP: #141233).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * 3GPP AKA - Milenage algorithm (3GPP TS 35.205, .206, .207, .208)
3
 
 * Copyright (c) 2006 <j@w1.fi>
4
 
 *
5
 
 * This program is free software; you can redistribute it and/or modify
6
 
 * it under the terms of the GNU General Public License version 2 as
7
 
 * published by the Free Software Foundation.
8
 
 *
9
 
 * Alternatively, this software may be distributed under the terms of BSD
10
 
 * license.
11
 
 *
12
 
 * See README and COPYING for more details.
13
 
 *
14
 
 * This file implements an example authentication algorithm defined for 3GPP
15
 
 * AKA. This can be used to implement a simple HLR/AuC into hlr_auc_gw to allow
16
 
 * EAP-AKA to be tested properly with real USIM cards.
17
 
 *
18
 
 * This implementations assumes that the r1..r5 and c1..c5 constants defined in
19
 
 * TS 35.206 are used, i.e., r1=64, r2=0, r3=32, r4=64, r5=96, c1=00..00,
20
 
 * c2=00..01, c3=00..02, c4=00..04, c5=00..08. The block cipher is assumed to
21
 
 * be AES (Rijndael).
22
 
 */
23
 
 
24
 
#include "includes.h"
25
 
 
26
 
#include "common.h"
27
 
#include "milenage.h"
28
 
#include "aes_wrap.h"
29
 
 
30
 
 
31
 
/**
32
 
 * milenage_f1 - Milenage f1 and f1* algorithms
33
 
 * @opc: OPc = 128-bit value derived from OP and K
34
 
 * @k: K = 128-bit subscriber key
35
 
 * @_rand: RAND = 128-bit random challenge
36
 
 * @sqn: SQN = 48-bit sequence number
37
 
 * @amf: AMF = 16-bit authentication management field
38
 
 * @mac_a: Buffer for MAC-A = 64-bit network authentication code, or %NULL
39
 
 * @mac_s: Buffer for MAC-S = 64-bit resync authentication code, or %NULL
40
 
 */
41
 
static void milenage_f1(const u8 *opc, const u8 *k, const u8 *_rand,
42
 
                        const u8 *sqn, const u8 *amf, u8 *mac_a, u8 *mac_s)
43
 
{
44
 
        u8 tmp1[16], tmp2[16], tmp3[16];
45
 
        int i;
46
 
 
47
 
        /* tmp1 = TEMP = E_K(RAND XOR OP_C) */
48
 
        for (i = 0; i < 16; i++)
49
 
                tmp1[i] = _rand[i] ^ opc[i];
50
 
        aes_128_encrypt_block(k, tmp1, tmp1);
51
 
 
52
 
        /* tmp2 = IN1 = SQN || AMF || SQN || AMF */
53
 
        memcpy(tmp2, sqn, 6);
54
 
        memcpy(tmp2 + 6, amf, 2);
55
 
        memcpy(tmp2 + 8, tmp2, 8);
56
 
 
57
 
        /* OUT1 = E_K(TEMP XOR rot(IN1 XOR OP_C, r1) XOR c1) XOR OP_C */
58
 
 
59
 
        /* rotate (tmp2 XOR OP_C) by r1 (= 0x40 = 8 bytes) */
60
 
        for (i = 0; i < 16; i++)
61
 
                tmp3[(i + 8) % 16] = tmp2[i] ^ opc[i];
62
 
        /* XOR with TEMP = E_K(RAND XOR OP_C) */
63
 
        for (i = 0; i < 16; i++)
64
 
                tmp3[i] ^= tmp1[i];
65
 
        /* XOR with c1 (= ..00, i.e., NOP) */
66
 
 
67
 
        /* f1 || f1* = E_K(tmp3) XOR OP_c */
68
 
        aes_128_encrypt_block(k, tmp3, tmp1);
69
 
        for (i = 0; i < 16; i++)
70
 
                tmp1[i] ^= opc[i];
71
 
        if (mac_a)
72
 
                memcpy(mac_a, tmp1, 8); /* f1 */
73
 
        if (mac_s)
74
 
                memcpy(mac_s, tmp1 + 8, 8); /* f1* */
75
 
}
76
 
 
77
 
 
78
 
/**
79
 
 * milenage_f2345 - Milenage f2, f3, f4, f5, f5* algorithms
80
 
 * @opc: OPc = 128-bit value derived from OP and K
81
 
 * @k: K = 128-bit subscriber key
82
 
 * @_rand: RAND = 128-bit random challenge
83
 
 * @res: Buffer for RES = 64-bit signed response (f2), or %NULL
84
 
 * @ck: Buffer for CK = 128-bit confidentiality key (f3), or %NULL
85
 
 * @ik: Buffer for IK = 128-bit integrity key (f4), or %NULL
86
 
 * @ak: Buffer for AK = 48-bit anonymity key (f5), or %NULL
87
 
 * @akstar: Buffer for AK = 48-bit anonymity key (f5*), or %NULL
88
 
 */
89
 
static void milenage_f2345(const u8 *opc, const u8 *k, const u8 *_rand,
90
 
                           u8 *res, u8 *ck, u8 *ik, u8 *ak, u8 *akstar)
91
 
{
92
 
        u8 tmp1[16], tmp2[16], tmp3[16];
93
 
        int i;
94
 
 
95
 
        /* tmp2 = TEMP = E_K(RAND XOR OP_C) */
96
 
        for (i = 0; i < 16; i++)
97
 
                tmp1[i] = _rand[i] ^ opc[i];
98
 
        aes_128_encrypt_block(k, tmp1, tmp2);
99
 
 
100
 
        /* OUT2 = E_K(rot(TEMP XOR OP_C, r2) XOR c2) XOR OP_C */
101
 
        /* OUT3 = E_K(rot(TEMP XOR OP_C, r3) XOR c3) XOR OP_C */
102
 
        /* OUT4 = E_K(rot(TEMP XOR OP_C, r4) XOR c4) XOR OP_C */
103
 
        /* OUT5 = E_K(rot(TEMP XOR OP_C, r5) XOR c5) XOR OP_C */
104
 
 
105
 
        /* f2 and f5 */
106
 
        /* rotate by r2 (= 0, i.e., NOP) */
107
 
        for (i = 0; i < 16; i++)
108
 
                tmp1[i] = tmp2[i] ^ opc[i];
109
 
        tmp1[15] ^= 1; /* XOR c2 (= ..01) */
110
 
        /* f5 || f2 = E_K(tmp1) XOR OP_c */
111
 
        aes_128_encrypt_block(k, tmp1, tmp3);
112
 
        for (i = 0; i < 16; i++)
113
 
                tmp3[i] ^= opc[i];
114
 
        if (res)
115
 
                memcpy(res, tmp3 + 8, 8); /* f2 */
116
 
        if (ak)
117
 
                memcpy(ak, tmp3, 6); /* f5 */
118
 
 
119
 
        /* f3 */
120
 
        if (ck) {
121
 
                /* rotate by r3 = 0x20 = 4 bytes */
122
 
                for (i = 0; i < 16; i++)
123
 
                        tmp1[(i + 12) % 16] = tmp2[i] ^ opc[i];
124
 
                tmp1[15] ^= 2; /* XOR c3 (= ..02) */
125
 
                aes_128_encrypt_block(k, tmp1, ck);
126
 
                for (i = 0; i < 16; i++)
127
 
                        ck[i] ^= opc[i];
128
 
        }
129
 
 
130
 
        /* f4 */
131
 
        if (ik) {
132
 
                /* rotate by r4 = 0x40 = 8 bytes */
133
 
                for (i = 0; i < 16; i++)
134
 
                        tmp1[(i + 8) % 16] = tmp2[i] ^ opc[i];
135
 
                tmp1[15] ^= 4; /* XOR c4 (= ..04) */
136
 
                aes_128_encrypt_block(k, tmp1, ik);
137
 
                for (i = 0; i < 16; i++)
138
 
                        ik[i] ^= opc[i];
139
 
        }
140
 
 
141
 
        /* f5* */
142
 
        if (akstar) {
143
 
                /* rotate by r5 = 0x60 = 12 bytes */
144
 
                for (i = 0; i < 16; i++)
145
 
                        tmp1[(i + 4) % 16] = tmp2[i] ^ opc[i];
146
 
                tmp1[15] ^= 8; /* XOR c5 (= ..08) */
147
 
                aes_128_encrypt_block(k, tmp1, tmp1);
148
 
                for (i = 0; i < 6; i++)
149
 
                        akstar[i] = tmp1[i] ^ opc[i];
150
 
        }
151
 
}
152
 
 
153
 
 
154
 
/**
155
 
 * milenage_generate - Generate AKA AUTN,IK,CK,RES
156
 
 * @opc: OPc = 128-bit operator variant algorithm configuration field (encr.)
157
 
 * @amf: AMF = 16-bit authentication management field
158
 
 * @k: K = 128-bit subscriber key
159
 
 * @sqn: SQN = 48-bit sequence number
160
 
 * @_rand: RAND = 128-bit random challenge
161
 
 * @autn: Buffer for AUTN = 128-bit authentication token
162
 
 * @ik: Buffer for IK = 128-bit integrity key (f4), or %NULL
163
 
 * @ck: Buffer for CK = 128-bit confidentiality key (f3), or %NULL
164
 
 * @res: Buffer for RES = 64-bit signed response (f2), or %NULL
165
 
 * @res_len: Max length for res; set to used length or 0 on failure
166
 
 */
167
 
void milenage_generate(const u8 *opc, const u8 *amf, const u8 *k,
168
 
                       const u8 *sqn, const u8 *_rand, u8 *autn, u8 *ik,
169
 
                       u8 *ck, u8 *res, size_t *res_len)
170
 
{
171
 
        int i;
172
 
        u8 mac_a[16], ak[6];
173
 
 
174
 
        if (*res_len < 8) {
175
 
                *res_len = 0;
176
 
                return;
177
 
        }
178
 
        *res_len = 8;
179
 
        milenage_f1(opc, k, _rand, sqn, amf, mac_a, NULL);
180
 
        milenage_f2345(opc, k, _rand, res, ck, ik, ak, NULL);
181
 
 
182
 
        /* AUTN = (SQN ^ AK) || AMF || MAC */
183
 
        for (i = 0; i < 6; i++)
184
 
                autn[i] = sqn[i] ^ ak[i];
185
 
        memcpy(autn + 6, amf, 2);
186
 
        memcpy(autn + 8, mac_a, 8);
187
 
}
188
 
 
189
 
 
190
 
/**
191
 
 * milenage_auts - Milenage AUTS validation
192
 
 * @opc: OPc = 128-bit operator variant algorithm configuration field (encr.)
193
 
 * @k: K = 128-bit subscriber key
194
 
 * @_rand: RAND = 128-bit random challenge
195
 
 * @auts: AUTS = 112-bit authentication token from client
196
 
 * @sqn: Buffer for SQN = 48-bit sequence number
197
 
 * Returns: 0 = success (sqn filled), -1 on failure
198
 
 */
199
 
int milenage_auts(const u8 *opc, const u8 *k, const u8 *_rand, const u8 *auts,
200
 
                  u8 *sqn)
201
 
{
202
 
        u8 amf[2] = { 0x00, 0x00 }; /* TS 33.102 v7.0.0, 6.3.3 */
203
 
        u8 ak[6], mac_s[8];
204
 
        int i;
205
 
 
206
 
        milenage_f2345(opc, k, _rand, NULL, NULL, NULL, NULL, ak);
207
 
        for (i = 0; i < 6; i++)
208
 
                sqn[i] = auts[i] ^ ak[i];
209
 
        milenage_f1(opc, k, _rand, sqn, amf, NULL, mac_s);
210
 
        if (memcmp(mac_s, auts + 6, 8) != 0)
211
 
                return -1;
212
 
        return 0;
213
 
}
214
 
 
215
 
 
216
 
/**
217
 
 * gsm_milenage - Generate GSM-Milenage (3GPP TS 55.205) authentication triplet
218
 
 * @opc: OPc = 128-bit operator variant algorithm configuration field (encr.)
219
 
 * @k: K = 128-bit subscriber key
220
 
 * @_rand: RAND = 128-bit random challenge
221
 
 * @sres: Buffer for SRES = 32-bit SRES
222
 
 * @kc: Buffer for Kc = 64-bit Kc
223
 
 */
224
 
void gsm_milenage(const u8 *opc, const u8 *k, const u8 *_rand, u8 *sres,
225
 
                  u8 *kc)
226
 
{
227
 
        u8 res[8], ck[16], ik[16];
228
 
        int i;
229
 
 
230
 
        milenage_f2345(opc, k, _rand, res, ck, ik, NULL, NULL);
231
 
 
232
 
        for (i = 0; i < 8; i++)
233
 
                kc[i] = ck[i] ^ ck[i + 8] ^ ik[i] ^ ik[i + 8];
234
 
 
235
 
#ifdef GSM_MILENAGE_ALT_SRES
236
 
        memcpy(sres, res, 4);
237
 
#else /* GSM_MILENAGE_ALT_SRES */
238
 
        for (i = 0; i < 4; i++)
239
 
                sres[i] = res[i] ^ res[i + 4];
240
 
#endif /* GSM_MILENAGE_ALT_SRES */
241
 
}
242
 
 
243
 
 
244
 
#ifdef TEST_MAIN_MILENAGE
245
 
 
246
 
extern int wpa_debug_level;
247
 
 
248
 
 
249
 
/**
250
 
 * milenage_opc - Determine OPc from OP and K
251
 
 * @op: OP = 128-bit operator variant algorithm configuration field
252
 
 * @k: K = 128-bit subscriber key
253
 
 * @opc: Buffer for OPc = 128-bit value derived from OP and K
254
 
 */
255
 
static void milenage_opc(const u8 *op, const u8 *k, u8 *opc)
256
 
{
257
 
        int i;
258
 
        /* OP_C = OP XOR E_K(OP) */
259
 
        aes_128_encrypt_block(k, op, opc);
260
 
        for (i = 0; i < 16; i++)
261
 
                opc[i] ^= op[i];
262
 
}
263
 
 
264
 
 
265
 
struct gsm_milenage_test_set {
266
 
        u8 ki[16];
267
 
        u8 rand[16];
268
 
        u8 opc[16];
269
 
        u8 sres1[4];
270
 
        u8 sres2[4];
271
 
        u8 kc[8];
272
 
};
273
 
 
274
 
static const struct gsm_milenage_test_set gsm_test_sets[] =
275
 
{
276
 
        {
277
 
                /* 3GPP TS 55.205 v6.0.0 - Test Set 1 */
278
 
                { 0x46, 0x5b, 0x5c, 0xe8, 0xb1, 0x99, 0xb4, 0x9f,
279
 
                  0xaa, 0x5f, 0x0a, 0x2e, 0xe2, 0x38, 0xa6, 0xbc },
280
 
                { 0x23, 0x55, 0x3c, 0xbe, 0x96, 0x37, 0xa8, 0x9d,
281
 
                  0x21, 0x8a, 0xe6, 0x4d, 0xae, 0x47, 0xbf, 0x35 },
282
 
                { 0xcd, 0x63, 0xcb, 0x71, 0x95, 0x4a, 0x9f, 0x4e,
283
 
                  0x48, 0xa5, 0x99, 0x4e, 0x37, 0xa0, 0x2b, 0xaf },
284
 
                { 0x46, 0xf8, 0x41, 0x6a },
285
 
                { 0xa5, 0x42, 0x11, 0xd5 },
286
 
                { 0xea, 0xe4, 0xbe, 0x82, 0x3a, 0xf9, 0xa0, 0x8b }
287
 
        }, {
288
 
                /* 3GPP TS 55.205 v6.0.0 - Test Set 2 */
289
 
                { 0xfe, 0xc8, 0x6b, 0xa6, 0xeb, 0x70, 0x7e, 0xd0,
290
 
                  0x89, 0x05, 0x75, 0x7b, 0x1b, 0xb4, 0x4b, 0x8f },
291
 
                { 0x9f, 0x7c, 0x8d, 0x02, 0x1a, 0xcc, 0xf4, 0xdb,
292
 
                  0x21, 0x3c, 0xcf, 0xf0, 0xc7, 0xf7, 0x1a, 0x6a },
293
 
                { 0x10, 0x06, 0x02, 0x0f, 0x0a, 0x47, 0x8b, 0xf6,
294
 
                  0xb6, 0x99, 0xf1, 0x5c, 0x06, 0x2e, 0x42, 0xb3 },
295
 
                { 0x8c, 0x30, 0x8a, 0x5e },
296
 
                { 0x80, 0x11, 0xc4, 0x8c },
297
 
                { 0xaa, 0x01, 0x73, 0x9b, 0x8c, 0xaa, 0x97, 0x6d }
298
 
        }, {
299
 
                /* 3GPP TS 55.205 v6.0.0 - Test Set 3 */
300
 
                { 0x9e, 0x59, 0x44, 0xae, 0xa9, 0x4b, 0x81, 0x16,
301
 
                  0x5c, 0x82, 0xfb, 0xf9, 0xf3, 0x2d, 0xb7, 0x51 },
302
 
                { 0xce, 0x83, 0xdb, 0xc5, 0x4a, 0xc0, 0x27, 0x4a,
303
 
                  0x15, 0x7c, 0x17, 0xf8, 0x0d, 0x01, 0x7b, 0xd6 },
304
 
                { 0xa6, 0x4a, 0x50, 0x7a, 0xe1, 0xa2, 0xa9, 0x8b,
305
 
                  0xb8, 0x8e, 0xb4, 0x21, 0x01, 0x35, 0xdc, 0x87 },
306
 
                { 0xcf, 0xbc, 0xe3, 0xfe },
307
 
                { 0xf3, 0x65, 0xcd, 0x68 },
308
 
                { 0x9a, 0x8e, 0xc9, 0x5f, 0x40, 0x8c, 0xc5, 0x07 }
309
 
        }, {
310
 
                /* 3GPP TS 55.205 v6.0.0 - Test Set 4 */
311
 
                { 0x4a, 0xb1, 0xde, 0xb0, 0x5c, 0xa6, 0xce, 0xb0,
312
 
                  0x51, 0xfc, 0x98, 0xe7, 0x7d, 0x02, 0x6a, 0x84 },
313
 
                { 0x74, 0xb0, 0xcd, 0x60, 0x31, 0xa1, 0xc8, 0x33,
314
 
                  0x9b, 0x2b, 0x6c, 0xe2, 0xb8, 0xc4, 0xa1, 0x86 },
315
 
                { 0xdc, 0xf0, 0x7c, 0xbd, 0x51, 0x85, 0x52, 0x90,
316
 
                  0xb9, 0x2a, 0x07, 0xa9, 0x89, 0x1e, 0x52, 0x3e },
317
 
                { 0x96, 0x55, 0xe2, 0x65 },
318
 
                { 0x58, 0x60, 0xfc, 0x1b },
319
 
                { 0xcd, 0xc1, 0xdc, 0x08, 0x41, 0xb8, 0x1a, 0x22 }
320
 
        }, {
321
 
                /* 3GPP TS 55.205 v6.0.0 - Test Set 5 */
322
 
                { 0x6c, 0x38, 0xa1, 0x16, 0xac, 0x28, 0x0c, 0x45,
323
 
                  0x4f, 0x59, 0x33, 0x2e, 0xe3, 0x5c, 0x8c, 0x4f },
324
 
                { 0xee, 0x64, 0x66, 0xbc, 0x96, 0x20, 0x2c, 0x5a,
325
 
                  0x55, 0x7a, 0xbb, 0xef, 0xf8, 0xba, 0xbf, 0x63 },
326
 
                { 0x38, 0x03, 0xef, 0x53, 0x63, 0xb9, 0x47, 0xc6,
327
 
                  0xaa, 0xa2, 0x25, 0xe5, 0x8f, 0xae, 0x39, 0x34 },
328
 
                { 0x13, 0x68, 0x8f, 0x17 },
329
 
                { 0x16, 0xc8, 0x23, 0x3f },
330
 
                { 0xdf, 0x75, 0xbc, 0x5e, 0xa8, 0x99, 0x87, 0x9f }
331
 
        }, {
332
 
                /* 3GPP TS 55.205 v6.0.0 - Test Set 6 */
333
 
                { 0x2d, 0x60, 0x9d, 0x4d, 0xb0, 0xac, 0x5b, 0xf0,
334
 
                  0xd2, 0xc0, 0xde, 0x26, 0x70, 0x14, 0xde, 0x0d },
335
 
                { 0x19, 0x4a, 0xa7, 0x56, 0x01, 0x38, 0x96, 0xb7,
336
 
                  0x4b, 0x4a, 0x2a, 0x3b, 0x0a, 0xf4, 0x53, 0x9e },
337
 
                { 0xc3, 0x5a, 0x0a, 0xb0, 0xbc, 0xbf, 0xc9, 0x25,
338
 
                  0x2c, 0xaf, 0xf1, 0x5f, 0x24, 0xef, 0xbd, 0xe0 },
339
 
                { 0x55, 0x3d, 0x00, 0xb3 },
340
 
                { 0x8c, 0x25, 0xa1, 0x6c },
341
 
                { 0x84, 0xb4, 0x17, 0xae, 0x3a, 0xea, 0xb4, 0xf3 }
342
 
        }, {
343
 
                /* 3GPP TS 55.205 v6.0.0 - Test Set 7 */
344
 
                { 0xa5, 0x30, 0xa7, 0xfe, 0x42, 0x8f, 0xad, 0x10,
345
 
                  0x82, 0xc4, 0x5e, 0xdd, 0xfc, 0xe1, 0x38, 0x84 },
346
 
                { 0x3a, 0x4c, 0x2b, 0x32, 0x45, 0xc5, 0x0e, 0xb5,
347
 
                  0xc7, 0x1d, 0x08, 0x63, 0x93, 0x95, 0x76, 0x4d },
348
 
                { 0x27, 0x95, 0x3e, 0x49, 0xbc, 0x8a, 0xf6, 0xdc,
349
 
                  0xc6, 0xe7, 0x30, 0xeb, 0x80, 0x28, 0x6b, 0xe3 },
350
 
                { 0x59, 0xf1, 0xa4, 0x4a },
351
 
                { 0xa6, 0x32, 0x41, 0xe1 },
352
 
                { 0x3b, 0x4e, 0x24, 0x4c, 0xdc, 0x60, 0xce, 0x03 }
353
 
        }, {
354
 
                /* 3GPP TS 55.205 v6.0.0 - Test Set 8 */
355
 
                { 0xd9, 0x15, 0x1c, 0xf0, 0x48, 0x96, 0xe2, 0x58,
356
 
                  0x30, 0xbf, 0x2e, 0x08, 0x26, 0x7b, 0x83, 0x60 },
357
 
                { 0xf7, 0x61, 0xe5, 0xe9, 0x3d, 0x60, 0x3f, 0xeb,
358
 
                  0x73, 0x0e, 0x27, 0x55, 0x6c, 0xb8, 0xa2, 0xca },
359
 
                { 0xc4, 0xc9, 0x3e, 0xff, 0xe8, 0xa0, 0x81, 0x38,
360
 
                  0xc2, 0x03, 0xd4, 0xc2, 0x7c, 0xe4, 0xe3, 0xd9 },
361
 
                { 0x50, 0x58, 0x88, 0x61 },
362
 
                { 0x4a, 0x90, 0xb2, 0x17 },
363
 
                { 0x8d, 0x4e, 0xc0, 0x1d, 0xe5, 0x97, 0xac, 0xfe }
364
 
        }, {
365
 
                /* 3GPP TS 55.205 v6.0.0 - Test Set 9 */
366
 
                { 0xa0, 0xe2, 0x97, 0x1b, 0x68, 0x22, 0xe8, 0xd3,
367
 
                  0x54, 0xa1, 0x8c, 0xc2, 0x35, 0x62, 0x4e, 0xcb },
368
 
                { 0x08, 0xef, 0xf8, 0x28, 0xb1, 0x3f, 0xdb, 0x56,
369
 
                  0x27, 0x22, 0xc6, 0x5c, 0x7f, 0x30, 0xa9, 0xb2 },
370
 
                { 0x82, 0xa2, 0x6f, 0x22, 0xbb, 0xa9, 0xe9, 0x48,
371
 
                  0x8f, 0x94, 0x9a, 0x10, 0xd9, 0x8e, 0x9c, 0xc4 },
372
 
                { 0xcd, 0xe6, 0xb0, 0x27 },
373
 
                { 0x4b, 0xc2, 0x21, 0x2d },
374
 
                { 0xd8, 0xde, 0xbc, 0x4f, 0xfb, 0xcd, 0x60, 0xaa }
375
 
        }, {
376
 
                /* 3GPP TS 55.205 v6.0.0 - Test Set 10 */
377
 
                { 0x0d, 0xa6, 0xf7, 0xba, 0x86, 0xd5, 0xea, 0xc8,
378
 
                  0xa1, 0x9c, 0xf5, 0x63, 0xac, 0x58, 0x64, 0x2d },
379
 
                { 0x67, 0x9a, 0xc4, 0xdb, 0xac, 0xd7, 0xd2, 0x33,
380
 
                  0xff, 0x9d, 0x68, 0x06, 0xf4, 0x14, 0x9c, 0xe3 },
381
 
                { 0x0d, 0xb1, 0x07, 0x1f, 0x87, 0x67, 0x56, 0x2c,
382
 
                  0xa4, 0x3a, 0x0a, 0x64, 0xc4, 0x1e, 0x8d, 0x08 },
383
 
                { 0x02, 0xd1, 0x3a, 0xcd },
384
 
                { 0x6f, 0xc3, 0x0f, 0xee },
385
 
                { 0xf0, 0xea, 0xa5, 0x0a, 0x1e, 0xdc, 0xeb, 0xb7 }
386
 
        }, {
387
 
                /* 3GPP TS 55.205 v6.0.0 - Test Set 11 */
388
 
                { 0x77, 0xb4, 0x58, 0x43, 0xc8, 0x8e, 0x58, 0xc1,
389
 
                  0x0d, 0x20, 0x26, 0x84, 0x51, 0x5e, 0xd4, 0x30 },
390
 
                { 0x4c, 0x47, 0xeb, 0x30, 0x76, 0xdc, 0x55, 0xfe,
391
 
                  0x51, 0x06, 0xcb, 0x20, 0x34, 0xb8, 0xcd, 0x78 },
392
 
                { 0xd4, 0x83, 0xaf, 0xae, 0x56, 0x24, 0x09, 0xa3,
393
 
                  0x26, 0xb5, 0xbb, 0x0b, 0x20, 0xc4, 0xd7, 0x62 },
394
 
                { 0x44, 0x38, 0x9d, 0x01 },
395
 
                { 0xae, 0xfa, 0x35, 0x7b },
396
 
                { 0x82, 0xdb, 0xab, 0x7f, 0x83, 0xf0, 0x63, 0xda }
397
 
        }, {
398
 
                /* 3GPP TS 55.205 v6.0.0 - Test Set 12 */
399
 
                { 0x72, 0x9b, 0x17, 0x72, 0x92, 0x70, 0xdd, 0x87,
400
 
                  0xcc, 0xdf, 0x1b, 0xfe, 0x29, 0xb4, 0xe9, 0xbb },
401
 
                { 0x31, 0x1c, 0x4c, 0x92, 0x97, 0x44, 0xd6, 0x75,
402
 
                  0xb7, 0x20, 0xf3, 0xb7, 0xe9, 0xb1, 0xcb, 0xd0 },
403
 
                { 0x22, 0x8c, 0x2f, 0x2f, 0x06, 0xac, 0x32, 0x68,
404
 
                  0xa9, 0xe6, 0x16, 0xee, 0x16, 0xdb, 0x4b, 0xa1 },
405
 
                { 0x03, 0xe0, 0xfd, 0x84 },
406
 
                { 0x98, 0xdb, 0xbd, 0x09 },
407
 
                { 0x3c, 0x66, 0xcb, 0x98, 0xca, 0xb2, 0xd3, 0x3d }
408
 
        }, {
409
 
                /* 3GPP TS 55.205 v6.0.0 - Test Set 13 */
410
 
                { 0xd3, 0x2d, 0xd2, 0x3e, 0x89, 0xdc, 0x66, 0x23,
411
 
                  0x54, 0xca, 0x12, 0xeb, 0x79, 0xdd, 0x32, 0xfa },
412
 
                { 0xcf, 0x7d, 0x0a, 0xb1, 0xd9, 0x43, 0x06, 0x95,
413
 
                  0x0b, 0xf1, 0x20, 0x18, 0xfb, 0xd4, 0x68, 0x87 },
414
 
                { 0xd2, 0x2a, 0x4b, 0x41, 0x80, 0xa5, 0x32, 0x57,
415
 
                  0x08, 0xa5, 0xff, 0x70, 0xd9, 0xf6, 0x7e, 0xc7 },
416
 
                { 0xbe, 0x73, 0xb3, 0xdc },
417
 
                { 0xaf, 0x4a, 0x41, 0x1e },
418
 
                { 0x96, 0x12, 0xb5, 0xd8, 0x8a, 0x41, 0x30, 0xbb }
419
 
        }, {
420
 
                /* 3GPP TS 55.205 v6.0.0 - Test Set 14 */
421
 
                { 0xaf, 0x7c, 0x65, 0xe1, 0x92, 0x72, 0x21, 0xde,
422
 
                  0x59, 0x11, 0x87, 0xa2, 0xc5, 0x98, 0x7a, 0x53 },
423
 
                { 0x1f, 0x0f, 0x85, 0x78, 0x46, 0x4f, 0xd5, 0x9b,
424
 
                  0x64, 0xbe, 0xd2, 0xd0, 0x94, 0x36, 0xb5, 0x7a },
425
 
                { 0xa4, 0xcf, 0x5c, 0x81, 0x55, 0xc0, 0x8a, 0x7e,
426
 
                  0xff, 0x41, 0x8e, 0x54, 0x43, 0xb9, 0x8e, 0x55 },
427
 
                { 0x8f, 0xe0, 0x19, 0xc7 },
428
 
                { 0x7b, 0xff, 0xa5, 0xc2 },
429
 
                { 0x75, 0xa1, 0x50, 0xdf, 0x3c, 0x6a, 0xed, 0x08 }
430
 
        }, {
431
 
                /* 3GPP TS 55.205 v6.0.0 - Test Set 15 */
432
 
                { 0x5b, 0xd7, 0xec, 0xd3, 0xd3, 0x12, 0x7a, 0x41,
433
 
                  0xd1, 0x25, 0x39, 0xbe, 0xd4, 0xe7, 0xcf, 0x71 },
434
 
                { 0x59, 0xb7, 0x5f, 0x14, 0x25, 0x1c, 0x75, 0x03,
435
 
                  0x1d, 0x0b, 0xcb, 0xac, 0x1c, 0x2c, 0x04, 0xc7 },
436
 
                { 0x76, 0x08, 0x9d, 0x3c, 0x0f, 0xf3, 0xef, 0xdc,
437
 
                  0x6e, 0x36, 0x72, 0x1d, 0x4f, 0xce, 0xb7, 0x47 },
438
 
                { 0x27, 0x20, 0x2b, 0x82 },
439
 
                { 0x7e, 0x3f, 0x44, 0xc7 },
440
 
                { 0xb7, 0xf9, 0x2e, 0x42, 0x6a, 0x36, 0xfe, 0xc5 }
441
 
        }, {
442
 
                /* 3GPP TS 55.205 v6.0.0 - Test Set 16 */
443
 
                { 0x6c, 0xd1, 0xc6, 0xce, 0xb1, 0xe0, 0x1e, 0x14,
444
 
                  0xf1, 0xb8, 0x23, 0x16, 0xa9, 0x0b, 0x7f, 0x3d },
445
 
                { 0xf6, 0x9b, 0x78, 0xf3, 0x00, 0xa0, 0x56, 0x8b,
446
 
                  0xce, 0x9f, 0x0c, 0xb9, 0x3c, 0x4b, 0xe4, 0xc9 },
447
 
                { 0xa2, 0x19, 0xdc, 0x37, 0xf1, 0xdc, 0x7d, 0x66,
448
 
                  0x73, 0x8b, 0x58, 0x43, 0xc7, 0x99, 0xf2, 0x06 },
449
 
                { 0xdd, 0xd7, 0xef, 0xe6 },
450
 
                { 0x70, 0xf6, 0xbd, 0xb9 },
451
 
                { 0x88, 0xd9, 0xde, 0x10, 0xa2, 0x20, 0x04, 0xc5 }
452
 
        }, {
453
 
                /* 3GPP TS 55.205 v6.0.0 - Test Set 17 */
454
 
                { 0xb7, 0x3a, 0x90, 0xcb, 0xcf, 0x3a, 0xfb, 0x62,
455
 
                  0x2d, 0xba, 0x83, 0xc5, 0x8a, 0x84, 0x15, 0xdf },
456
 
                { 0xb1, 0x20, 0xf1, 0xc1, 0xa0, 0x10, 0x2a, 0x2f,
457
 
                  0x50, 0x7d, 0xd5, 0x43, 0xde, 0x68, 0x28, 0x1f },
458
 
                { 0xdf, 0x0c, 0x67, 0x86, 0x8f, 0xa2, 0x5f, 0x74,
459
 
                  0x8b, 0x70, 0x44, 0xc6, 0xe7, 0xc2, 0x45, 0xb8 },
460
 
                { 0x67, 0xe4, 0xff, 0x3f },
461
 
                { 0x47, 0x9d, 0xd2, 0x5c },
462
 
                { 0xa8, 0x19, 0xe5, 0x77, 0xa8, 0xd6, 0x17, 0x5b }
463
 
        }, {
464
 
                /* 3GPP TS 55.205 v6.0.0 - Test Set 18 */
465
 
                { 0x51, 0x22, 0x25, 0x02, 0x14, 0xc3, 0x3e, 0x72,
466
 
                  0x3a, 0x5d, 0xd5, 0x23, 0xfc, 0x14, 0x5f, 0xc0 },
467
 
                { 0x81, 0xe9, 0x2b, 0x6c, 0x0e, 0xe0, 0xe1, 0x2e,
468
 
                  0xbc, 0xeb, 0xa8, 0xd9, 0x2a, 0x99, 0xdf, 0xa5 },
469
 
                { 0x98, 0x1d, 0x46, 0x4c, 0x7c, 0x52, 0xeb, 0x6e,
470
 
                  0x50, 0x36, 0x23, 0x49, 0x84, 0xad, 0x0b, 0xcf },
471
 
                { 0x8a, 0x3b, 0x8d, 0x17 },
472
 
                { 0x28, 0xd7, 0xb0, 0xf2 },
473
 
                { 0x9a, 0x8d, 0x0e, 0x88, 0x3f, 0xf0, 0x88, 0x7a }
474
 
        }, {
475
 
                /* 3GPP TS 55.205 v6.0.0 - Test Set 19 */
476
 
                { 0x90, 0xdc, 0xa4, 0xed, 0xa4, 0x5b, 0x53, 0xcf,
477
 
                  0x0f, 0x12, 0xd7, 0xc9, 0xc3, 0xbc, 0x6a, 0x89 },
478
 
                { 0x9f, 0xdd, 0xc7, 0x20, 0x92, 0xc6, 0xad, 0x03,
479
 
                  0x6b, 0x6e, 0x46, 0x47, 0x89, 0x31, 0x5b, 0x78 },
480
 
                { 0xcb, 0x9c, 0xcc, 0xc4, 0xb9, 0x25, 0x8e, 0x6d,
481
 
                  0xca, 0x47, 0x60, 0x37, 0x9f, 0xb8, 0x25, 0x81 },
482
 
                { 0xdf, 0x58, 0x52, 0x2f },
483
 
                { 0xa9, 0x51, 0x00, 0xe2 },
484
 
                { 0xed, 0x29, 0xb2, 0xf1, 0xc2, 0x7f, 0x9f, 0x34 }
485
 
        }
486
 
};
487
 
 
488
 
#define NUM_GSM_TESTS (sizeof(gsm_test_sets) / sizeof(gsm_test_sets[0]))
489
 
 
490
 
 
491
 
struct milenage_test_set {
492
 
        u8 k[16];
493
 
        u8 rand[16];
494
 
        u8 sqn[6];
495
 
        u8 amf[2];
496
 
        u8 op[16];
497
 
        u8 opc[16];
498
 
        u8 f1[8];
499
 
        u8 f1star[8];
500
 
        u8 f2[8];
501
 
        u8 f3[16];
502
 
        u8 f4[16];
503
 
        u8 f5[6];
504
 
        u8 f5star[6];
505
 
};
506
 
 
507
 
static const struct milenage_test_set test_sets[] =
508
 
{
509
 
        {
510
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.1 Test Set 1 */
511
 
                { 0x46, 0x5b, 0x5c, 0xe8, 0xb1, 0x99, 0xb4, 0x9f,
512
 
                  0xaa, 0x5f, 0x0a, 0x2e, 0xe2, 0x38, 0xa6, 0xbc },
513
 
                { 0x23, 0x55, 0x3c, 0xbe, 0x96, 0x37, 0xa8, 0x9d,
514
 
                  0x21, 0x8a, 0xe6, 0x4d, 0xae, 0x47, 0xbf, 0x35 },
515
 
                { 0xff, 0x9b, 0xb4, 0xd0, 0xb6, 0x07 },
516
 
                { 0xb9, 0xb9 },
517
 
                { 0xcd, 0xc2, 0x02, 0xd5, 0x12, 0x3e, 0x20, 0xf6,
518
 
                  0x2b, 0x6d, 0x67, 0x6a, 0xc7, 0x2c, 0xb3, 0x18 },
519
 
                { 0xcd, 0x63, 0xcb, 0x71, 0x95, 0x4a, 0x9f, 0x4e,
520
 
                  0x48, 0xa5, 0x99, 0x4e, 0x37, 0xa0, 0x2b, 0xaf },
521
 
                { 0x4a, 0x9f, 0xfa, 0xc3, 0x54, 0xdf, 0xaf, 0xb3 },
522
 
                { 0x01, 0xcf, 0xaf, 0x9e, 0xc4, 0xe8, 0x71, 0xe9 },
523
 
                { 0xa5, 0x42, 0x11, 0xd5, 0xe3, 0xba, 0x50, 0xbf },
524
 
                { 0xb4, 0x0b, 0xa9, 0xa3, 0xc5, 0x8b, 0x2a, 0x05,
525
 
                  0xbb, 0xf0, 0xd9, 0x87, 0xb2, 0x1b, 0xf8, 0xcb },
526
 
                { 0xf7, 0x69, 0xbc, 0xd7, 0x51, 0x04, 0x46, 0x04,
527
 
                  0x12, 0x76, 0x72, 0x71, 0x1c, 0x6d, 0x34, 0x41 },
528
 
                { 0xaa, 0x68, 0x9c, 0x64, 0x83, 0x70 },
529
 
                { 0x45, 0x1e, 0x8b, 0xec, 0xa4, 0x3b }
530
 
        }, {
531
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.2 Test Set 2 */
532
 
                { 0x46, 0x5b, 0x5c, 0xe8, 0xb1, 0x99, 0xb4, 0x9f,
533
 
                  0xaa, 0x5f, 0x0a, 0x2e, 0xe2, 0x38, 0xa6, 0xbc },
534
 
                { 0x23, 0x55, 0x3c, 0xbe, 0x96, 0x37, 0xa8, 0x9d,
535
 
                  0x21, 0x8a, 0xe6, 0x4d, 0xae, 0x47, 0xbf, 0x35 },
536
 
                { 0xff, 0x9b, 0xb4, 0xd0, 0xb6, 0x07 },
537
 
                { 0xb9, 0xb9 },
538
 
                { 0xcd, 0xc2, 0x02, 0xd5, 0x12, 0x3e, 0x20, 0xf6,
539
 
                  0x2b, 0x6d, 0x67, 0x6a, 0xc7, 0x2c, 0xb3, 0x18 },
540
 
                { 0xcd, 0x63, 0xcb, 0x71, 0x95, 0x4a, 0x9f, 0x4e,
541
 
                  0x48, 0xa5, 0x99, 0x4e, 0x37, 0xa0, 0x2b, 0xaf },
542
 
                { 0x4a, 0x9f, 0xfa, 0xc3, 0x54, 0xdf, 0xaf, 0xb3 },
543
 
                { 0x01, 0xcf, 0xaf, 0x9e, 0xc4, 0xe8, 0x71, 0xe9 },
544
 
                { 0xa5, 0x42, 0x11, 0xd5, 0xe3, 0xba, 0x50, 0xbf },
545
 
                { 0xb4, 0x0b, 0xa9, 0xa3, 0xc5, 0x8b, 0x2a, 0x05,
546
 
                  0xbb, 0xf0, 0xd9, 0x87, 0xb2, 0x1b, 0xf8, 0xcb },
547
 
                { 0xf7, 0x69, 0xbc, 0xd7, 0x51, 0x04, 0x46, 0x04,
548
 
                  0x12, 0x76, 0x72, 0x71, 0x1c, 0x6d, 0x34, 0x41 },
549
 
                { 0xaa, 0x68, 0x9c, 0x64, 0x83, 0x70 },
550
 
                { 0x45, 0x1e, 0x8b, 0xec, 0xa4, 0x3b }
551
 
        }, {
552
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.3 Test Set 3 */
553
 
                { 0xfe, 0xc8, 0x6b, 0xa6, 0xeb, 0x70, 0x7e, 0xd0,
554
 
                  0x89, 0x05, 0x75, 0x7b, 0x1b, 0xb4, 0x4b, 0x8f },
555
 
                { 0x9f, 0x7c, 0x8d, 0x02, 0x1a, 0xcc, 0xf4, 0xdb,
556
 
                  0x21, 0x3c, 0xcf, 0xf0, 0xc7, 0xf7, 0x1a, 0x6a },
557
 
                { 0x9d, 0x02, 0x77, 0x59, 0x5f, 0xfc },
558
 
                { 0x72, 0x5c },
559
 
                { 0xdb, 0xc5, 0x9a, 0xdc, 0xb6, 0xf9, 0xa0, 0xef,
560
 
                  0x73, 0x54, 0x77, 0xb7, 0xfa, 0xdf, 0x83, 0x74 },
561
 
                { 0x10, 0x06, 0x02, 0x0f, 0x0a, 0x47, 0x8b, 0xf6,
562
 
                  0xb6, 0x99, 0xf1, 0x5c, 0x06, 0x2e, 0x42, 0xb3 },
563
 
                { 0x9c, 0xab, 0xc3, 0xe9, 0x9b, 0xaf, 0x72, 0x81 },
564
 
                { 0x95, 0x81, 0x4b, 0xa2, 0xb3, 0x04, 0x43, 0x24 },
565
 
                { 0x80, 0x11, 0xc4, 0x8c, 0x0c, 0x21, 0x4e, 0xd2 },
566
 
                { 0x5d, 0xbd, 0xbb, 0x29, 0x54, 0xe8, 0xf3, 0xcd,
567
 
                  0xe6, 0x65, 0xb0, 0x46, 0x17, 0x9a, 0x50, 0x98 },
568
 
                { 0x59, 0xa9, 0x2d, 0x3b, 0x47, 0x6a, 0x04, 0x43,
569
 
                  0x48, 0x70, 0x55, 0xcf, 0x88, 0xb2, 0x30, 0x7b },
570
 
                { 0x33, 0x48, 0x4d, 0xc2, 0x13, 0x6b },
571
 
                { 0xde, 0xac, 0xdd, 0x84, 0x8c, 0xc6 }
572
 
        }, {
573
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.4 Test Set 4 */
574
 
                { 0x9e, 0x59, 0x44, 0xae, 0xa9, 0x4b, 0x81, 0x16,
575
 
                  0x5c, 0x82, 0xfb, 0xf9, 0xf3, 0x2d, 0xb7, 0x51 },
576
 
                { 0xce, 0x83, 0xdb, 0xc5, 0x4a, 0xc0, 0x27, 0x4a,
577
 
                  0x15, 0x7c, 0x17, 0xf8, 0x0d, 0x01, 0x7b, 0xd6 },
578
 
                { 0x0b, 0x60, 0x4a, 0x81, 0xec, 0xa8 },
579
 
                { 0x9e, 0x09 },
580
 
                { 0x22, 0x30, 0x14, 0xc5, 0x80, 0x66, 0x94, 0xc0,
581
 
                  0x07, 0xca, 0x1e, 0xee, 0xf5, 0x7f, 0x00, 0x4f },
582
 
                { 0xa6, 0x4a, 0x50, 0x7a, 0xe1, 0xa2, 0xa9, 0x8b,
583
 
                  0xb8, 0x8e, 0xb4, 0x21, 0x01, 0x35, 0xdc, 0x87 },
584
 
                { 0x74, 0xa5, 0x82, 0x20, 0xcb, 0xa8, 0x4c, 0x49 },
585
 
                { 0xac, 0x2c, 0xc7, 0x4a, 0x96, 0x87, 0x18, 0x37 },
586
 
                { 0xf3, 0x65, 0xcd, 0x68, 0x3c, 0xd9, 0x2e, 0x96 },
587
 
                { 0xe2, 0x03, 0xed, 0xb3, 0x97, 0x15, 0x74, 0xf5,
588
 
                  0xa9, 0x4b, 0x0d, 0x61, 0xb8, 0x16, 0x34, 0x5d },
589
 
                { 0x0c, 0x45, 0x24, 0xad, 0xea, 0xc0, 0x41, 0xc4,
590
 
                  0xdd, 0x83, 0x0d, 0x20, 0x85, 0x4f, 0xc4, 0x6b },
591
 
                { 0xf0, 0xb9, 0xc0, 0x8a, 0xd0, 0x2e },
592
 
                { 0x60, 0x85, 0xa8, 0x6c, 0x6f, 0x63 }
593
 
        }, {
594
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.5 Test Set 5 */
595
 
                { 0x4a, 0xb1, 0xde, 0xb0, 0x5c, 0xa6, 0xce, 0xb0,
596
 
                  0x51, 0xfc, 0x98, 0xe7, 0x7d, 0x02, 0x6a, 0x84 },
597
 
                { 0x74, 0xb0, 0xcd, 0x60, 0x31, 0xa1, 0xc8, 0x33,
598
 
                  0x9b, 0x2b, 0x6c, 0xe2, 0xb8, 0xc4, 0xa1, 0x86 },
599
 
                { 0xe8, 0x80, 0xa1, 0xb5, 0x80, 0xb6 },
600
 
                { 0x9f, 0x07 },
601
 
                { 0x2d, 0x16, 0xc5, 0xcd, 0x1f, 0xdf, 0x6b, 0x22,
602
 
                  0x38, 0x35, 0x84, 0xe3, 0xbe, 0xf2, 0xa8, 0xd8 },
603
 
                { 0xdc, 0xf0, 0x7c, 0xbd, 0x51, 0x85, 0x52, 0x90,
604
 
                  0xb9, 0x2a, 0x07, 0xa9, 0x89, 0x1e, 0x52, 0x3e },
605
 
                { 0x49, 0xe7, 0x85, 0xdd, 0x12, 0x62, 0x6e, 0xf2 },
606
 
                { 0x9e, 0x85, 0x79, 0x03, 0x36, 0xbb, 0x3f, 0xa2 },
607
 
                { 0x58, 0x60, 0xfc, 0x1b, 0xce, 0x35, 0x1e, 0x7e },
608
 
                { 0x76, 0x57, 0x76, 0x6b, 0x37, 0x3d, 0x1c, 0x21,
609
 
                  0x38, 0xf3, 0x07, 0xe3, 0xde, 0x92, 0x42, 0xf9 },
610
 
                { 0x1c, 0x42, 0xe9, 0x60, 0xd8, 0x9b, 0x8f, 0xa9,
611
 
                  0x9f, 0x27, 0x44, 0xe0, 0x70, 0x8c, 0xcb, 0x53 },
612
 
                { 0x31, 0xe1, 0x1a, 0x60, 0x91, 0x18 },
613
 
                { 0xfe, 0x25, 0x55, 0xe5, 0x4a, 0xa9 }
614
 
        }, {
615
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.6 Test Set 6 */
616
 
                { 0x6c, 0x38, 0xa1, 0x16, 0xac, 0x28, 0x0c, 0x45,
617
 
                  0x4f, 0x59, 0x33, 0x2e, 0xe3, 0x5c, 0x8c, 0x4f },
618
 
                { 0xee, 0x64, 0x66, 0xbc, 0x96, 0x20, 0x2c, 0x5a,
619
 
                  0x55, 0x7a, 0xbb, 0xef, 0xf8, 0xba, 0xbf, 0x63 },
620
 
                { 0x41, 0x4b, 0x98, 0x22, 0x21, 0x81 },
621
 
                { 0x44, 0x64 },
622
 
                { 0x1b, 0xa0, 0x0a, 0x1a, 0x7c, 0x67, 0x00, 0xac,
623
 
                  0x8c, 0x3f, 0xf3, 0xe9, 0x6a, 0xd0, 0x87, 0x25 },
624
 
                { 0x38, 0x03, 0xef, 0x53, 0x63, 0xb9, 0x47, 0xc6,
625
 
                  0xaa, 0xa2, 0x25, 0xe5, 0x8f, 0xae, 0x39, 0x34 },
626
 
                { 0x07, 0x8a, 0xdf, 0xb4, 0x88, 0x24, 0x1a, 0x57 },
627
 
                { 0x80, 0x24, 0x6b, 0x8d, 0x01, 0x86, 0xbc, 0xf1 },
628
 
                { 0x16, 0xc8, 0x23, 0x3f, 0x05, 0xa0, 0xac, 0x28 },
629
 
                { 0x3f, 0x8c, 0x75, 0x87, 0xfe, 0x8e, 0x4b, 0x23,
630
 
                  0x3a, 0xf6, 0x76, 0xae, 0xde, 0x30, 0xba, 0x3b },
631
 
                { 0xa7, 0x46, 0x6c, 0xc1, 0xe6, 0xb2, 0xa1, 0x33,
632
 
                  0x7d, 0x49, 0xd3, 0xb6, 0x6e, 0x95, 0xd7, 0xb4 },
633
 
                { 0x45, 0xb0, 0xf6, 0x9a, 0xb0, 0x6c },
634
 
                { 0x1f, 0x53, 0xcd, 0x2b, 0x11, 0x13 }
635
 
        }, {
636
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.7 Test Set 7 */
637
 
                { 0x2d, 0x60, 0x9d, 0x4d, 0xb0, 0xac, 0x5b, 0xf0,
638
 
                  0xd2, 0xc0, 0xde, 0x26, 0x70, 0x14, 0xde, 0x0d },
639
 
                { 0x19, 0x4a, 0xa7, 0x56, 0x01, 0x38, 0x96, 0xb7,
640
 
                  0x4b, 0x4a, 0x2a, 0x3b, 0x0a, 0xf4, 0x53, 0x9e },
641
 
                { 0x6b, 0xf6, 0x94, 0x38, 0xc2, 0xe4 },
642
 
                { 0x5f, 0x67 },
643
 
                { 0x46, 0x0a, 0x48, 0x38, 0x54, 0x27, 0xaa, 0x39,
644
 
                  0x26, 0x4a, 0xac, 0x8e, 0xfc, 0x9e, 0x73, 0xe8 },
645
 
                { 0xc3, 0x5a, 0x0a, 0xb0, 0xbc, 0xbf, 0xc9, 0x25,
646
 
                  0x2c, 0xaf, 0xf1, 0x5f, 0x24, 0xef, 0xbd, 0xe0 },
647
 
                { 0xbd, 0x07, 0xd3, 0x00, 0x3b, 0x9e, 0x5c, 0xc3 },
648
 
                { 0xbc, 0xb6, 0xc2, 0xfc, 0xad, 0x15, 0x22, 0x50 },
649
 
                { 0x8c, 0x25, 0xa1, 0x6c, 0xd9, 0x18, 0xa1, 0xdf },
650
 
                { 0x4c, 0xd0, 0x84, 0x60, 0x20, 0xf8, 0xfa, 0x07,
651
 
                  0x31, 0xdd, 0x47, 0xcb, 0xdc, 0x6b, 0xe4, 0x11 },
652
 
                { 0x88, 0xab, 0x80, 0xa4, 0x15, 0xf1, 0x5c, 0x73,
653
 
                  0x71, 0x12, 0x54, 0xa1, 0xd3, 0x88, 0xf6, 0x96 },
654
 
                { 0x7e, 0x64, 0x55, 0xf3, 0x4c, 0xf3 },
655
 
                { 0xdc, 0x6d, 0xd0, 0x1e, 0x8f, 0x15 }
656
 
        }, {
657
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.8 Test Set 8 */
658
 
                { 0xa5, 0x30, 0xa7, 0xfe, 0x42, 0x8f, 0xad, 0x10,
659
 
                  0x82, 0xc4, 0x5e, 0xdd, 0xfc, 0xe1, 0x38, 0x84 },
660
 
                { 0x3a, 0x4c, 0x2b, 0x32, 0x45, 0xc5, 0x0e, 0xb5,
661
 
                  0xc7, 0x1d, 0x08, 0x63, 0x93, 0x95, 0x76, 0x4d },
662
 
                { 0xf6, 0x3f, 0x5d, 0x76, 0x87, 0x84 },
663
 
                { 0xb9, 0x0e },
664
 
                { 0x51, 0x1c, 0x6c, 0x4e, 0x83, 0xe3, 0x8c, 0x89,
665
 
                  0xb1, 0xc5, 0xd8, 0xdd, 0xe6, 0x24, 0x26, 0xfa },
666
 
                { 0x27, 0x95, 0x3e, 0x49, 0xbc, 0x8a, 0xf6, 0xdc,
667
 
                  0xc6, 0xe7, 0x30, 0xeb, 0x80, 0x28, 0x6b, 0xe3 },
668
 
                { 0x53, 0x76, 0x1f, 0xbd, 0x67, 0x9b, 0x0b, 0xad },
669
 
                { 0x21, 0xad, 0xfd, 0x33, 0x4a, 0x10, 0xe7, 0xce },
670
 
                { 0xa6, 0x32, 0x41, 0xe1, 0xff, 0xc3, 0xe5, 0xab },
671
 
                { 0x10, 0xf0, 0x5b, 0xab, 0x75, 0xa9, 0x9a, 0x5f,
672
 
                  0xbb, 0x98, 0xa9, 0xc2, 0x87, 0x67, 0x9c, 0x3b },
673
 
                { 0xf9, 0xec, 0x08, 0x65, 0xeb, 0x32, 0xf2, 0x23,
674
 
                  0x69, 0xca, 0xde, 0x40, 0xc5, 0x9c, 0x3a, 0x44 },
675
 
                { 0x88, 0x19, 0x6c, 0x47, 0x98, 0x6f },
676
 
                { 0xc9, 0x87, 0xa3, 0xd2, 0x31, 0x15 }
677
 
        }, {
678
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.9 Test Set 9 */
679
 
                { 0xd9, 0x15, 0x1c, 0xf0, 0x48, 0x96, 0xe2, 0x58,
680
 
                  0x30, 0xbf, 0x2e, 0x08, 0x26, 0x7b, 0x83, 0x60 },
681
 
                { 0xf7, 0x61, 0xe5, 0xe9, 0x3d, 0x60, 0x3f, 0xeb,
682
 
                  0x73, 0x0e, 0x27, 0x55, 0x6c, 0xb8, 0xa2, 0xca },
683
 
                { 0x47, 0xee, 0x01, 0x99, 0x82, 0x0a },
684
 
                { 0x91, 0x13 },
685
 
                { 0x75, 0xfc, 0x22, 0x33, 0xa4, 0x42, 0x94, 0xee,
686
 
                  0x8e, 0x6d, 0xe2, 0x5c, 0x43, 0x53, 0xd2, 0x6b },
687
 
                { 0xc4, 0xc9, 0x3e, 0xff, 0xe8, 0xa0, 0x81, 0x38,
688
 
                  0xc2, 0x03, 0xd4, 0xc2, 0x7c, 0xe4, 0xe3, 0xd9 },
689
 
                { 0x66, 0xcc, 0x4b, 0xe4, 0x48, 0x62, 0xaf, 0x1f },
690
 
                { 0x7a, 0x4b, 0x8d, 0x7a, 0x87, 0x53, 0xf2, 0x46 },
691
 
                { 0x4a, 0x90, 0xb2, 0x17, 0x1a, 0xc8, 0x3a, 0x76 },
692
 
                { 0x71, 0x23, 0x6b, 0x71, 0x29, 0xf9, 0xb2, 0x2a,
693
 
                  0xb7, 0x7e, 0xa7, 0xa5, 0x4c, 0x96, 0xda, 0x22 },
694
 
                { 0x90, 0x52, 0x7e, 0xba, 0xa5, 0x58, 0x89, 0x68,
695
 
                  0xdb, 0x41, 0x72, 0x73, 0x25, 0xa0, 0x4d, 0x9e },
696
 
                { 0x82, 0xa0, 0xf5, 0x28, 0x7a, 0x71 },
697
 
                { 0x52, 0x7d, 0xbf, 0x41, 0xf3, 0x5f }
698
 
        }, {
699
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.10 Test Set 10 */
700
 
                { 0xa0, 0xe2, 0x97, 0x1b, 0x68, 0x22, 0xe8, 0xd3,
701
 
                  0x54, 0xa1, 0x8c, 0xc2, 0x35, 0x62, 0x4e, 0xcb },
702
 
                { 0x08, 0xef, 0xf8, 0x28, 0xb1, 0x3f, 0xdb, 0x56,
703
 
                  0x27, 0x22, 0xc6, 0x5c, 0x7f, 0x30, 0xa9, 0xb2 },
704
 
                { 0xdb, 0x5c, 0x06, 0x64, 0x81, 0xe0 },
705
 
                { 0x71, 0x6b },
706
 
                { 0x32, 0x37, 0x92, 0xfa, 0xca, 0x21, 0xfb, 0x4d,
707
 
                  0x5d, 0x6f, 0x13, 0xc1, 0x45, 0xa9, 0xd2, 0xc1 },
708
 
                { 0x82, 0xa2, 0x6f, 0x22, 0xbb, 0xa9, 0xe9, 0x48,
709
 
                  0x8f, 0x94, 0x9a, 0x10, 0xd9, 0x8e, 0x9c, 0xc4 },
710
 
                { 0x94, 0x85, 0xfe, 0x24, 0x62, 0x1c, 0xb9, 0xf6 },
711
 
                { 0xbc, 0xe3, 0x25, 0xce, 0x03, 0xe2, 0xe9, 0xb9 },
712
 
                { 0x4b, 0xc2, 0x21, 0x2d, 0x86, 0x24, 0x91, 0x0a },
713
 
                { 0x08, 0xce, 0xf6, 0xd0, 0x04, 0xec, 0x61, 0x47,
714
 
                  0x1a, 0x3c, 0x3c, 0xda, 0x04, 0x81, 0x37, 0xfa },
715
 
                { 0xed, 0x03, 0x18, 0xca, 0x5d, 0xeb, 0x92, 0x06,
716
 
                  0x27, 0x2f, 0x6e, 0x8f, 0xa6, 0x4b, 0xa4, 0x11 },
717
 
                { 0xa2, 0xf8, 0x58, 0xaa, 0x9e, 0x5d },
718
 
                { 0x74, 0xe7, 0x6f, 0xbb, 0xec, 0x38 }
719
 
        }, {
720
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.11 Test Set 11 */
721
 
                { 0x0d, 0xa6, 0xf7, 0xba, 0x86, 0xd5, 0xea, 0xc8,
722
 
                  0xa1, 0x9c, 0xf5, 0x63, 0xac, 0x58, 0x64, 0x2d },
723
 
                { 0x67, 0x9a, 0xc4, 0xdb, 0xac, 0xd7, 0xd2, 0x33,
724
 
                  0xff, 0x9d, 0x68, 0x06, 0xf4, 0x14, 0x9c, 0xe3 },
725
 
                { 0x6e, 0x23, 0x31, 0xd6, 0x92, 0xad },
726
 
                { 0x22, 0x4a },
727
 
                { 0x4b, 0x9a, 0x26, 0xfa, 0x45, 0x9e, 0x3a, 0xcb,
728
 
                  0xff, 0x36, 0xf4, 0x01, 0x5d, 0xe3, 0xbd, 0xc1 },
729
 
                { 0x0d, 0xb1, 0x07, 0x1f, 0x87, 0x67, 0x56, 0x2c,
730
 
                  0xa4, 0x3a, 0x0a, 0x64, 0xc4, 0x1e, 0x8d, 0x08 },
731
 
                { 0x28, 0x31, 0xd7, 0xae, 0x90, 0x88, 0xe4, 0x92 },
732
 
                { 0x9b, 0x2e, 0x16, 0x95, 0x11, 0x35, 0xd5, 0x23 },
733
 
                { 0x6f, 0xc3, 0x0f, 0xee, 0x6d, 0x12, 0x35, 0x23 },
734
 
                { 0x69, 0xb1, 0xca, 0xe7, 0xc7, 0x42, 0x9d, 0x97,
735
 
                  0x5e, 0x24, 0x5c, 0xac, 0xb0, 0x5a, 0x51, 0x7c },
736
 
                { 0x74, 0xf2, 0x4e, 0x8c, 0x26, 0xdf, 0x58, 0xe1,
737
 
                  0xb3, 0x8d, 0x7d, 0xcd, 0x4f, 0x1b, 0x7f, 0xbd },
738
 
                { 0x4c, 0x53, 0x9a, 0x26, 0xe1, 0xfa },
739
 
                { 0x07, 0x86, 0x1e, 0x12, 0x69, 0x28 }
740
 
        }, {
741
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.12 Test Set 12 */
742
 
                { 0x77, 0xb4, 0x58, 0x43, 0xc8, 0x8e, 0x58, 0xc1,
743
 
                  0x0d, 0x20, 0x26, 0x84, 0x51, 0x5e, 0xd4, 0x30 },
744
 
                { 0x4c, 0x47, 0xeb, 0x30, 0x76, 0xdc, 0x55, 0xfe,
745
 
                  0x51, 0x06, 0xcb, 0x20, 0x34, 0xb8, 0xcd, 0x78 },
746
 
                { 0xfe, 0x1a, 0x87, 0x31, 0x00, 0x5d },
747
 
                { 0xad, 0x25 },
748
 
                { 0xbf, 0x32, 0x86, 0xc7, 0xa5, 0x14, 0x09, 0xce,
749
 
                  0x95, 0x72, 0x4d, 0x50, 0x3b, 0xfe, 0x6e, 0x70 },
750
 
                { 0xd4, 0x83, 0xaf, 0xae, 0x56, 0x24, 0x09, 0xa3,
751
 
                  0x26, 0xb5, 0xbb, 0x0b, 0x20, 0xc4, 0xd7, 0x62 },
752
 
                { 0x08, 0x33, 0x2d, 0x7e, 0x9f, 0x48, 0x45, 0x70 },
753
 
                { 0xed, 0x41, 0xb7, 0x34, 0x48, 0x9d, 0x52, 0x07 },
754
 
                { 0xae, 0xfa, 0x35, 0x7b, 0xea, 0xc2, 0xa8, 0x7a },
755
 
                { 0x90, 0x8c, 0x43, 0xf0, 0x56, 0x9c, 0xb8, 0xf7,
756
 
                  0x4b, 0xc9, 0x71, 0xe7, 0x06, 0xc3, 0x6c, 0x5f },
757
 
                { 0xc2, 0x51, 0xdf, 0x0d, 0x88, 0x8d, 0xd9, 0x32,
758
 
                  0x9b, 0xcf, 0x46, 0x65, 0x5b, 0x22, 0x6e, 0x40 },
759
 
                { 0x30, 0xff, 0x25, 0xcd, 0xad, 0xf6 },
760
 
                { 0xe8, 0x4e, 0xd0, 0xd4, 0x67, 0x7e }
761
 
        }, {
762
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.13 Test Set 13 */
763
 
                { 0x72, 0x9b, 0x17, 0x72, 0x92, 0x70, 0xdd, 0x87,
764
 
                  0xcc, 0xdf, 0x1b, 0xfe, 0x29, 0xb4, 0xe9, 0xbb },
765
 
                { 0x31, 0x1c, 0x4c, 0x92, 0x97, 0x44, 0xd6, 0x75,
766
 
                  0xb7, 0x20, 0xf3, 0xb7, 0xe9, 0xb1, 0xcb, 0xd0 },
767
 
                { 0xc8, 0x5c, 0x4c, 0xf6, 0x59, 0x16 },
768
 
                { 0x5b, 0xb2 },
769
 
                { 0xd0, 0x4c, 0x9c, 0x35, 0xbd, 0x22, 0x62, 0xfa,
770
 
                  0x81, 0x0d, 0x29, 0x24, 0xd0, 0x36, 0xfd, 0x13 },
771
 
                { 0x22, 0x8c, 0x2f, 0x2f, 0x06, 0xac, 0x32, 0x68,
772
 
                  0xa9, 0xe6, 0x16, 0xee, 0x16, 0xdb, 0x4b, 0xa1 },
773
 
                { 0xff, 0x79, 0x4f, 0xe2, 0xf8, 0x27, 0xeb, 0xf8 },
774
 
                { 0x24, 0xfe, 0x4d, 0xc6, 0x1e, 0x87, 0x4b, 0x52 },
775
 
                { 0x98, 0xdb, 0xbd, 0x09, 0x9b, 0x3b, 0x40, 0x8d },
776
 
                { 0x44, 0xc0, 0xf2, 0x3c, 0x54, 0x93, 0xcf, 0xd2,
777
 
                  0x41, 0xe4, 0x8f, 0x19, 0x7e, 0x1d, 0x10, 0x12 },
778
 
                { 0x0c, 0x9f, 0xb8, 0x16, 0x13, 0x88, 0x4c, 0x25,
779
 
                  0x35, 0xdd, 0x0e, 0xab, 0xf3, 0xb4, 0x40, 0xd8 },
780
 
                { 0x53, 0x80, 0xd1, 0x58, 0xcf, 0xe3 },
781
 
                { 0x87, 0xac, 0x3b, 0x55, 0x9f, 0xb6 }
782
 
        }, {
783
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.14 Test Set 14 */
784
 
                { 0xd3, 0x2d, 0xd2, 0x3e, 0x89, 0xdc, 0x66, 0x23,
785
 
                  0x54, 0xca, 0x12, 0xeb, 0x79, 0xdd, 0x32, 0xfa },
786
 
                { 0xcf, 0x7d, 0x0a, 0xb1, 0xd9, 0x43, 0x06, 0x95,
787
 
                  0x0b, 0xf1, 0x20, 0x18, 0xfb, 0xd4, 0x68, 0x87 },
788
 
                { 0x48, 0x41, 0x07, 0xe5, 0x6a, 0x43 },
789
 
                { 0xb5, 0xe6 },
790
 
                { 0xfe, 0x75, 0x90, 0x5b, 0x9d, 0xa4, 0x7d, 0x35,
791
 
                  0x62, 0x36, 0xd0, 0x31, 0x4e, 0x09, 0xc3, 0x2e },
792
 
                { 0xd2, 0x2a, 0x4b, 0x41, 0x80, 0xa5, 0x32, 0x57,
793
 
                  0x08, 0xa5, 0xff, 0x70, 0xd9, 0xf6, 0x7e, 0xc7 },
794
 
                { 0xcf, 0x19, 0xd6, 0x2b, 0x6a, 0x80, 0x98, 0x66 },
795
 
                { 0x5d, 0x26, 0x95, 0x37, 0xe4, 0x5e, 0x2c, 0xe6 },
796
 
                { 0xaf, 0x4a, 0x41, 0x1e, 0x11, 0x39, 0xf2, 0xc2 },
797
 
                { 0x5a, 0xf8, 0x6b, 0x80, 0xed, 0xb7, 0x0d, 0xf5,
798
 
                  0x29, 0x2c, 0xc1, 0x12, 0x1c, 0xba, 0xd5, 0x0c },
799
 
                { 0x7f, 0x4d, 0x6a, 0xe7, 0x44, 0x0e, 0x18, 0x78,
800
 
                  0x9a, 0x8b, 0x75, 0xad, 0x3f, 0x42, 0xf0, 0x3a },
801
 
                { 0x21, 0x7a, 0xf4, 0x92, 0x72, 0xad },
802
 
                { 0x90, 0x0e, 0x10, 0x1c, 0x67, 0x7e }
803
 
        }, {
804
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.15 Test Set 15 */
805
 
                { 0xaf, 0x7c, 0x65, 0xe1, 0x92, 0x72, 0x21, 0xde,
806
 
                  0x59, 0x11, 0x87, 0xa2, 0xc5, 0x98, 0x7a, 0x53 },
807
 
                { 0x1f, 0x0f, 0x85, 0x78, 0x46, 0x4f, 0xd5, 0x9b,
808
 
                  0x64, 0xbe, 0xd2, 0xd0, 0x94, 0x36, 0xb5, 0x7a },
809
 
                { 0x3d, 0x62, 0x7b, 0x01, 0x41, 0x8d },
810
 
                { 0x84, 0xf6 },
811
 
                { 0x0c, 0x7a, 0xcb, 0x8d, 0x95, 0xb7, 0xd4, 0xa3,
812
 
                  0x1c, 0x5a, 0xca, 0x6d, 0x26, 0x34, 0x5a, 0x88 },
813
 
                { 0xa4, 0xcf, 0x5c, 0x81, 0x55, 0xc0, 0x8a, 0x7e,
814
 
                  0xff, 0x41, 0x8e, 0x54, 0x43, 0xb9, 0x8e, 0x55 },
815
 
                { 0xc3, 0x7c, 0xae, 0x78, 0x05, 0x64, 0x20, 0x32 },
816
 
                { 0x68, 0xcd, 0x09, 0xa4, 0x52, 0xd8, 0xdb, 0x7c },
817
 
                { 0x7b, 0xff, 0xa5, 0xc2, 0xf4, 0x1f, 0xbc, 0x05 },
818
 
                { 0x3f, 0x8c, 0x3f, 0x3c, 0xcf, 0x76, 0x25, 0xbf,
819
 
                  0x77, 0xfc, 0x94, 0xbc, 0xfd, 0x22, 0xfd, 0x26 },
820
 
                { 0xab, 0xcb, 0xae, 0x8f, 0xd4, 0x61, 0x15, 0xe9,
821
 
                  0x96, 0x1a, 0x55, 0xd0, 0xda, 0x5f, 0x20, 0x78 },
822
 
                { 0x83, 0x7f, 0xd7, 0xb7, 0x44, 0x19 },
823
 
                { 0x56, 0xe9, 0x7a, 0x60, 0x90, 0xb1 }
824
 
        }, {
825
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.16 Test Set 16 */
826
 
                { 0x5b, 0xd7, 0xec, 0xd3, 0xd3, 0x12, 0x7a, 0x41,
827
 
                  0xd1, 0x25, 0x39, 0xbe, 0xd4, 0xe7, 0xcf, 0x71 },
828
 
                { 0x59, 0xb7, 0x5f, 0x14, 0x25, 0x1c, 0x75, 0x03,
829
 
                  0x1d, 0x0b, 0xcb, 0xac, 0x1c, 0x2c, 0x04, 0xc7 },
830
 
                { 0xa2, 0x98, 0xae, 0x89, 0x29, 0xdc },
831
 
                { 0xd0, 0x56 },
832
 
                { 0xf9, 0x67, 0xf7, 0x60, 0x38, 0xb9, 0x20, 0xa9,
833
 
                  0xcd, 0x25, 0xe1, 0x0c, 0x08, 0xb4, 0x99, 0x24 },
834
 
                { 0x76, 0x08, 0x9d, 0x3c, 0x0f, 0xf3, 0xef, 0xdc,
835
 
                  0x6e, 0x36, 0x72, 0x1d, 0x4f, 0xce, 0xb7, 0x47 },
836
 
                { 0xc3, 0xf2, 0x5c, 0xd9, 0x43, 0x09, 0x10, 0x7e },
837
 
                { 0xb0, 0xc8, 0xba, 0x34, 0x36, 0x65, 0xaf, 0xcc },
838
 
                { 0x7e, 0x3f, 0x44, 0xc7, 0x59, 0x1f, 0x6f, 0x45 },
839
 
                { 0xd4, 0x2b, 0x2d, 0x61, 0x5e, 0x49, 0xa0, 0x3a,
840
 
                  0xc2, 0x75, 0xa5, 0xae, 0xf9, 0x7a, 0xf8, 0x92 },
841
 
                { 0x0b, 0x3f, 0x8d, 0x02, 0x4f, 0xe6, 0xbf, 0xaf,
842
 
                  0xaa, 0x98, 0x2b, 0x8f, 0x82, 0xe3, 0x19, 0xc2 },
843
 
                { 0x5b, 0xe1, 0x14, 0x95, 0x52, 0x5d },
844
 
                { 0x4d, 0x6a, 0x34, 0xa1, 0xe4, 0xeb }
845
 
        }, {
846
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.17 Test Set 17 */
847
 
                { 0x6c, 0xd1, 0xc6, 0xce, 0xb1, 0xe0, 0x1e, 0x14,
848
 
                  0xf1, 0xb8, 0x23, 0x16, 0xa9, 0x0b, 0x7f, 0x3d },
849
 
                { 0xf6, 0x9b, 0x78, 0xf3, 0x00, 0xa0, 0x56, 0x8b,
850
 
                  0xce, 0x9f, 0x0c, 0xb9, 0x3c, 0x4b, 0xe4, 0xc9 },
851
 
                { 0xb4, 0xfc, 0xe5, 0xfe, 0xb0, 0x59 },
852
 
                { 0xe4, 0xbb },
853
 
                { 0x07, 0x8b, 0xfc, 0xa9, 0x56, 0x46, 0x59, 0xec,
854
 
                  0xd8, 0x85, 0x1e, 0x84, 0xe6, 0xc5, 0x9b, 0x48 },
855
 
                { 0xa2, 0x19, 0xdc, 0x37, 0xf1, 0xdc, 0x7d, 0x66,
856
 
                  0x73, 0x8b, 0x58, 0x43, 0xc7, 0x99, 0xf2, 0x06 },
857
 
                { 0x69, 0xa9, 0x08, 0x69, 0xc2, 0x68, 0xcb, 0x7b },
858
 
                { 0x2e, 0x0f, 0xdc, 0xf9, 0xfd, 0x1c, 0xfa, 0x6a },
859
 
                { 0x70, 0xf6, 0xbd, 0xb9, 0xad, 0x21, 0x52, 0x5f },
860
 
                { 0x6e, 0xda, 0xf9, 0x9e, 0x5b, 0xd9, 0xf8, 0x5d,
861
 
                  0x5f, 0x36, 0xd9, 0x1c, 0x12, 0x72, 0xfb, 0x4b },
862
 
                { 0xd6, 0x1c, 0x85, 0x3c, 0x28, 0x0d, 0xd9, 0xc4,
863
 
                  0x6f, 0x29, 0x7b, 0xae, 0xc3, 0x86, 0xde, 0x17 },
864
 
                { 0x1c, 0x40, 0x8a, 0x85, 0x8b, 0x3e },
865
 
                { 0xaa, 0x4a, 0xe5, 0x2d, 0xaa, 0x30 }
866
 
        }, {
867
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.18 Test Set 18 */
868
 
                { 0xb7, 0x3a, 0x90, 0xcb, 0xcf, 0x3a, 0xfb, 0x62,
869
 
                  0x2d, 0xba, 0x83, 0xc5, 0x8a, 0x84, 0x15, 0xdf },
870
 
                { 0xb1, 0x20, 0xf1, 0xc1, 0xa0, 0x10, 0x2a, 0x2f,
871
 
                  0x50, 0x7d, 0xd5, 0x43, 0xde, 0x68, 0x28, 0x1f },
872
 
                { 0xf1, 0xe8, 0xa5, 0x23, 0xa3, 0x6d },
873
 
                { 0x47, 0x1b },
874
 
                { 0xb6, 0x72, 0x04, 0x7e, 0x00, 0x3b, 0xb9, 0x52,
875
 
                  0xdc, 0xa6, 0xcb, 0x8a, 0xf0, 0xe5, 0xb7, 0x79 },
876
 
                { 0xdf, 0x0c, 0x67, 0x86, 0x8f, 0xa2, 0x5f, 0x74,
877
 
                  0x8b, 0x70, 0x44, 0xc6, 0xe7, 0xc2, 0x45, 0xb8 },
878
 
                { 0xeb, 0xd7, 0x03, 0x41, 0xbc, 0xd4, 0x15, 0xb0 },
879
 
                { 0x12, 0x35, 0x9f, 0x5d, 0x82, 0x22, 0x0c, 0x14 },
880
 
                { 0x47, 0x9d, 0xd2, 0x5c, 0x20, 0x79, 0x2d, 0x63 },
881
 
                { 0x66, 0x19, 0x5d, 0xbe, 0xd0, 0x31, 0x32, 0x74,
882
 
                  0xc5, 0xca, 0x77, 0x66, 0x61, 0x5f, 0xa2, 0x5e },
883
 
                { 0x66, 0xbe, 0xc7, 0x07, 0xeb, 0x2a, 0xfc, 0x47,
884
 
                  0x6d, 0x74, 0x08, 0xa8, 0xf2, 0x92, 0x7b, 0x36 },
885
 
                { 0xae, 0xfd, 0xaa, 0x5d, 0xdd, 0x99 },
886
 
                { 0x12, 0xec, 0x2b, 0x87, 0xfb, 0xb1 }
887
 
        }, {
888
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.19 Test Set 19 */
889
 
                { 0x51, 0x22, 0x25, 0x02, 0x14, 0xc3, 0x3e, 0x72,
890
 
                  0x3a, 0x5d, 0xd5, 0x23, 0xfc, 0x14, 0x5f, 0xc0 },
891
 
                { 0x81, 0xe9, 0x2b, 0x6c, 0x0e, 0xe0, 0xe1, 0x2e,
892
 
                  0xbc, 0xeb, 0xa8, 0xd9, 0x2a, 0x99, 0xdf, 0xa5 },
893
 
                { 0x16, 0xf3, 0xb3, 0xf7, 0x0f, 0xc2 },
894
 
                { 0xc3, 0xab },
895
 
                { 0xc9, 0xe8, 0x76, 0x32, 0x86, 0xb5, 0xb9, 0xff,
896
 
                  0xbd, 0xf5, 0x6e, 0x12, 0x97, 0xd0, 0x88, 0x7b },
897
 
                { 0x98, 0x1d, 0x46, 0x4c, 0x7c, 0x52, 0xeb, 0x6e,
898
 
                  0x50, 0x36, 0x23, 0x49, 0x84, 0xad, 0x0b, 0xcf },
899
 
                { 0x2a, 0x5c, 0x23, 0xd1, 0x5e, 0xe3, 0x51, 0xd5 },
900
 
                { 0x62, 0xda, 0xe3, 0x85, 0x3f, 0x3a, 0xf9, 0xd2 },
901
 
                { 0x28, 0xd7, 0xb0, 0xf2, 0xa2, 0xec, 0x3d, 0xe5 },
902
 
                { 0x53, 0x49, 0xfb, 0xe0, 0x98, 0x64, 0x9f, 0x94,
903
 
                  0x8f, 0x5d, 0x2e, 0x97, 0x3a, 0x81, 0xc0, 0x0f },
904
 
                { 0x97, 0x44, 0x87, 0x1a, 0xd3, 0x2b, 0xf9, 0xbb,
905
 
                  0xd1, 0xdd, 0x5c, 0xe5, 0x4e, 0x3e, 0x2e, 0x5a },
906
 
                { 0xad, 0xa1, 0x5a, 0xeb, 0x7b, 0xb8 },
907
 
                { 0xd4, 0x61, 0xbc, 0x15, 0x47, 0x5d }
908
 
        }, {
909
 
                /* 3GPP TS 35.208 v6.0.0 - 4.3.20 Test Set 20 */
910
 
                { 0x90, 0xdc, 0xa4, 0xed, 0xa4, 0x5b, 0x53, 0xcf,
911
 
                  0x0f, 0x12, 0xd7, 0xc9, 0xc3, 0xbc, 0x6a, 0x89 },
912
 
                { 0x9f, 0xdd, 0xc7, 0x20, 0x92, 0xc6, 0xad, 0x03,
913
 
                  0x6b, 0x6e, 0x46, 0x47, 0x89, 0x31, 0x5b, 0x78 },
914
 
                { 0x20, 0xf8, 0x13, 0xbd, 0x41, 0x41 },
915
 
                { 0x61, 0xdf },
916
 
                { 0x3f, 0xfc, 0xfe, 0x5b, 0x7b, 0x11, 0x11, 0x58,
917
 
                  0x99, 0x20, 0xd3, 0x52, 0x8e, 0x84, 0xe6, 0x55 },
918
 
                { 0xcb, 0x9c, 0xcc, 0xc4, 0xb9, 0x25, 0x8e, 0x6d,
919
 
                  0xca, 0x47, 0x60, 0x37, 0x9f, 0xb8, 0x25, 0x81 },
920
 
                { 0x09, 0xdb, 0x94, 0xea, 0xb4, 0xf8, 0x14, 0x9e },
921
 
                { 0xa2, 0x94, 0x68, 0xaa, 0x97, 0x75, 0xb5, 0x27 },
922
 
                { 0xa9, 0x51, 0x00, 0xe2, 0x76, 0x09, 0x52, 0xcd },
923
 
                { 0xb5, 0xf2, 0xda, 0x03, 0x88, 0x3b, 0x69, 0xf9,
924
 
                  0x6b, 0xf5, 0x2e, 0x02, 0x9e, 0xd9, 0xac, 0x45 },
925
 
                { 0xb4, 0x72, 0x13, 0x68, 0xbc, 0x16, 0xea, 0x67,
926
 
                  0x87, 0x5c, 0x55, 0x98, 0x68, 0x8b, 0xb0, 0xef },
927
 
                { 0x83, 0xcf, 0xd5, 0x4d, 0xb9, 0x13 },
928
 
                { 0x4f, 0x20, 0x39, 0x39, 0x2d, 0xdc }
929
 
        }
930
 
};
931
 
 
932
 
#define NUM_TESTS (sizeof(test_sets) / sizeof(test_sets[0]))
933
 
 
934
 
 
935
 
int main(int argc, char *argv[])
936
 
{
937
 
        u8 buf[16], buf2[16], buf3[16], buf4[16], buf5[16], opc[16];
938
 
        u8 auts[14], sqn[6], _rand[16];
939
 
        int ret = 0, res, i;
940
 
        const struct milenage_test_set *t;
941
 
        size_t res_len;
942
 
 
943
 
        wpa_debug_level = 0;
944
 
 
945
 
        printf("Milenage test sets\n");
946
 
        for (i = 0; i < NUM_TESTS; i++) {
947
 
                t = &test_sets[i];
948
 
                printf("Test Set %d\n", i + 1);
949
 
 
950
 
                milenage_opc(t->op, t->k, opc);
951
 
                if (memcmp(opc, t->opc, 16) != 0) {
952
 
                        printf("- milenage_opc failed\n");
953
 
                        ret++;
954
 
                }
955
 
 
956
 
                milenage_f1(opc, t->k, t->rand, t->sqn, t->amf, buf, buf2);
957
 
                if (memcmp(buf, t->f1, 8) != 0) {
958
 
                        printf("- milenage_f1 failed\n");
959
 
                        ret++;
960
 
                }
961
 
                if (memcmp(buf2, t->f1star, 8) != 0) {
962
 
                        printf("- milenage_f1* failed\n");
963
 
                        ret++;
964
 
                }
965
 
 
966
 
                milenage_f2345(opc, t->k, t->rand, buf, buf2, buf3, buf4,
967
 
                               buf5);
968
 
                if (memcmp(buf, t->f2, 8) != 0) {
969
 
                        printf("- milenage_f2 failed\n");
970
 
                        ret++;
971
 
                }
972
 
                if (memcmp(buf2, t->f3, 16) != 0) {
973
 
                        printf("- milenage_f3 failed\n");
974
 
                        ret++;
975
 
                }
976
 
                if (memcmp(buf3, t->f4, 16) != 0) {
977
 
                        printf("- milenage_f4 failed\n");
978
 
                        ret++;
979
 
                }
980
 
                if (memcmp(buf4, t->f5, 6) != 0) {
981
 
                        printf("- milenage_f5 failed\n");
982
 
                        ret++;
983
 
                }
984
 
                if (memcmp(buf5, t->f5star, 6) != 0) {
985
 
                        printf("- milenage_f5* failed\n");
986
 
                        ret++;
987
 
                }
988
 
        }
989
 
 
990
 
        printf("milenage_auts test:\n");
991
 
        memcpy(auts, "\x4f\x20\x39\x39\x2d\xdd", 6);
992
 
        memcpy(auts + 6, "\x4b\xb4\x31\x6e\xd4\xa1\x46\x88", 8);
993
 
        res = milenage_auts(t->opc, t->k, t->rand, auts, buf);
994
 
        printf("AUTS for test set %d: %d / SQN=%02x%02x%02x%02x%02x%02x\n",
995
 
               i, res, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
996
 
        if (res)
997
 
                ret++;
998
 
 
999
 
        memset(_rand, 0xaa, sizeof(_rand));
1000
 
        memcpy(auts,
1001
 
               "\x43\x68\x1a\xd3\xda\xf0\x06\xbc\xde\x40\x5a\x20\x72\x67", 14);
1002
 
        res = milenage_auts(t->opc, t->k, _rand, auts, buf);
1003
 
        printf("AUTS from a test USIM: %d / SQN=%02x%02x%02x%02x%02x%02x\n",
1004
 
               res, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
1005
 
        if (res)
1006
 
                ret++;
1007
 
 
1008
 
        printf("milenage_generate test:\n");
1009
 
        memcpy(sqn, "\x00\x00\x00\x00\x40\x44", 6);
1010
 
        memcpy(_rand, "\x12\x69\xb8\x23\x41\x39\x35\x66\xfb\x99\x41\xe9\x84"
1011
 
               "\x4f\xe6\x2f", 16);
1012
 
        res_len = 8;
1013
 
        milenage_generate(t->opc, t->amf, t->k, sqn, _rand, buf, buf2, buf3,
1014
 
                          buf4, &res_len);
1015
 
        wpa_hexdump(MSG_DEBUG, "SQN", sqn, 6);
1016
 
        wpa_hexdump(MSG_DEBUG, "RAND", _rand, 16);
1017
 
        wpa_hexdump(MSG_DEBUG, "AUTN", buf, 16);
1018
 
        wpa_hexdump(MSG_DEBUG, "IK", buf2, 16);
1019
 
        wpa_hexdump(MSG_DEBUG, "CK", buf3, 16);
1020
 
        wpa_hexdump(MSG_DEBUG, "RES", buf4, res_len);
1021
 
 
1022
 
        printf("GSM-Milenage test sets\n");
1023
 
        for (i = 0; i < NUM_GSM_TESTS; i++) {
1024
 
                const struct gsm_milenage_test_set *g;
1025
 
                u8 sres[4], kc[8];
1026
 
                g = &gsm_test_sets[i];
1027
 
                printf("Test Set %d\n", i + 1);
1028
 
                gsm_milenage(g->opc, g->ki, g->rand, sres, kc);
1029
 
                if (memcmp(g->kc, kc, 8) != 0) {
1030
 
                        printf("- gsm_milenage Kc failed\n");
1031
 
                        ret++;
1032
 
                }
1033
 
#ifdef GSM_MILENAGE_ALT_SRES
1034
 
                if (memcmp(g->sres2, sres, 4) != 0) {
1035
 
                        printf("- gsm_milenage SRES#2 failed\n");
1036
 
                        ret++;
1037
 
                }
1038
 
#else /* GSM_MILENAGE_ALT_SRES */
1039
 
                if (memcmp(g->sres1, sres, 4) != 0) {
1040
 
                        printf("- gsm_milenage SRES#1 failed\n");
1041
 
                        ret++;
1042
 
                }
1043
 
#endif /* GSM_MILENAGE_ALT_SRES */
1044
 
        }
1045
 
 
1046
 
        if (ret)
1047
 
                printf("Something failed\n");
1048
 
        else
1049
 
                printf("OK\n");
1050
 
 
1051
 
        return ret;
1052
 
}
1053
 
#endif /* TEST_MAIN_MILENAGE */