Change in osmo-ttcn3-hacks[master]: msc: add inter-BSC HO tests with A5 encryption

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

neels gerrit-no-reply at lists.osmocom.org
Wed Jun 23 21:53:49 UTC 2021


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24761 )


Change subject: msc: add inter-BSC HO tests with A5 encryption
......................................................................

msc: add inter-BSC HO tests with A5 encryption

Related: SYS#5324
Change-Id: I57e43c60d4389bd301d0195179321a34401bd1dc
---
M library/BSSMAP_Templates.ttcn
M msc/MSC_Tests.ttcn
2 files changed, 80 insertions(+), 7 deletions(-)



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

diff --git a/library/BSSMAP_Templates.ttcn b/library/BSSMAP_Templates.ttcn
index cde0fb0..9b1203d 100644
--- a/library/BSSMAP_Templates.ttcn
+++ b/library/BSSMAP_Templates.ttcn
@@ -954,11 +954,18 @@
 	}
 }
 
-template PDU_BSSAP tr_BSSMAP_HandoverRequest modifies tr_BSSAP_BSSMAP := {
+template PDU_BSSAP tr_BSSMAP_HandoverRequest(template BSSMAP_IE_EncryptionInformation encryptionInformation := *,
+					     template BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := *,
+					     template BSSMAP_IE_KC128 kC128 := *
+					    )
+  modifies tr_BSSAP_BSSMAP := {
 	pdu := {
 		bssmap := {
 			handoverRequest := {
-				messageType := '10'O
+				messageType := '10'O,
+				encryptionInformation := encryptionInformation,
+				chosenEncryptionAlgorithm := chosenEncryptionAlgorithm,
+				kC128 := kC128
 			}
 		}
 	}
diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 46a368e..949988c 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -5764,8 +5764,22 @@
 	 * from now on this here is the new BSS. */
 	f_create_bssmap_exp_handoverRequest(193);
 
+	var template BSSMAP_IE_EncryptionInformation encryptionInformation;
+	var template BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm;
+	var template BSSMAP_IE_KC128 kC128;
+	var OCT1 a5_perm_alg;
+	f_get_expected_encryption(encryptionInformation, chosenEncryptionAlgorithm, kC128, a5_perm_alg);
+	var template PDU_BSSAP expect_ho_request := tr_BSSMAP_HandoverRequest(encryptionInformation, chosenEncryptionAlgorithm, kC128);
 	var PDU_BSSAP ho_request;
-	BSSAP.receive(tr_BSSMAP_HandoverRequest) -> value ho_request;
+	alt {
+	[] BSSAP.receive(expect_ho_request);
+	[] BSSAP.receive(tr_BSSMAP_HandoverRequest) -> value ho_request {
+		log("Error: Unexpected handoverRequest received. Expected: ", expect_ho_request,
+		    " got ", ho_request);
+		setverdict(fail, "Unexpected handoverRequest received");
+		mtc.stop;
+		}
+	}
 
 	/* new BSS composes a RR Handover Command */
 	var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand);
@@ -5812,9 +5826,22 @@
 	f_init_handler(pars);
 	f_create_bssmap_exp_handoverRequest(194);
 
+	var template BSSMAP_IE_EncryptionInformation encryptionInformation;
+	var template BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm;
+	var template BSSMAP_IE_KC128 kC128;
+	var OCT1 a5_perm_alg;
+	f_get_expected_encryption(encryptionInformation, chosenEncryptionAlgorithm, kC128, a5_perm_alg);
+	var template PDU_BSSAP expect_ho_request := tr_BSSMAP_HandoverRequest(encryptionInformation, chosenEncryptionAlgorithm, kC128);
 	var PDU_BSSAP ho_request;
-	BSSAP.receive(tr_BSSMAP_HandoverRequest) -> value ho_request;
-
+	alt {
+	[] BSSAP.receive(expect_ho_request);
+	[] BSSAP.receive(tr_BSSMAP_HandoverRequest) -> value ho_request {
+		log("Error: Unexpected handoverRequest received. Expected: ", expect_ho_request,
+		    " got ", ho_request);
+		setverdict(fail, "Unexpected handoverRequest received");
+		mtc.stop;
+		}
+	}
 	/* new BSS composes a RR Handover Command */
 	var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand);
 	var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd);
