blob: f1fa2c28abc27f6bd974db64737e0f5a0276a893 [file] [log] [blame]
Neels Hofmeyr00c06972017-01-31 01:19:27 +01001/* (C) 2016 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
2 * All Rights Reserved
3 *
4 * Author: Neels Hofmeyr <nhofmeyr@sysmocom.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#include <stdio.h>
22#include <string.h>
Neels Hofmeyr6b883f72017-01-31 16:40:28 +010023#include <inttypes.h>
Neels Hofmeyr00c06972017-01-31 01:19:27 +010024
25#include <osmocom/core/application.h>
26#include <osmocom/core/utils.h>
27#include <osmocom/core/logging.h>
28
Neels Hofmeyr8cde6622017-01-31 02:10:40 +010029#include <osmocom/crypt/auth.h>
Neels Hofmeyr00c06972017-01-31 01:19:27 +010030
Neels Hofmeyr8cde6622017-01-31 02:10:40 +010031#include "logging.h"
32#include "auc.h"
33
34#define comment_start() fprintf(stderr, "\n===== %s\n", __func__);
Neels Hofmeyr00c06972017-01-31 01:19:27 +010035#define comment_end() fprintf(stderr, "===== %s: SUCCESS\n\n", __func__);
36
Neels Hofmeyr8cde6622017-01-31 02:10:40 +010037#define VERBOSE_ASSERT(val, expect_op, fmt) \
38 do { \
39 fprintf(stderr, #val " == " fmt "\n", (val)); \
40 OSMO_ASSERT((val) expect_op); \
41 } while (0);
42
Neels Hofmeyr6b883f72017-01-31 16:40:28 +010043char *vec_str(const struct osmo_auth_vector *vec)
Neels Hofmeyr8cde6622017-01-31 02:10:40 +010044{
45 static char buf[1024];
46 char *pos = buf;
47 char *end = buf + sizeof(buf);
48
49#define append(what) \
50 if (pos >= end) \
51 return buf; \
52 pos += snprintf(pos, sizeof(buf) - (pos - buf), \
53 " " #what ": %s\n", \
54 osmo_hexdump_nospc((void*)&vec->what, sizeof(vec->what)))
55
56 append(rand);
57 append(autn);
58 append(ck);
59 append(ik);
60 append(res);
61 append(res_len);
62 append(kc);
63 append(sres);
64 append(auth_types);
65#undef append
66
67 return buf;
68}
69
70#define VEC_IS(vec, expect) do { \
Neels Hofmeyr6b883f72017-01-31 16:40:28 +010071 char *_is = vec_str(vec); \
Neels Hofmeyr8cde6622017-01-31 02:10:40 +010072 fprintf(stderr, "auth vector ==\n%s\n", _is); \
73 if (strcmp(_is, expect)) { \
74 fprintf(stderr, "MISMATCH! expected ==\n%s\n", \
75 expect); \
76 char *a = _is; \
77 char *b = expect; \
78 for (; *a && *b; a++, b++) { \
79 if (*a != *b) { \
80 while (a > _is && *(a-1) != '\n') a--; \
81 fprintf(stderr, "mismatch at %d:\n" \
Neels Hofmeyr6b883f72017-01-31 16:40:28 +010082 "%s", (int)(a - _is), a); \
Neels Hofmeyr8cde6622017-01-31 02:10:40 +010083 break; \
84 } \
85 } \
86 OSMO_ASSERT(false); \
87 } \
88 } while (0)
89
Neels Hofmeyr00c06972017-01-31 01:19:27 +010090uint8_t fake_rand[16] = { 0 };
91
92int rand_get(uint8_t *rand, unsigned int len)
93{
94 OSMO_ASSERT(len <= sizeof(fake_rand));
95 memcpy(rand, fake_rand, len);
96 return len;
97}
98
Neels Hofmeyr8cde6622017-01-31 02:10:40 +010099static void test_gen_vectors_2g_only(void)
100{
101 struct osmo_sub_auth_data aud2g;
102 struct osmo_sub_auth_data aud3g;
103 struct osmo_auth_vector vec;
104 int rc;
105
106 comment_start();
107
108 aud2g = (struct osmo_sub_auth_data){
109 .type = OSMO_AUTH_TYPE_GSM,
110 .algo = OSMO_AUTH_ALG_COMP128v1,
111 };
112
113 osmo_hexparse("EB215756028D60E3275E613320AEC880",
114 aud2g.u.gsm.ki, sizeof(aud2g.u.gsm.ki));
115
Neels Hofmeyr6b883f72017-01-31 16:40:28 +0100116 aud3g = (struct osmo_sub_auth_data){ 0 };
Neels Hofmeyr8cde6622017-01-31 02:10:40 +0100117
118 osmo_hexparse("39fa2f4e3d523d8619a73b4f65c3e14d",
119 fake_rand, sizeof(fake_rand));
120
121 vec = (struct osmo_auth_vector){ {0} };
Neels Hofmeyr6b883f72017-01-31 16:40:28 +0100122 VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64);
Neels Hofmeyr8cde6622017-01-31 02:10:40 +0100123 rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL);
124 VERBOSE_ASSERT(rc, == 1, "%d");
125
126 VEC_IS(&vec,
127 " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n"
128 " autn: 00000000000000000000000000000000\n"
129 " ck: 00000000000000000000000000000000\n"
130 " ik: 00000000000000000000000000000000\n"
131 " res: 00000000000000000000000000000000\n"
132 " res_len: 00\n"
133 " kc: 241a5b16aeb8e400\n"
134 " sres: 429d5b27\n"
135 " auth_types: 01000000\n"
136 );
137
Neels Hofmeyr6b883f72017-01-31 16:40:28 +0100138 VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64);
Neels Hofmeyr8cde6622017-01-31 02:10:40 +0100139
140 /* even though vec is not zero-initialized, it should produce the same
141 * result (regardless of the umts sequence nr) */
142 aud3g.u.umts.sqn = 123;
143 rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL);
144 VERBOSE_ASSERT(rc, == 1, "%d");
145
146 VEC_IS(&vec,
147 " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n"
148 " autn: 00000000000000000000000000000000\n"
149 " ck: 00000000000000000000000000000000\n"
150 " ik: 00000000000000000000000000000000\n"
151 " res: 00000000000000000000000000000000\n"
152 " res_len: 00\n"
153 " kc: 241a5b16aeb8e400\n"
154 " sres: 429d5b27\n"
155 " auth_types: 01000000\n"
156 );
157
158 comment_end();
159}
160
161static void test_gen_vectors_2g_plus_3g(void)
162{
163 struct osmo_sub_auth_data aud2g;
164 struct osmo_sub_auth_data aud3g;
165 struct osmo_auth_vector vec;
166 int rc;
167
168 comment_start();
169
170 aud2g = (struct osmo_sub_auth_data){
171 .type = OSMO_AUTH_TYPE_GSM,
172 .algo = OSMO_AUTH_ALG_COMP128v1,
173 };
174
175 osmo_hexparse("EB215756028D60E3275E613320AEC880",
176 aud2g.u.gsm.ki, sizeof(aud2g.u.gsm.ki));
177
178 aud3g = (struct osmo_sub_auth_data){
179 .type = OSMO_AUTH_TYPE_UMTS,
180 .algo = OSMO_AUTH_ALG_MILENAGE,
181 };
182
183 osmo_hexparse("EB215756028D60E3275E613320AEC880",
184 aud3g.u.umts.k, sizeof(aud3g.u.umts.k));
185 osmo_hexparse("FB2A3D1B360F599ABAB99DB8669F8308",
186 aud3g.u.umts.opc, sizeof(aud3g.u.umts.opc));
187
188 osmo_hexparse("39fa2f4e3d523d8619a73b4f65c3e14d",
189 fake_rand, sizeof(fake_rand));
190
191 vec = (struct osmo_auth_vector){ {0} };
Neels Hofmeyr6b883f72017-01-31 16:40:28 +0100192 VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64);
Neels Hofmeyr8cde6622017-01-31 02:10:40 +0100193 rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL);
194 VERBOSE_ASSERT(rc, == 1, "%d");
195
196 VEC_IS(&vec,
197 " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n"
198 " autn: 8704f5ba55f30000d2ee44b22c8ea919\n"
199 " ck: f64735036e5871319c679f4742a75ea1\n"
200 " ik: 27497388b6cb044648f396aa155b95ef\n"
201 " res: e229c19e791f2e410000000000000000\n"
202 " res_len: 08\n"
203 " kc: 241a5b16aeb8e400\n"
204 " sres: 429d5b27\n"
205 " auth_types: 03000000\n"
206 );
207
Neels Hofmeyr6b883f72017-01-31 16:40:28 +0100208 VERBOSE_ASSERT(aud3g.u.umts.sqn, == 1, "%"PRIu64);
Neels Hofmeyr8cde6622017-01-31 02:10:40 +0100209
210 /* even though vec is not zero-initialized, it should produce the same
211 * result with the same sequence nr */
212 aud3g.u.umts.sqn = 0;
Neels Hofmeyr6b883f72017-01-31 16:40:28 +0100213 VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64);
Neels Hofmeyr8cde6622017-01-31 02:10:40 +0100214 rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL);
215 VERBOSE_ASSERT(rc, == 1, "%d");
Neels Hofmeyr6b883f72017-01-31 16:40:28 +0100216 VERBOSE_ASSERT(aud3g.u.umts.sqn, == 1, "%"PRIu64);
Neels Hofmeyr8cde6622017-01-31 02:10:40 +0100217
218 VEC_IS(&vec,
219 " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n"
220 " autn: 8704f5ba55f30000d2ee44b22c8ea919\n"
221 " ck: f64735036e5871319c679f4742a75ea1\n"
222 " ik: 27497388b6cb044648f396aa155b95ef\n"
223 " res: e229c19e791f2e410000000000000000\n"
224 " res_len: 08\n"
225 " kc: 241a5b16aeb8e400\n"
226 " sres: 429d5b27\n"
227 " auth_types: 03000000\n"
228 );
229
230 comment_end();
231}
232
Neels Hofmeyr00c06972017-01-31 01:19:27 +0100233static void test_gen_vectors_3g_only(void)
234{
Neels Hofmeyr8cde6622017-01-31 02:10:40 +0100235 struct osmo_sub_auth_data aud2g;
236 struct osmo_sub_auth_data aud3g;
237 struct osmo_auth_vector vec;
Neels Hofmeyrec9036b2017-02-21 21:56:11 +0100238 uint8_t auts[14];
239 uint8_t rand_auts[16];
Neels Hofmeyr8cde6622017-01-31 02:10:40 +0100240 int rc;
241
Neels Hofmeyr00c06972017-01-31 01:19:27 +0100242 comment_start();
Neels Hofmeyr8cde6622017-01-31 02:10:40 +0100243
244 aud2g = (struct osmo_sub_auth_data){ 0 };
245
246 aud3g = (struct osmo_sub_auth_data){
247 .type = OSMO_AUTH_TYPE_UMTS,
248 .algo = OSMO_AUTH_ALG_MILENAGE,
249 };
250
251 osmo_hexparse("EB215756028D60E3275E613320AEC880",
252 aud3g.u.umts.k, sizeof(aud3g.u.umts.k));
253 osmo_hexparse("FB2A3D1B360F599ABAB99DB8669F8308",
254 aud3g.u.umts.opc, sizeof(aud3g.u.umts.opc));
255
256 osmo_hexparse("39fa2f4e3d523d8619a73b4f65c3e14d",
257 fake_rand, sizeof(fake_rand));
258
259 vec = (struct osmo_auth_vector){ {0} };
Neels Hofmeyr6b883f72017-01-31 16:40:28 +0100260 VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64);
Neels Hofmeyr8cde6622017-01-31 02:10:40 +0100261 rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL);
262 VERBOSE_ASSERT(rc, == 1, "%d");
263
264 VEC_IS(&vec,
265 " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n"
266 " autn: 8704f5ba55f30000d2ee44b22c8ea919\n"
267 " ck: f64735036e5871319c679f4742a75ea1\n"
268 " ik: 27497388b6cb044648f396aa155b95ef\n"
269 " res: e229c19e791f2e410000000000000000\n"
270 " res_len: 08\n"
271 " kc: 059a4f668f6fbe39\n"
272 " sres: 9b36efdf\n"
273 " auth_types: 03000000\n"
274 );
275
276 /* Note: 3GPP TS 33.102 6.8.1.2: c3 function to get GSM auth is
277 * KC[0..7] == CK[0..7] ^ CK[8..15] ^ IK[0..7] ^ IK[8..15]
278 * In [16]: hex( 0xf64735036e587131
279 * ^ 0x9c679f4742a75ea1
280 * ^ 0x27497388b6cb0446
281 * ^ 0x48f396aa155b95ef)
282 * Out[16]: '0x59a4f668f6fbe39L'
283 * hence expecting kc: 059a4f668f6fbe39
284 */
285
Neels Hofmeyr6b883f72017-01-31 16:40:28 +0100286 VERBOSE_ASSERT(aud3g.u.umts.sqn, == 1, "%"PRIu64);
Neels Hofmeyr8cde6622017-01-31 02:10:40 +0100287
288 /* even though vec is not zero-initialized, it should produce the same
289 * result with the same sequence nr */
290 aud3g.u.umts.sqn = 0;
Neels Hofmeyr6b883f72017-01-31 16:40:28 +0100291 VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64);
Neels Hofmeyr8cde6622017-01-31 02:10:40 +0100292 rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL);
293 VERBOSE_ASSERT(rc, == 1, "%d");
Neels Hofmeyr6b883f72017-01-31 16:40:28 +0100294 VERBOSE_ASSERT(aud3g.u.umts.sqn, == 1, "%"PRIu64);
Neels Hofmeyr8cde6622017-01-31 02:10:40 +0100295
296 VEC_IS(&vec,
297 " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n"
298 " autn: 8704f5ba55f30000d2ee44b22c8ea919\n"
299 " ck: f64735036e5871319c679f4742a75ea1\n"
300 " ik: 27497388b6cb044648f396aa155b95ef\n"
301 " res: e229c19e791f2e410000000000000000\n"
302 " res_len: 08\n"
303 " kc: 059a4f668f6fbe39\n"
304 " sres: 9b36efdf\n"
305 " auth_types: 03000000\n"
306 );
307
Neels Hofmeyrec9036b2017-02-21 21:56:11 +0100308
309 fprintf(stderr, "- test AUTS resync\n");
310 vec = (struct osmo_auth_vector){};
311 aud3g.u.umts.sqn = 0;
312 VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64);
313
314 /* The AUTN sent was 8704f5ba55f30000d2ee44b22c8ea919
315 * with the first 6 bytes being SQN ^ AK.
316 * K = EB215756028D60E3275E613320AEC880
317 * OPC = FB2A3D1B360F599ABAB99DB8669F8308
318 * RAND = 39fa2f4e3d523d8619a73b4f65c3e14d
319 * --milenage-f5-->
320 * AK = 8704f5ba55f3
321 *
322 * The first six bytes are 8704f5ba55f3,
323 * and 8704f5ba55f3 ^ AK = 0.
324 * --> SQN = 0.
325 *
326 * Say the USIM doesn't like that, let's say it is at SQN 23.
327 * SQN_MS = 000000000017
328 *
329 * AUTS = Conc(SQN_MS) || MAC-S
330 * Conc(SQN_MS) = SQN_MS ⊕ f5*[K](RAND)
331 * MAC-S = f1*[K] (SQN MS || RAND || AMF)
332 *
333 * f5*--> Conc(SQN_MS) = 000000000017 ^ 979498b1f73a
334 * = 979498b1f72d
335 * AMF = 0000 (TS 33.102 v7.0.0, 6.3.3)
336 *
337 * MAC-S = f1*[K] (000000000017 || 39fa2f4e3d523d8619a73b4f65c3e14d || 0000)
338 * = 3e28c59fa2e72f9c
339 *
340 * AUTS = 979498b1f72d || 3e28c59fa2e72f9c
341 *
342 * verify valid AUTS resulting in SQN 23 with:
343 * osmo-auc-gen -3 -a milenage -k EB215756028D60E3275E613320AEC880 \
344 * -o FB2A3D1B360F599ABAB99DB8669F8308 \
345 * -r 39fa2f4e3d523d8619a73b4f65c3e14d \
346 * -A 979498b1f72d3e28c59fa2e72f9c
347 */
348
349 /* AUTS response by USIM */
350 osmo_hexparse("979498b1f72d3e28c59fa2e72f9c",
351 auts, sizeof(auts));
352 /* RAND sent to USIM, which AUTS was generated from */
353 osmo_hexparse("39fa2f4e3d523d8619a73b4f65c3e14d",
354 rand_auts, sizeof(rand_auts));
355 /* new RAND token for the next key */
356 osmo_hexparse("897210a0f7de278f0b8213098e098a3f",
357 fake_rand, sizeof(fake_rand));
358 rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, rand_auts, auts);
359 VERBOSE_ASSERT(rc, == 1, "%d");
360 /* The USIM's last sqn was 23, the calculated vector was 24, hence the
361 * next one stored should be 25. */
362 VERBOSE_ASSERT(aud3g.u.umts.sqn, == 25, "%"PRIu64);
363
364 VEC_IS(&vec,
365 " rand: 897210a0f7de278f0b8213098e098a3f\n"
366 " autn: c6b9790dad4b00000cf322869ea6a481\n"
367 " ck: e9922bd036718ed9e40bd1d02c3b81a5\n"
368 " ik: f19c20ca863137f8892326d959ec5e01\n"
369 " res: 9af5a557902d2db80000000000000000\n"
370 " res_len: 08\n"
371 " kc: 7526fc13c5976685\n"
372 " sres: 0ad888ef\n"
373 " auth_types: 03000000\n"
374 );
375
Neels Hofmeyr00c06972017-01-31 01:19:27 +0100376 comment_end();
377}
378
Neels Hofmeyr569d3222017-02-21 22:57:11 +0100379void test_gen_vectors_bad_args()
380{
381 struct osmo_auth_vector vec;
382 uint8_t auts[14];
383 uint8_t rand_auts[16];
384 int rc;
385 int i;
386
387 struct osmo_sub_auth_data aud2g = {
388 .type = OSMO_AUTH_TYPE_GSM,
389 .algo = OSMO_AUTH_ALG_COMP128v1,
390 };
391
392 struct osmo_sub_auth_data aud3g = {
393 .type = OSMO_AUTH_TYPE_UMTS,
394 .algo = OSMO_AUTH_ALG_MILENAGE,
395 };
396
397 struct osmo_sub_auth_data aud2g_noalg = {
398 .type = OSMO_AUTH_TYPE_GSM,
399 .algo = OSMO_AUTH_ALG_NONE,
400 };
401
402 struct osmo_sub_auth_data aud3g_noalg = {
403 .type = OSMO_AUTH_TYPE_UMTS,
404 .algo = OSMO_AUTH_ALG_NONE,
405 };
406
407 struct osmo_sub_auth_data aud_notype = {
408 .type = OSMO_AUTH_TYPE_NONE,
409 .algo = OSMO_AUTH_ALG_MILENAGE,
410 };
411
412 struct osmo_sub_auth_data no_aud = {
413 .type = OSMO_AUTH_TYPE_NONE,
414 .algo = OSMO_AUTH_ALG_NONE,
415 };
416
417 struct {
418 struct osmo_sub_auth_data *aud2g;
419 struct osmo_sub_auth_data *aud3g;
420 uint8_t *rand_auts;
421 uint8_t *auts;
422 const char *label;
423 } tests[] = {
424 { NULL, NULL, NULL, NULL, "no auth data (a)"},
425 { NULL, &aud3g_noalg, NULL, NULL, "no auth data (b)"},
426 { NULL, &aud_notype, NULL, NULL, "no auth data (c)"},
427 { NULL, &no_aud, NULL, NULL, "no auth data (d)"},
428 { &aud2g_noalg, NULL, NULL, NULL, "no auth data (e)"},
429 { &aud2g_noalg, &aud3g_noalg, NULL, NULL, "no auth data (f)"},
430 { &aud2g_noalg, &aud_notype, NULL, NULL, "no auth data (g)"},
431 { &aud2g_noalg, &no_aud, NULL, NULL, "no auth data (h)"},
432 { &aud_notype, NULL, NULL, NULL, "no auth data (i)"},
433 { &aud_notype, &aud3g_noalg, NULL, NULL, "no auth data (j)"},
434 { &aud_notype, &aud_notype, NULL, NULL, "no auth data (k)"},
435 { &aud_notype, &no_aud, NULL, NULL, "no auth data (l)"},
436 { &no_aud, NULL, NULL, NULL, "no auth data (m)"},
437 { &no_aud, &aud3g_noalg, NULL, NULL, "no auth data (n)"},
438 { &no_aud, &aud_notype, NULL, NULL, "no auth data (o)"},
439 { &no_aud, &no_aud, NULL, NULL, "no auth data (p)"},
440 { &aud3g, NULL, NULL, NULL, "wrong auth data type (a)"},
441 { &aud3g, &aud3g_noalg, NULL, NULL, "wrong auth data type (b)"},
442 { &aud3g, &aud_notype, NULL, NULL, "wrong auth data type (c)"},
443 { &aud3g, &no_aud, NULL, NULL, "wrong auth data type (d)"},
444 { NULL, &aud2g, NULL, NULL, "wrong auth data type (e)"},
445 { &aud3g_noalg, &aud2g, NULL, NULL, "wrong auth data type (f)"},
446 { &aud_notype, &aud2g, NULL, NULL, "wrong auth data type (g)"},
447 { &no_aud, &aud2g, NULL, NULL, "wrong auth data type (h)"},
448 { &aud3g, &aud2g, NULL, NULL, "wrong auth data type (i)"},
449 { &aud3g, &aud3g, NULL, NULL, "wrong auth data type (j)"},
450 { &aud2g, &aud2g, NULL, NULL, "wrong auth data type (k)"},
451 { &aud2g, NULL, rand_auts, auts, "AUTS for 2G-only (a)"},
452 { &aud2g, &aud3g_noalg, rand_auts, auts, "AUTS for 2G-only (b)"},
453 { &aud2g, &aud_notype, rand_auts, auts, "AUTS for 2G-only (c)"},
454 { &aud2g, &no_aud, rand_auts, auts, "AUTS for 2G-only (d)"},
455 { NULL, &aud3g, NULL, auts, "incomplete AUTS (a)"},
456 { NULL, &aud3g, rand_auts, NULL, "incomplete AUTS (b)"},
457 { &aud2g, &aud3g, NULL, auts, "incomplete AUTS (c)"},
458 { &aud2g, &aud3g, rand_auts, NULL, "incomplete AUTS (d)"},
459 };
460
461 comment_start();
462
463 for (i = 0; i < ARRAY_SIZE(tests); i++) {
464 fprintf(stderr, "\n- %s\n", tests[i].label);
465 rc = auc_compute_vectors(&vec, 1,
466 tests[i].aud2g,
467 tests[i].aud3g,
468 tests[i].rand_auts,
469 tests[i].auts);
470 VERBOSE_ASSERT(rc, < 0, "%d");
471 }
472
473 comment_end();
474}
475
Neels Hofmeyr00c06972017-01-31 01:19:27 +0100476int main()
477{
478 printf("auc_3g_test.c\n");
479 osmo_init_logging(&hlr_log_info);
480 log_set_print_filename(osmo_stderr_target, 0);
481 log_set_print_timestamp(osmo_stderr_target, 0);
482 log_set_use_color(osmo_stderr_target, 0);
483 log_set_print_category(osmo_stderr_target, 1);
484
Neels Hofmeyr8cde6622017-01-31 02:10:40 +0100485 test_gen_vectors_2g_only();
486 test_gen_vectors_2g_plus_3g();
Neels Hofmeyr00c06972017-01-31 01:19:27 +0100487 test_gen_vectors_3g_only();
Neels Hofmeyr569d3222017-02-21 22:57:11 +0100488 test_gen_vectors_bad_args();
Neels Hofmeyr00c06972017-01-31 01:19:27 +0100489
490 printf("Done\n");
491 return 0;
492}