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
diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c
index f0cfa79..6fa7cec 100644
--- a/utils/osmo-auc-gen.c
+++ b/utils/osmo-auc-gen.c
@@ -257,24 +257,19 @@
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);
}