BSC_Tests: Implement ecnryption related procedures
Let's verify the operation of the CIPHERING MODE COMMAND as issued
by MSC, performed by BSC and implemented by simulated BTS/MS.
Change-Id: Ibc06bd2177c63837a794a0ca1f54ebef17499e78
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index d1f5c3d..160d662 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -1212,9 +1212,9 @@
ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR}));
- ass_cmd.pdu.bssmap.assignmentRequest.encryptionInformation :=
- valueof(ts_BSSMAP_IE_EncrInfo(kc, '01'O));
+
f_establish_fully(pars, ass_cmd, exp_compl);
+ f_cipher_mode('01'O, kc);
}
testcase TC_assignment_fr_a5_0() runs on test_CT {
@@ -1239,10 +1239,9 @@
ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR}));
- ass_cmd.pdu.bssmap.assignmentRequest.encryptionInformation :=
- valueof(ts_BSSMAP_IE_EncrInfo(kc, '02'O));
f_establish_fully(pars, ass_cmd, exp_compl);
+ f_cipher_mode('02'O, kc);
}
testcase TC_assignment_fr_a5_1() runs on test_CT {
@@ -1264,8 +1263,6 @@
const OCT8 kc := '0001020304050607'O;
ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
- ass_cmd.pdu.bssmap.assignmentRequest.encryptionInformation :=
- valueof(ts_BSSMAP_IE_EncrInfo(kc, '02'O));
f_establish_fully(pars, ass_cmd, exp_fail);
}
@@ -1289,9 +1286,9 @@
ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR}));
- ass_cmd.pdu.bssmap.assignmentRequest.encryptionInformation :=
- valueof(ts_BSSMAP_IE_EncrInfo(kc, '08'O));
+
f_establish_fully(pars, ass_cmd, exp_compl);
+ f_cipher_mode('08'O, kc);
}
testcase TC_assignment_fr_a5_3() runs on test_CT {
@@ -1315,11 +1312,9 @@
ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR}));
- ass_cmd.pdu.bssmap.assignmentRequest.encryptionInformation :=
- valueof(ts_BSSMAP_IE_EncrInfo(kc, '10'O));
- ass_cmd.pdu.bssmap.assignmentRequest.kC128 := valueof(ts_BSSMAP_IE_Kc128(kc128));
/* TODO: expect GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED cause value */
f_establish_fully(pars, ass_cmd, exp_fail);
+ f_cipher_mode('10'O, kc, kc128);
}
testcase TC_assignment_fr_a5_4() runs on test_CT {
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index d615497..a76d1d6 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -99,6 +99,35 @@
RSL.send(ts_RSL_DATA_IND(chan_nr, link_id, enc_PDU_ML3_MS_NW(valueof(l3))));
}
+function f_cipher_mode(OCT1 alg, OCT8 key, template OCT16 kc128 := omit) runs on MSC_ConnHdlr {
+ var PDU_BSSAP bssap;
+ var RSL_Message rsl;
+
+ if (isvalue(kc128)) {
+ BSSAP.send(ts_BSSMAP_CipherModeCmdKc128(alg, key, valueof(kc128)));
+ } else {
+ BSSAP.send(ts_BSSMAP_CipherModeCmd(alg, key));
+ }
+ alt {
+ /* RSL/UE Side */
+ [] RSL.receive(tr_RSL_ENCR_CMD(g_chan_nr, ?, alg, key)) -> value rsl {
+ var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[3].body.l3_info.payload);
+ log("Rx L3 from net: ", l3);
+ if (ischosen(l3.msgs.rrm.cipheringModeCommand)) {
+ f_rsl_reply(ts_RRM_CiphModeCompl, rsl);
+ }
+ repeat;
+ }
+ [] BSSAP.receive(tr_BSSMAP_CipherModeCompl) -> value bssap {
+ // bssap.bssmap.cipherModeComplete.chosenEncryptionAlgorithm.algoritmhIdentifier
+ setverdict(pass);
+ }
+ [] BSSAP.receive(tr_BSSMAP_CipherModeRej) -> value bssap {
+ setverdict(fail, "Ciphering Mode Reject");
+ }
+ }
+}
+
/* establish a channel fully, expecting an assignment matching 'exp' */
function f_establish_fully(TestHdlrParams pars, PDU_BSSAP ass_cmd, template PDU_BSSAP exp_ass_cpl)
runs on MSC_ConnHdlr return PDU_BSSAP {