[PATCH] osmo-ttcn3-hacks[master]: msc_tests: Randomly generate Auth Vector (rather than hard-c...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Jan 24 16:29:26 UTC 2018


Review at  https://gerrit.osmocom.org/6025

msc_tests: Randomly generate Auth Vector (rather than hard-coded value)

Change-Id: I2dc0570a8ae5003d26368b09d223db8e44a5c4ff
---
M msc_tests/BSC_ConnectionHandler.ttcn
1 file changed, 28 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/25/6025/1

diff --git a/msc_tests/BSC_ConnectionHandler.ttcn b/msc_tests/BSC_ConnectionHandler.ttcn
index ee0e0ae..f9b4d3e 100644
--- a/msc_tests/BSC_ConnectionHandler.ttcn
+++ b/msc_tests/BSC_ConnectionHandler.ttcn
@@ -133,6 +133,30 @@
 	return l3_info;
 }
 
+type record AuthVector {
+	OCT16 rand,
+	OCT4 sres,
+	OCT8 kc
+	/* FIXME: 3G elements */
+}
+
+private function f_rnd_oct(integer len) return octetstring {
+	var integer i;
+	var octetstring res;
+	for (i := 0; i < len; i := i + 1) {
+		res[i] := int2oct(float2int(rnd()*256.0), 1);
+	}
+	return res;
+}
+
+function f_gen_auth_vec_2g() return AuthVector {
+	var AuthVector vec;
+	vec.rand := f_rnd_oct(16);
+	vec.sres := f_rnd_oct(4);
+	vec.kc := f_rnd_oct(8);
+	return vec;
+}
+
 function f_perform_lu(boolean expect_auth, boolean expect_tmsi, boolean send_early_cm)
 runs on BSC_ConnHdlr {
 	var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi)
@@ -149,15 +173,13 @@
 	}
 
 	if (expect_auth) {
-		var OCT16 rand := 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'O;
-		var OCT4 sres := 'bbbbbbbb'O;
-		var GSUP_IE auth_tuple := valueof(ts_GSUP_IE_AuthTuple2G(rand, sres,
-									 'cccccccccccccccc'O));
+		var AuthVector vec := f_gen_auth_vec_2g();
+		var GSUP_IE auth_tuple := valueof(ts_GSUP_IE_AuthTuple2G(vec.rand, vec.sres, vec.kc));
 		GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi));
 		GSUP.send(ts_GSUP_SAI_RES(g_pars.imsi, auth_tuple));
 
-		BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_MM_AUTH_REQ(rand)));
-		BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MT_MM_AUTH_RESP_2G(sres)));
+		BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_MM_AUTH_REQ(vec.rand)));
+		BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MT_MM_AUTH_RESP_2G(vec.sres)));
 	}
 
 	/* Expect MSC to perform LU with HLR */

-- 
To view, visit https://gerrit.osmocom.org/6025
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2dc0570a8ae5003d26368b09d223db8e44a5c4ff
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list