From b1af6ef1646c54f429f7b87778d92d139c0e3336 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Sat, 26 Aug 2017 21:38:51 +0200 Subject: 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 --- utils/osmo-auc-gen.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'utils') 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; -- cgit v1.2.3