osmo-auc-gen: umts: add --ind arg

During UMTS AKA, the caller typically indicates which IND slot the next used
SQN should belong to. Without this option, osmo-auc-gen will always produce SQN
from IND-slot 0. Add --ind option.

Enhance the osmo-auc-gen_test.sh to expect errors with useful printouts on
stderr, and add tests that verify valid --ind ranges.

Related: OS#2465
Change-Id: Ib60eec80d58ca9a0a01e7fbd2bcbbd4339b1a6d8
diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.sh b/tests/osmo-auc-gen/osmo-auc-gen_test.sh
index 132d9c3..f7fc87d 100755
--- a/tests/osmo-auc-gen/osmo-auc-gen_test.sh
+++ b/tests/osmo-auc-gen/osmo-auc-gen_test.sh
@@ -18,6 +18,16 @@
 	$osmo_auc_gen $@
 }
 
+invoke_err() {
+	echo
+	echo
+	echo expecting error:
+	echo '>' osmo-auc-gen $@
+	echo expecting error: >&2
+	echo '>' osmo-auc-gen $@ >&2
+	$osmo_auc_gen $@ && exit 1 || true
+}
+
 bytes1="6a61050765caa32c90371370e5d6dc2d"
 bytes2="1dc4f974325cce611e54f516dc1fec56"
 bytes3="2a48162ff3edca4adf0b7b5e527d6c16"
@@ -32,5 +42,13 @@
 k="EB215756028D60E3275E613320AEC880"
 opc="FB2A3D1B360F599ABAB99DB8669F8308"
 rand="39fa2f4e3d523d8619a73b4f65c3e14d"
-auts="979498b1f72d3e28c59fa2e72f9c"
+auts="979498b1f72d3e28c59fa2e72f9c" # --> SQN.MS = 23
 invoke -3 -a milenage -r $rand -k $k -o $opc -A $auts
+invoke -3 -a milenage -r $rand -k $k -o $opc -A $auts --ind 5
+invoke -3 -a milenage -r $rand -k $k -o $opc -A $auts --ind 23
+invoke -3 -a milenage -r $rand -k $k -o $opc -A $auts --ind 31
+
+# expect error: IND is too large for IND-bitlen of 5 (max 31)
+invoke_err -3 -a milenage -r $rand -k $k -o $opc -A $auts --ind -1
+invoke_err -3 -a milenage -r $rand -k $k -o $opc -A $auts --ind 32
+invoke_err -3 -a milenage -r $rand -k $k -o $opc -A $auts --ind 42