Neels Hofmeyr | 6b883f7 | 2017-01-31 16:40:28 +0100 | [diff] [blame] | 1 | /* 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 | |
| 25 | static 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, |
Neels Hofmeyr | ea1052d | 2017-03-15 02:42:19 +0100 | [diff] [blame] | 39 | .u.umts.sqn = 31, |
Neels Hofmeyr | 6b883f7 | 2017-01-31 16:40:28 +0100 | [diff] [blame] | 40 | }}; |
| 41 | |
| 42 | osmo_hexparse("{Ki}", |
| 43 | aud3g.u.umts.k, sizeof(aud3g.u.umts.k)); |
| 44 | osmo_hexparse("{OPc}", |
| 45 | aud3g.u.umts.opc, sizeof(aud3g.u.umts.opc)); |
| 46 | |
| 47 | osmo_hexparse("{RAND}", |
| 48 | fake_rand, sizeof(fake_rand)); |
| 49 | |
| 50 | vec = (struct osmo_auth_vector){{ {{0}} }}; |
Neels Hofmeyr | ea1052d | 2017-03-15 02:42:19 +0100 | [diff] [blame] | 51 | VERBOSE_ASSERT(aud3g.u.umts.sqn, == 31, "%"PRIu64); |
Neels Hofmeyr | 6b883f7 | 2017-01-31 16:40:28 +0100 | [diff] [blame] | 52 | rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); |
| 53 | VERBOSE_ASSERT(rc, == 1, "%d"); |
Neels Hofmeyr | ea1052d | 2017-03-15 02:42:19 +0100 | [diff] [blame] | 54 | VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); |
Neels Hofmeyr | 6b883f7 | 2017-01-31 16:40:28 +0100 | [diff] [blame] | 55 | |
| 56 | VEC_IS(&vec, |
| 57 | " rand: {RAND}\n" |
| 58 | " ck: {MIL3G-CK}\n" |
| 59 | " ik: {MIL3G-IK}\n" |
| 60 | " res: {MIL3G-RES}0000000000000000\n" |
| 61 | " kc: {Kc}\n" |
| 62 | " sres: {SRES#1}\n" |
| 63 | ); |
| 64 | |
| 65 | comment_end(); |
| 66 | }} |