aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-08-26 21:38:51 +0200
committerHarald Welte <laforge@gnumonks.org>2017-08-29 12:46:45 +0000
commitb1af6ef1646c54f429f7b87778d92d139c0e3336 (patch)
tree6372e127c98864b4f7f70ab63d3a98357ae0f856 /utils
parent3cb08277f1d46c6c74c4bb6e254a57ffb9ac3834 (diff)
osmo-auc-gen: umts: add --ind-len arg
osmo-auc-gen so far does not allow indicating the IND bit length of SQN. A default of 5 serves most practical cases, nevertheless we should allow passing arbitrary IND lengths. Enhance the test suite to test --ind-len. Related: OS#2465 Change-Id: Ia1d8b6a823ffc92290b3e39e4e4665aeff80ccc0
Diffstat (limited to 'utils')
-rw-r--r--utils/osmo-auc-gen.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c
index 4f36dee5..6e38b520 100644
--- a/utils/osmo-auc-gen.c
+++ b/utils/osmo-auc-gen.c
@@ -81,6 +81,7 @@ static void help()
"-f --amf\tSpecify AMF (only for 3G)\n"
"-s --sqn\tSpecify SQN (only for 3G)\n"
"-i --ind\tSpecify IND slot for new SQN after AUTS (only for 3G)\n"
+ "-l --ind-len\tSpecify IND bit length (default=5) (only for 3G)\n"
"-A --auts\tSpecify AUTS (only for 3G)\n"
"-r --rand\tSpecify random value\n"
"-I --ipsec\tOutput in triplets.dat format for strongswan\n");
@@ -122,6 +123,7 @@ int main(int argc, char **argv)
{ "amf", 1, 0, 'f' },
{ "sqn", 1, 0, 's' },
{ "ind", 1, 0, 'i' },
+ { "ind-len", 1, 0, 'l' },
{ "rand", 1, 0, 'r' },
{ "auts", 1, 0, 'A' },
{ "help", 0, 0, 'h' },
@@ -130,7 +132,7 @@ int main(int argc, char **argv)
rc = 0;
- c = getopt_long(argc, argv, "23a:k:o:f:s:i:r:hO:A:I", long_options,
+ c = getopt_long(argc, argv, "23a:k:o:f:s:i:l:r:hO:A:I", long_options,
&option_index);
if (c == -1)
@@ -214,6 +216,13 @@ int main(int argc, char **argv)
ind = atoi(optarg);
ind_is_set = 1;
break;
+ 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;
case 'r':
rc = osmo_hexparse(optarg, _rand, sizeof(_rand));
rand_is_set = 1;