@@ -5861,15 +5888,42 @@
 	f_expect_clear();
 	setverdict(pass);
 }
-function f_tc_ho_inter_bsc_main(boolean use_ipv6 := false) runs on MTC_CT {
+function f_tc_ho_inter_bsc_main(boolean use_ipv6 := false, integer a5_n := 0) runs on MTC_CT {
 	var BSC_ConnHdlr vc_conn0;
 	var BSC_ConnHdlr vc_conn1;
 	f_init(2);
 
 	var BSC_ConnHdlrPars pars0 := f_init_pars(53);
 	pars0.use_ipv6 := use_ipv6;
+	pars0.net.expect_ciph := a5_n > 0;
+	pars0.net.expect_auth := pars0.net.expect_ciph;
+	pars0.net.kc_support := bit2oct('00000001'B << a5_n);
+	pars0.cm2.classmarkInformationType2_oct5.a5_3 := '1'B;
+	pars0.cm2.classmarkInformationType2_oct5.a5_2 := '0'B;
+	pars0.cm2.classmarkInformationType2_oct5.cm3 := '1'B;
+	pars0.cm3 := valueof(ts_CM3_default);
+	pars0.use_umts_aka := true;
+	pars0.vec := f_gen_auth_vec_3g();
+	pars0.vec_keep := true;
+
 	var BSC_ConnHdlrPars pars1 := f_init_pars(53);
 	pars1.use_ipv6 := use_ipv6;
+	pars1.net.expect_ciph := pars0.net.expect_ciph;
+	pars1.net.expect_auth := pars0.net.expect_ciph;
+	pars1.net.kc_support := bit2oct('00000001'B << a5_n);
+	pars1.cm2 := pars0.cm2;
+	pars1.cm3 := pars0.cm3;
+	pars1.use_umts_aka := true;
+	/* Both components need the same auth vector info because we expect f_tc_ho_inter_bsc0's ciphering key to be
+	 * identical to the one that shows up in f_tc_ho_inter_bsc1. Can only do that by feeding in a vector to both
+	 * components and then not overwriting it in BSC_ConnectionHandler. */
+	pars1.vec := pars0.vec;
+	pars1.vec_keep := true;
+
+	if (a5_n > 0) {
+		f_vty_config(MSCVTY, "network", "authentication required");
+	}
+	f_vty_config(MSCVTY, "network", "encryption a5 " & int2str(a5_n));
 
 	vc_conn0 := f_start_handler_with_pars(refers(f_tc_ho_inter_bsc0), pars0, 0);
 	vc_conn1 := f_start_handler_with_pars(refers(f_tc_ho_inter_bsc1), pars1, 1);
@@ -5877,7 +5931,16 @@
 	vc_conn1.done;
 }
 testcase TC_ho_inter_bsc() runs on MTC_CT {
-	f_tc_ho_inter_bsc_main(false);
+	f_tc_ho_inter_bsc_main(false, a5_n := 0);
+}
+testcase TC_ho_inter_bsc_a5_1() runs on MTC_CT {
+	f_tc_ho_inter_bsc_main(false, a5_n := 1);
+}
+testcase TC_ho_inter_bsc_a5_3() runs on MTC_CT {
+	f_tc_ho_inter_bsc_main(false, a5_n := 3);
+}
+testcase TC_ho_inter_bsc_a5_4() runs on MTC_CT {
+	f_tc_ho_inter_bsc_main(false, a5_n := 4);
 }
 testcase TC_ho_inter_bsc_ipv6() runs on MTC_CT {
 	f_tc_ho_inter_bsc_main(true);
@@ -6614,6 +6677,9 @@
 
 	execute( TC_ho_inter_bsc_unknown_cell() );
 	execute( TC_ho_inter_bsc() );
+	execute( TC_ho_inter_bsc_a5_1() );
+	execute( TC_ho_inter_bsc_a5_3() );
+	execute( TC_ho_inter_bsc_a5_4() );
 	execute( TC_ho_inter_bsc_ipv6() );
 
 	execute( TC_ho_inter_msc_out() );

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24761
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: I57e43c60d4389bd301d0195179321a34401bd1dc
Gerrit-Change-Number: 24761
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210623/4a337f12/attachment.htm>


More information about the gerrit-log mailing list