2017-06-20 02:35:06 +00:00
|
|
|
/*! \file osmo-auc-gen.c
|
|
|
|
* GSM/GPRS/3G authentication testing tool. */
|
|
|
|
/*
|
2021-09-16 19:36:16 +00:00
|
|
|
* (C) 2010-2021 by Harald Welte <laforge@gnumonks.org>
|
2011-12-07 01:38:42 +00:00
|
|
|
*
|
|
|
|
* All Rights Reserved
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
2013-06-02 23:38:57 +00:00
|
|
|
#include <time.h>
|
2011-12-07 01:38:42 +00:00
|
|
|
#include <getopt.h>
|
2012-08-02 06:42:59 +00:00
|
|
|
#include <unistd.h>
|
2013-07-14 07:11:47 +00:00
|
|
|
#include <inttypes.h>
|
|
|
|
#include <time.h>
|
2011-12-07 01:38:42 +00:00
|
|
|
|
|
|
|
#include <osmocom/crypt/auth.h>
|
|
|
|
#include <osmocom/core/utils.h>
|
2021-09-16 19:36:16 +00:00
|
|
|
#include <osmocom/core/base64.h>
|
2017-07-10 12:32:48 +00:00
|
|
|
#include <osmocom/gsm/gsm_utils.h>
|
2011-12-07 01:38:42 +00:00
|
|
|
|
2021-09-16 19:36:16 +00:00
|
|
|
static void print_base64(const char *fmt, const uint8_t *data, unsigned int len)
|
|
|
|
{
|
|
|
|
uint8_t outbuf[256];
|
|
|
|
size_t olen;
|
|
|
|
|
|
|
|
OSMO_ASSERT(osmo_base64_encode(outbuf, sizeof(outbuf), &olen, data, len) == 0);
|
|
|
|
OSMO_ASSERT(sizeof(outbuf) > olen);
|
|
|
|
outbuf[olen] = '\0';
|
|
|
|
printf(fmt, outbuf);
|
|
|
|
}
|
|
|
|
|
2012-06-27 13:06:19 +00:00
|
|
|
static void dump_triplets_dat(struct osmo_auth_vector *vec)
|
|
|
|
{
|
|
|
|
if (vec->auth_types & OSMO_AUTH_TYPE_UMTS) {
|
|
|
|
fprintf(stderr, "triplets.dat doesn't support UMTS!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
printf("imsi,");
|
|
|
|
printf("%s,", osmo_hexdump_nospc(vec->rand, sizeof(vec->rand)));
|
|
|
|
printf("%s,", osmo_hexdump_nospc(vec->sres, sizeof(vec->sres)));
|
|
|
|
printf("%s\n", osmo_hexdump_nospc(vec->kc, sizeof(vec->kc)));
|
|
|
|
}
|
|
|
|
|
2011-12-07 01:38:42 +00:00
|
|
|
static void dump_auth_vec(struct osmo_auth_vector *vec)
|
|
|
|
{
|
2016-05-18 17:36:42 +00:00
|
|
|
printf("RAND:\t%s\n", osmo_hexdump_nospc(vec->rand, sizeof(vec->rand)));
|
2011-12-07 01:38:42 +00:00
|
|
|
|
|
|
|
if (vec->auth_types & OSMO_AUTH_TYPE_UMTS) {
|
2021-09-16 19:36:16 +00:00
|
|
|
uint8_t inbuf[sizeof(vec->rand) + sizeof(vec->autn)];
|
|
|
|
|
2016-05-18 17:36:42 +00:00
|
|
|
printf("AUTN:\t%s\n", osmo_hexdump_nospc(vec->autn, sizeof(vec->autn)));
|
|
|
|
printf("IK:\t%s\n", osmo_hexdump_nospc(vec->ik, sizeof(vec->ik)));
|
|
|
|
printf("CK:\t%s\n", osmo_hexdump_nospc(vec->ck, sizeof(vec->ck)));
|
|
|
|
printf("RES:\t%s\n", osmo_hexdump_nospc(vec->res, vec->res_len));
|
2021-09-16 19:36:16 +00:00
|
|
|
|
|
|
|
memcpy(inbuf, vec->rand, sizeof(vec->rand));
|
|
|
|
memcpy(inbuf + sizeof(vec->rand), vec->autn, sizeof(vec->autn));
|
|
|
|
print_base64("IMS nonce:\t%s\n", inbuf, sizeof(inbuf));
|
|
|
|
print_base64("IMS res:\t%s\n", vec->res, vec->res_len);
|
2011-12-07 01:38:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (vec->auth_types & OSMO_AUTH_TYPE_GSM) {
|
2016-05-18 17:36:42 +00:00
|
|
|
printf("SRES:\t%s\n", osmo_hexdump_nospc(vec->sres, sizeof(vec->sres)));
|
|
|
|
printf("Kc:\t%s\n", osmo_hexdump_nospc(vec->kc, sizeof(vec->kc)));
|
2011-12-07 01:38:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct osmo_sub_auth_data test_aud = {
|
|
|
|
.type = OSMO_AUTH_TYPE_NONE,
|
|
|
|
.algo = OSMO_AUTH_ALG_NONE,
|
|
|
|
};
|
|
|
|
|
2012-03-21 07:51:48 +00:00
|
|
|
static void help()
|
|
|
|
{
|
2017-02-03 17:36:32 +00:00
|
|
|
int alg;
|
2012-03-21 07:51:48 +00:00
|
|
|
printf( "-2 --2g\tUse 2G (GSM) authentication\n"
|
|
|
|
"-3 --3g\tUse 3G (UMTS) authentication\n"
|
|
|
|
"-a --algorithm\tSpecify name of the algorithm\n"
|
|
|
|
"-k --key\tSpecify Ki / K\n"
|
|
|
|
"-o --opc\tSpecify OPC (only for 3G)\n"
|
2012-03-21 08:03:16 +00:00
|
|
|
"-O --op\tSpecify OP (only for 3G)\n"
|
2015-05-25 16:11:37 +00:00
|
|
|
"-f --amf\tSpecify AMF (only for 3G)\n"
|
2012-03-21 07:51:48 +00:00
|
|
|
"-s --sqn\tSpecify SQN (only for 3G)\n"
|
2017-08-26 19:45:33 +00:00
|
|
|
"-i --ind\tSpecify IND slot for new SQN after AUTS (only for 3G)\n"
|
2017-08-26 19:38:51 +00:00
|
|
|
"-l --ind-len\tSpecify IND bit length (default=5) (only for 3G)\n"
|
2012-03-22 15:45:23 +00:00
|
|
|
"-A --auts\tSpecify AUTS (only for 3G)\n"
|
2012-06-27 13:06:19 +00:00
|
|
|
"-r --rand\tSpecify random value\n"
|
|
|
|
"-I --ipsec\tOutput in triplets.dat format for strongswan\n");
|
2017-02-03 17:36:32 +00:00
|
|
|
|
|
|
|
fprintf(stderr, "\nAvailable algorithms for option -a:\n");
|
|
|
|
for (alg = 1; alg < _OSMO_AUTH_ALG_NUM; alg++)
|
|
|
|
fprintf(stderr, " %s\n",
|
|
|
|
osmo_auth_alg_name(alg));
|
2012-03-21 07:51:48 +00:00
|
|
|
}
|
|
|
|
|
2011-12-07 01:38:42 +00:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
struct osmo_auth_vector _vec;
|
|
|
|
struct osmo_auth_vector *vec = &_vec;
|
GSUP, OAP, osmo-gen-vec: fix AUTS length to 14, not 16
GSUP transmits AUTS for UMTS authentication procedures, and OAP uses the same
procedures to authenticate. osmo-gen-vec is a utility program that passes AUTS
to our osmo_auth_gen_vec_auts() API.
According to 3GPP 33.102 6.3.3, AUTS = SQN^AK || MAC-S, which are 6 || 8 == 14
bytes. This is confirmed by 24.008 9.2.3a where the TLV has 16 bytes, TL = 2
and AUTS being the V = 14.
It is not harmful for milenage_gen_vec_auts() to pass two more AUTS bytes. But
writing 16 bytes to a GSUP struct is a potential problem when passing in a 14
byte long AUTS buffer to the GSUP API, which then reads past the AUTS buffer.
The API implies the length, so far to be 16, so passing in a 14 byte buffer to
GSUP would require copying to a larger buffer first.
Fix this by using a length of 14 for AUTS everywhere instead.
This constitues an ABI breakage, we may handle it as a "fix before an official
release", otherwise we need a version bump.
The OAP protocol document has also been updated, needs an update in the
osmo-gsm-manuals as well.
Change-Id: If25b173d9ec57ea4c504d860954912b7d82af455
2017-02-02 19:05:14 +00:00
|
|
|
uint8_t _rand[16], _auts[14];
|
2017-11-16 15:37:55 +00:00
|
|
|
uint64_t sqn = 0;
|
2017-09-12 01:25:43 +00:00
|
|
|
unsigned int ind = 0;
|
2011-12-07 01:38:42 +00:00
|
|
|
int rc, option_index;
|
|
|
|
int rand_is_set = 0;
|
2012-03-22 15:45:23 +00:00
|
|
|
int auts_is_set = 0;
|
2017-08-26 20:08:36 +00:00
|
|
|
int sqn_is_set = 0;
|
2017-08-26 19:45:33 +00:00
|
|
|
int ind_is_set = 0;
|
2012-06-27 13:06:19 +00:00
|
|
|
int fmt_triplets_dat = 0;
|
2017-09-12 01:25:43 +00:00
|
|
|
uint64_t ind_mask = 0;
|
2011-12-07 01:38:42 +00:00
|
|
|
|
2012-03-21 16:37:53 +00:00
|
|
|
printf("osmo-auc-gen (C) 2011-2012 by Harald Welte\n");
|
2011-12-07 01:38:42 +00:00
|
|
|
printf("This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY\n\n");
|
|
|
|
|
2012-03-22 15:45:23 +00:00
|
|
|
memset(_auts, 0, sizeof(_auts));
|
|
|
|
|
2011-12-07 01:38:42 +00:00
|
|
|
while (1) {
|
|
|
|
int c;
|
|
|
|
static struct option long_options[] = {
|
|
|
|
{ "2g", 0, 0, '2' },
|
|
|
|
{ "3g", 0, 0, '3' },
|
|
|
|
{ "algorithm", 1, 0, 'a' },
|
|
|
|
{ "key", 1, 0, 'k' },
|
|
|
|
{ "opc", 1, 0, 'o' },
|
2012-03-21 08:03:16 +00:00
|
|
|
{ "op", 1, 0, 'O' },
|
2011-12-07 01:38:42 +00:00
|
|
|
{ "amf", 1, 0, 'f' },
|
|
|
|
{ "sqn", 1, 0, 's' },
|
2017-08-26 19:45:33 +00:00
|
|
|
{ "ind", 1, 0, 'i' },
|
2017-08-26 19:38:51 +00:00
|
|
|
{ "ind-len", 1, 0, 'l' },
|
2011-12-07 01:38:42 +00:00
|
|
|
{ "rand", 1, 0, 'r' },
|
2012-03-22 15:45:23 +00:00
|
|
|
{ "auts", 1, 0, 'A' },
|
2012-03-21 07:51:48 +00:00
|
|
|
{ "help", 0, 0, 'h' },
|
2011-12-07 01:38:42 +00:00
|
|
|
{ 0, 0, 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
rc = 0;
|
|
|
|
|
2017-08-26 19:38:51 +00:00
|
|
|
c = getopt_long(argc, argv, "23a:k:o:f:s:i:l:r:hO:A:I", long_options,
|
2011-12-07 01:38:42 +00:00
|
|
|
&option_index);
|
|
|
|
|
|
|
|
if (c == -1)
|
|
|
|
break;
|
|
|
|
|
|
|
|
switch (c) {
|
|
|
|
case '2':
|
|
|
|
test_aud.type = OSMO_AUTH_TYPE_GSM;
|
|
|
|
break;
|
|
|
|
case '3':
|
|
|
|
test_aud.type = OSMO_AUTH_TYPE_UMTS;
|
2017-08-26 19:40:11 +00:00
|
|
|
test_aud.u.umts.ind_bitlen = 5;
|
2011-12-07 01:38:42 +00:00
|
|
|
break;
|
|
|
|
case 'a':
|
|
|
|
rc = osmo_auth_alg_parse(optarg);
|
|
|
|
if (rc < 0)
|
|
|
|
break;
|
|
|
|
test_aud.algo = rc;
|
|
|
|
break;
|
|
|
|
case 'k':
|
|
|
|
switch (test_aud.type) {
|
|
|
|
case OSMO_AUTH_TYPE_GSM:
|
2011-12-07 10:35:02 +00:00
|
|
|
rc = osmo_hexparse(optarg, test_aud.u.gsm.ki,
|
|
|
|
sizeof(test_aud.u.gsm.ki));
|
2011-12-07 01:38:42 +00:00
|
|
|
break;
|
|
|
|
case OSMO_AUTH_TYPE_UMTS:
|
2011-12-07 10:35:02 +00:00
|
|
|
rc = osmo_hexparse(optarg, test_aud.u.umts.k,
|
|
|
|
sizeof(test_aud.u.umts.k));
|
2011-12-07 01:38:42 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
fprintf(stderr, "please specify 2g/3g first!\n");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'o':
|
|
|
|
if (test_aud.type != OSMO_AUTH_TYPE_UMTS) {
|
|
|
|
fprintf(stderr, "Only UMTS has OPC\n");
|
|
|
|
exit(2);
|
|
|
|
}
|
2011-12-07 10:35:02 +00:00
|
|
|
rc = osmo_hexparse(optarg, test_aud.u.umts.opc,
|
|
|
|
sizeof(test_aud.u.umts.opc));
|
2012-03-21 08:03:16 +00:00
|
|
|
test_aud.u.umts.opc_is_op = 0;
|
|
|
|
break;
|
|
|
|
case 'O':
|
|
|
|
if (test_aud.type != OSMO_AUTH_TYPE_UMTS) {
|
|
|
|
fprintf(stderr, "Only UMTS has OP\n");
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
rc = osmo_hexparse(optarg, test_aud.u.umts.opc,
|
|
|
|
sizeof(test_aud.u.umts.opc));
|
|
|
|
test_aud.u.umts.opc_is_op = 1;
|
2011-12-07 01:38:42 +00:00
|
|
|
break;
|
2012-03-22 15:45:23 +00:00
|
|
|
case 'A':
|
|
|
|
if (test_aud.type != OSMO_AUTH_TYPE_UMTS) {
|
|
|
|
fprintf(stderr, "Only UMTS has AUTS\n");
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
rc = osmo_hexparse(optarg, _auts, sizeof(_auts));
|
|
|
|
auts_is_set = 1;
|
|
|
|
break;
|
2011-12-07 01:38:42 +00:00
|
|
|
case 'f':
|
|
|
|
if (test_aud.type != OSMO_AUTH_TYPE_UMTS) {
|
|
|
|
fprintf(stderr, "Only UMTS has AMF\n");
|
|
|
|
exit(2);
|
|
|
|
}
|
2011-12-07 10:35:02 +00:00
|
|
|
rc = osmo_hexparse(optarg, test_aud.u.umts.amf,
|
|
|
|
sizeof(test_aud.u.umts.amf));
|
2011-12-07 01:38:42 +00:00
|
|
|
break;
|
|
|
|
case 's':
|
|
|
|
if (test_aud.type != OSMO_AUTH_TYPE_UMTS) {
|
|
|
|
fprintf(stderr, "Only UMTS has SQN\n");
|
|
|
|
exit(2);
|
|
|
|
}
|
2021-09-17 05:56:09 +00:00
|
|
|
sqn = strtoull(optarg, 0, 0);
|
2017-08-26 20:08:36 +00:00
|
|
|
sqn_is_set = 1;
|
2011-12-07 01:38:42 +00:00
|
|
|
break;
|
2017-08-26 19:45:33 +00:00
|
|
|
case 'i':
|
|
|
|
if (test_aud.type != OSMO_AUTH_TYPE_UMTS) {
|
|
|
|
fprintf(stderr, "Only UMTS has IND\n");
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
ind = atoi(optarg);
|
|
|
|
ind_is_set = 1;
|
|
|
|
break;
|
2017-08-26 19:38:51 +00:00
|
|
|
case 'l':
|
|
|
|
if (test_aud.type != OSMO_AUTH_TYPE_UMTS) {
|
|
|
|
fprintf(stderr, "Only UMTS has IND bitlen\n");
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
test_aud.u.umts.ind_bitlen = atoi(optarg);
|
|
|
|
break;
|
2011-12-07 01:38:42 +00:00
|
|
|
case 'r':
|
|
|
|
rc = osmo_hexparse(optarg, _rand, sizeof(_rand));
|
|
|
|
rand_is_set = 1;
|
|
|
|
break;
|
2012-06-27 13:06:19 +00:00
|
|
|
case 'I':
|
|
|
|
fmt_triplets_dat = 1;
|
|
|
|
break;
|
2012-03-21 07:51:48 +00:00
|
|
|
case 'h':
|
|
|
|
help();
|
|
|
|
exit(0);
|
|
|
|
default:
|
|
|
|
help();
|
|
|
|
exit(1);
|
2011-12-07 01:38:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (rc < 0) {
|
2017-02-03 17:36:32 +00:00
|
|
|
help();
|
|
|
|
fprintf(stderr, "\nError parsing argument of option `%c'\n", c);
|
2011-12-07 01:38:42 +00:00
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-03 20:35:12 +00:00
|
|
|
if (argc > optind) {
|
|
|
|
fprintf(stderr, "Unsupported positional arguments in command line\n");
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
|
2011-12-07 01:38:42 +00:00
|
|
|
if (!rand_is_set) {
|
2017-07-10 12:32:48 +00:00
|
|
|
rc = osmo_get_rand_id(_rand, 16);
|
|
|
|
if (rc < 0) {
|
|
|
|
fprintf(stderr, "\nError: unable to obtain secure random numbers: %s!\n",
|
|
|
|
strerror(-rc));
|
|
|
|
exit(3);
|
2014-06-22 14:53:55 +00:00
|
|
|
}
|
2011-12-07 01:38:42 +00:00
|
|
|
}
|
|
|
|
|
2012-03-21 07:51:48 +00:00
|
|
|
if (test_aud.type == OSMO_AUTH_TYPE_NONE ||
|
|
|
|
test_aud.algo == OSMO_AUTH_ALG_NONE) {
|
|
|
|
help();
|
2017-02-03 17:36:32 +00:00
|
|
|
fprintf(stderr, "\nError: you need to pass at least"
|
|
|
|
" -2 or -3, as well as an algorithm to use.\n");
|
2012-03-21 07:51:48 +00:00
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
|
2011-12-07 01:38:42 +00:00
|
|
|
memset(vec, 0, sizeof(*vec));
|
|
|
|
|
2017-08-26 20:08:36 +00:00
|
|
|
if (test_aud.type == OSMO_AUTH_TYPE_UMTS) {
|
2017-09-12 01:25:43 +00:00
|
|
|
uint64_t seq_1 = 1LL << test_aud.u.umts.ind_bitlen;
|
2017-08-26 20:29:51 +00:00
|
|
|
ind_mask = seq_1 - 1;
|
2017-08-26 20:08:36 +00:00
|
|
|
|
|
|
|
if (sqn_is_set) {
|
|
|
|
/* Before calculating the UMTS auth vector, osmo_auth_gen_vec() increments SEQ.
|
|
|
|
* To end up with the SQN passed in by the user, we need to pass in SEQ-1, and
|
|
|
|
* indicate which IND slot to target. */
|
|
|
|
test_aud.u.umts.sqn = sqn - seq_1;
|
|
|
|
test_aud.u.umts.ind = sqn & ind_mask;
|
|
|
|
}
|
2017-08-26 19:45:33 +00:00
|
|
|
|
|
|
|
if (sqn_is_set && ind_is_set) {
|
|
|
|
fprintf(stderr, "Requesting --sqn %"PRIu64" implies IND=%u,"
|
|
|
|
" so no further --ind argument is allowed.\n",
|
|
|
|
sqn, test_aud.u.umts.ind);
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ind_is_set) {
|
|
|
|
if (ind >= (1 << test_aud.u.umts.ind_bitlen)) {
|
|
|
|
fprintf(stderr, "Requested --ind %u is too large for IND bitlen of %u\n",
|
|
|
|
ind, test_aud.u.umts.ind_bitlen);
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
test_aud.u.umts.ind = ind;
|
|
|
|
}
|
2017-08-26 20:08:36 +00:00
|
|
|
}
|
|
|
|
|
2012-03-22 15:45:23 +00:00
|
|
|
if (!auts_is_set)
|
|
|
|
rc = osmo_auth_gen_vec(vec, &test_aud, _rand);
|
|
|
|
else
|
|
|
|
rc = osmo_auth_gen_vec_auts(vec, &test_aud, _auts, _rand, _rand);
|
2011-12-07 01:38:42 +00:00
|
|
|
if (rc < 0) {
|
2012-03-22 15:45:23 +00:00
|
|
|
if (!auts_is_set)
|
|
|
|
fprintf(stderr, "error generating auth vector\n");
|
|
|
|
else
|
|
|
|
fprintf(stderr, "AUTS from MS seems incorrect\n");
|
2011-12-07 01:38:42 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2012-06-27 13:06:19 +00:00
|
|
|
if (fmt_triplets_dat)
|
|
|
|
dump_triplets_dat(vec);
|
2017-03-15 00:16:43 +00:00
|
|
|
else {
|
2012-06-27 13:06:19 +00:00
|
|
|
dump_auth_vec(vec);
|
2017-08-26 20:29:51 +00:00
|
|
|
if (test_aud.type == OSMO_AUTH_TYPE_UMTS) {
|
osmo_auth_gen_vec: UMTS auth: store last used SQN, not next
Prepare for the implementation of splitting SQN increments in SEQ and an IND
part; particularly to clearly show where the changes in auth/milenage_test's
expectations originate.
Rationale: the source of UMTS auth vectors, for us usually OsmoHLR, typically
stores the last used SQN, not the next one to be used. Particularly with the
upcoming fix of the SQN scheme, this change is important: the next SQN will
depend on which entity asks for it, because each auth consumer may have a
particular slot in the IND part of SQN. It does not make sense to store the
next SQN, because we will not know which consumer that will be for.
The milenage_test has always calculated a tuple for SQN == 34. To account for
the increment now happening before calculating a tuple, lower the test_aud->sqn
by one to 0x21 == 33, so that it is still calculating for SQN == 34.
Because we are no longer incrementing SQN after the tuple is generated,
milenage_test's expected output after doing an AUTS resync to 31 changes to the
next SQN = 32, the SQN used for the generated tuple.
(BTW, a subsequent patch will illustrate AUTS in detail.)
osmo-auc-gen now needs to pass the user requested SQN less one, because the SQN
will be incremented befor generating the auth vector. Also the SQN remains the
same after generating, so SQN output needs less decrementing. Note that the
expected output for osmo-auc-gen_test remains unchanged, hence the same input
arguments (particularly -s <sqn> and -A <auts>) still produce the same results.
Note: osmo-hlr regression tests will require adjustments when this patch is
merged, because it must now pass desired_sqn - 1 instead of just desired_sqn.
See osmo-hlr change-id I4ec5a578537acb1d9e1ebfe00a72417fc3ca5894 .
Related: OS#1968
Change-Id: Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3
2017-03-13 16:36:17 +00:00
|
|
|
printf("SQN:\t%" PRIu64 "\n", test_aud.u.umts.sqn);
|
2017-08-26 20:29:51 +00:00
|
|
|
printf("IND:\t%u\n", (unsigned int)(test_aud.u.umts.sqn & ind_mask));
|
2017-08-26 20:43:50 +00:00
|
|
|
if (auts_is_set)
|
|
|
|
printf("SQN.MS:\t%" PRIu64 "\n", test_aud.u.umts.sqn_ms);
|
2017-08-26 20:29:51 +00:00
|
|
|
}
|
2017-03-15 00:16:43 +00:00
|
|
|
}
|
2011-12-07 01:38:42 +00:00
|
|
|
|
2012-03-22 15:45:23 +00:00
|
|
|
exit(0);
|
2011-12-07 01:38:42 +00:00
|
|
|
}
|