blob: 36926eb7a6dfcc0a2478e608b85b4b164f566fc6 [file] [log] [blame]
Neels Hofmeyr6b883f72017-01-31 16:40:28 +01001/* gen_ts_55_205_test_sets/func_template.c: Template to generate test code
2 * from 3GPP TS 55.205 test sets */
3
4/* (C) 2016 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
5 *
6 * All Rights Reserved
7 *
8 * Author: Neels Hofmeyr <nhofmeyr@sysmocom.de>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Affero General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU Affero General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 *
23 */
24
25static void {func_name}(void)
26{{
27 struct osmo_sub_auth_data aud2g;
28 struct osmo_sub_auth_data aud3g;
29 struct osmo_auth_vector vec;
30 int rc;
31
32 comment_start();
33
34 aud2g = (struct osmo_sub_auth_data){{ 0 }};
35
36 aud3g = (struct osmo_sub_auth_data){{
37 .type = OSMO_AUTH_TYPE_UMTS,
38 .algo = OSMO_AUTH_ALG_MILENAGE,
39 }};
40
41 osmo_hexparse("{Ki}",
42 aud3g.u.umts.k, sizeof(aud3g.u.umts.k));
43 osmo_hexparse("{OPc}",
44 aud3g.u.umts.opc, sizeof(aud3g.u.umts.opc));
45
46 osmo_hexparse("{RAND}",
47 fake_rand, sizeof(fake_rand));
48
49 vec = (struct osmo_auth_vector){{ {{0}} }};
50 VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64);
51 rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL);
52 VERBOSE_ASSERT(rc, == 1, "%d");
53
54 VEC_IS(&vec,
55 " rand: {RAND}\n"
56 " ck: {MIL3G-CK}\n"
57 " ik: {MIL3G-IK}\n"
58 " res: {MIL3G-RES}0000000000000000\n"
59 " kc: {Kc}\n"
60 " sres: {SRES#1}\n"
61 );
62
63 comment_end();
64}}