Change in osmo-ttcn3-hacks[master]: sgsn a54 tests

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/.

laforge gerrit-no-reply at lists.osmocom.org
Wed Jun 16 06:32:53 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24629 )

Change subject: sgsn a54 tests
......................................................................

sgsn a54 tests

This adds a few tests that ensure that the encryption algorithm dynamically chosen is
1) one actually supported by both the sgsn and the UE
2) the strongest one available both have in common

Change-Id: Iad65cbf9840aa883cb34e53554b94a4142c82638
Related: SYS#5324
---
M sgsn/SGSN_Tests.ttcn
M sgsn/expected-results.xml
2 files changed, 127 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index d760e58..0047ba8 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -2833,6 +2833,123 @@
 	f_cleanup();
 }
 
+private function f_TC_attach_usim_crypt(OCT1 netcap_a2345, BIT3 auth_req_ciph) runs on BSSGP_ConnHdlr {
+	var RoutingAreaIdentificationV old_ra := f_random_RAI();
+
+	var template PDU_L3_MS_SGSN attach_req := ts_GMM_ATTACH_REQ(f_mi_get_lv(), old_ra, false, false, omit, omit);
+	attach_req.msgs.gprs_mm.attachRequest.msNetworkCapability.msNetworkCapabilityV.spare_octets := netcap_a2345; /* GEA2345... */
+
+	/* send Attach Request */
+	/* indicate R99 capability of the MS to enable UMTS AKA in presence of
+	 * 3G auth vectors */
+	attach_req.msgs.gprs_mm.attachRequest.msNetworkCapability.msNetworkCapabilityV.revisionLevelIndicatior := '1'B;
+	/* The thing is, if the solSACapability is 'omit', then the
+	 * revisionLevelIndicatior is at the wrong place! */
+	attach_req.msgs.gprs_mm.attachRequest.msNetworkCapability.msNetworkCapabilityV.solSACapability := '0'B;
+	f_send_l3(attach_req);
+
+	/* do the auth */
+	var PDU_L3_MS_SGSN l3_mo;
+	var PDU_L3_SGSN_MS l3_mt;
+	var default di := activate(as_mm_identity());
+
+	var GSUP_IE auth_tuple;
+	var template AuthenticationParameterAUTNTLV autn;
+
+	g_pars.vec := f_gen_auth_vec_3g();
+	autn := {
+		elementIdentifier := '28'O,
+		lengthIndicator := lengthof(g_pars.vec.autn),
+		autnValue := g_pars.vec.autn
+		};
+	auth_tuple := valueof(ts_GSUP_IE_AuthTuple2G3G(g_pars.vec.rand,
+							g_pars.vec.sres,
+							g_pars.vec.kc,
+							g_pars.vec.ik,
+							g_pars.vec.ck,
+							g_pars.vec.autn,
+							g_pars.vec.res));
+	log("GSUP sends 2G and 3G auth tuples", auth_tuple);
+	GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi));
+	GSUP.send(ts_GSUP_SAI_RES(g_pars.imsi, auth_tuple));
+
+	var template PDU_L3_SGSN_MS auth_ciph_req := tr_GMM_AUTH_REQ(g_pars.vec.rand, auth_req_ciph);
+	auth_ciph_req.msgs.gprs_mm.authenticationAndCipheringRequest.authenticationParameterAUTN := autn;
+	BSSGP[0].receive(auth_ciph_req) -> value l3_mt;
+
+	setverdict(pass);
+	deactivate(di);
+}
+
+private function f_TC_attach_usim_a54_a54(charstring id) runs on BSSGP_ConnHdlr {
+	f_TC_attach_usim_crypt('10'O, '100'B);
+}
+
+private function f_TC_attach_usim_a54_a53(charstring id) runs on BSSGP_ConnHdlr {
+	f_TC_attach_usim_crypt('20'O, '011'B);
+}
+
+private function f_TC_attach_usim_a53_a54(charstring id) runs on BSSGP_ConnHdlr {
+	f_TC_attach_usim_crypt('30'O, '011'B);
+}
+
+private function f_TC_attach_usim_a50_a54(charstring id) runs on BSSGP_ConnHdlr {
+	f_TC_attach_usim_crypt('30'O, '000'B);
+}
+
+private function f_TC_attach_usim_a54_a50(charstring id) runs on BSSGP_ConnHdlr {
+	f_TC_attach_usim_crypt('00'O, '000'B);
+}
+
+testcase TC_attach_usim_a54_a54() runs on test_CT {
+	var BSSGP_ConnHdlr vc_conn;
+	f_init();
+	f_sleep(1.0);
+	f_vty_config(SGSNVTY, "sgsn", "encryption GEA0 GEA3 GEA4");
+	vc_conn := f_start_handler(refers(f_TC_attach_usim_a54_a54), testcasename(), g_gb, 40);
+	vc_conn.done;
+	f_cleanup();
+}
+
+testcase TC_attach_usim_a54_a53() runs on test_CT {
+	var BSSGP_ConnHdlr vc_conn;
+	f_init();
+	f_sleep(1.0);
+	f_vty_config(SGSNVTY, "sgsn", "encryption GEA0 GEA3 GEA4");
+	vc_conn := f_start_handler(refers(f_TC_attach_usim_a54_a53), testcasename(), g_gb, 40);
+	vc_conn.done;
+	f_cleanup();
+}
+
+testcase TC_attach_usim_a53_a54() runs on test_CT {
+	var BSSGP_ConnHdlr vc_conn;
+	f_init();
+	f_sleep(1.0);
+	f_vty_config(SGSNVTY, "sgsn", "encryption GEA0 GEA3");
+	vc_conn := f_start_handler(refers(f_TC_attach_usim_a53_a54), testcasename(), g_gb, 40);
+	vc_conn.done;
+	f_cleanup();
+}
+
+testcase TC_attach_usim_a50_a54() runs on test_CT {
+	var BSSGP_ConnHdlr vc_conn;
+	f_init();
+	f_sleep(1.0);
+	f_vty_config(SGSNVTY, "sgsn", "encryption GEA0");
+	vc_conn := f_start_handler(refers(f_TC_attach_usim_a50_a54), testcasename(), g_gb, 40);
+	vc_conn.done;
+	f_cleanup();
+}
+
+testcase TC_attach_usim_a54_a50() runs on test_CT {
+	var BSSGP_ConnHdlr vc_conn;
+	f_init();
+	f_sleep(1.0);
+	f_vty_config(SGSNVTY, "sgsn", "encryption GEA0 GEA3 GEA4");
+	vc_conn := f_start_handler(refers(f_TC_attach_usim_a54_a50), testcasename(), g_gb, 40);
+	vc_conn.done;
+	f_cleanup();
+}
 
 /* Send LLC NULL to see if the SGSN survives it (OS#3952) */
 private function f_TC_llc_null(charstring id) runs on BSSGP_ConnHdlr {
@@ -3506,6 +3623,11 @@
 	execute( TC_attach_rau_a_a() );
 	execute( TC_attach_rau_a_b() );
 	execute( TC_attach_usim_resync() );
+	execute( TC_attach_usim_a54_a54() );
+	execute( TC_attach_usim_a54_a53() );
+	execute( TC_attach_usim_a53_a54() );
+	execute( TC_attach_usim_a50_a54() );
+	execute( TC_attach_usim_a54_a50() );
 	execute( TC_detach_unknown_nopoweroff() );
 	execute( TC_detach_unknown_poweroff() );
 	execute( TC_detach_nopoweroff() );
diff --git a/sgsn/expected-results.xml b/sgsn/expected-results.xml
index 0a36e2e..9997895 100644
--- a/sgsn/expected-results.xml
+++ b/sgsn/expected-results.xml
@@ -37,6 +37,11 @@
   <testcase classname='SGSN_Tests' name='TC_attach_rau_a_a' time='MASKED'/>
   <testcase classname='SGSN_Tests' name='TC_attach_rau_a_b' time='MASKED'/>
   <testcase classname='SGSN_Tests' name='TC_attach_usim_resync' time='MASKED'/>
+  <testcase classname='SGSN_Tests' name='TC_attach_usim_a54_a54' time='MASKED'/>
+  <testcase classname='SGSN_Tests' name='TC_attach_usim_a54_a53' time='MASKED'/>
+  <testcase classname='SGSN_Tests' name='TC_attach_usim_a53_a54' time='MASKED'/>
+  <testcase classname='SGSN_Tests' name='TC_attach_usim_a50_a54' time='MASKED'/>
+  <testcase classname='SGSN_Tests' name='TC_attach_usim_a54_a50' time='MASKED'/>
   <testcase classname='SGSN_Tests' name='TC_detach_unknown_nopoweroff' time='MASKED'/>
   <testcase classname='SGSN_Tests' name='TC_detach_unknown_poweroff' time='MASKED'/>
   <testcase classname='SGSN_Tests' name='TC_detach_nopoweroff' time='MASKED'/>

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24629
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Iad65cbf9840aa883cb34e53554b94a4142c82638
Gerrit-Change-Number: 24629
Gerrit-PatchSet: 3
Gerrit-Owner: Hoernchen <ewild at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210616/817f4868/attachment.htm>


More information about the gerrit-log mailing list