summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-03-15 01:16:43 +0100
committerHarald Welte <laforge@gnumonks.org>2017-03-15 12:46:08 +0000
commit5fe3d1b0f7d40bd80733b23575e40b9544652fc4 (patch)
tree77f1b90964e3e97ee4bab0369b3814396eb7822b /utils
parentd3b58730d5c86db96ee51e458ad35596617bebe9 (diff)
osmo-auc-gen: clarify SQN output, prepare for SQN changes
Upcoming patches will change the way SQN are incremented. Change the SQN related output by osmo-auc-gen so that it also makes sense after these changes, and so that its output is proven to remain unchanged for the same arguments: Always show the SQN used for vector generation when a UMTS vector was generated. Don't show the next SQN, it will not make sense anymore (see later patches). The adjustments of expected output of osmo-auc-gen_test illustrates how the output changes. Related: OS#1968 Change-Id: I35d9c669002ff3e8570e07b444cca34ce57c3b0c
Diffstat (limited to 'utils')
-rw-r--r--utils/osmo-auc-gen.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c
index f0cfa795..6fa7cec7 100644
--- a/utils/osmo-auc-gen.c
+++ b/utils/osmo-auc-gen.c
@@ -257,24 +257,19 @@ int main(int argc, char **argv)
if (fmt_triplets_dat)
dump_triplets_dat(vec);
- else
+ else {
dump_auth_vec(vec);
+ if (test_aud.type == OSMO_AUTH_TYPE_UMTS)
+ /* After generating, SQN is incremented, so -1 */
+ printf("SQN:\t%" PRIu64 "\n", test_aud.u.umts.sqn - 1);
+ }
- /* Print SQN from AUTS. It makes sense to print actually three SQN
- * to clarify:
- * After recovering SQN.MS from AUTS, milenage_gen_vec_auts() does:
- * aud->u.umts.sqn = 1 + (osmo_load64be_ext(sqn_out, 6) >> 16);
- * Then calls milenage_gen_vec(), which, after it is done, does:
- * aud->u.umts.sqn++;
- */
+ /* After recovering SQN.MS from AUTS, milenage_gen_vec_auts() does
+ * aud->u.umts.sqn++, and after vector generation milenage_gen_vec()
+ * does another ++, so to show SQN.MS we need to -2 */
if (auts_is_set)
- printf("AUTS success: SQN.MS = %" PRIu64
- ", generated vector with SQN = %" PRIu64
- ", next SQN = %" PRIu64 "\n",
- test_aud.u.umts.sqn - 2,
- test_aud.u.umts.sqn - 1,
- test_aud.u.umts.sqn
- );
+ printf("AUTS success: SQN.MS = %" PRIu64 "\n",
+ test_aud.u.umts.sqn - 2);
exit(0);
}