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
This commit is contained in:
parent
82d2b87b47
commit
73cd271a56
|
@ -1212,9 +1212,9 @@ private function f_tc_assignment_fr_a5_0(charstring id) runs on MSC_ConnHdlr {
|
|||
|
||||
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 @@ private function f_tc_assignment_fr_a5_1(charstring id) runs on MSC_ConnHdlr {
|
|||
|
||||
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 @@ private function f_tc_assignment_fr_a5_1_codec_missing(charstring id) runs on MS
|
|||
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 @@ private function f_tc_assignment_fr_a5_3(charstring id ) runs on MSC_ConnHdlr {
|
|||
|
||||
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 @@ private function f_tc_assignment_fr_a5_4(charstring id) runs on MSC_ConnHdlr {
|
|||
|
||||
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 {
|
||||
|
|
|
@ -99,6 +99,35 @@ function f_rsl_reply(template PDU_ML3_MS_NW l3, RSL_Message orig) runs on MSC_Co
|
|||
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 {
|
||||
|
|
|
@ -703,5 +703,62 @@ modifies ts_BSSAP_BSSMAP := {
|
|||
}
|
||||
}
|
||||
|
||||
template PDU_BSSAP ts_BSSMAP_CipherModeCmd(OCT1 alg, OCT8 key)
|
||||
modifies ts_BSSAP_BSSMAP := {
|
||||
pdu := {
|
||||
bssmap := {
|
||||
cipherModeCommand := {
|
||||
messageType := '53'O,
|
||||
layer3HeaderInfo := omit,
|
||||
encryptionInformation := ts_BSSMAP_IE_EncrInfo(key, alg),
|
||||
cipherResponseMode := omit,
|
||||
kC128 := omit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template PDU_BSSAP ts_BSSMAP_CipherModeCmdKc128(OCT1 alg, OCT8 key, OCT16 kc128)
|
||||
modifies ts_BSSAP_BSSMAP := {
|
||||
pdu := {
|
||||
bssmap := {
|
||||
cipherModeCommand := {
|
||||
messageType := '53'O,
|
||||
layer3HeaderInfo := omit,
|
||||
encryptionInformation := ts_BSSMAP_IE_EncrInfo(key, alg),
|
||||
cipherResponseMode := omit,
|
||||
kC128 := { '83'O, kc128 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template PDU_BSSAP tr_BSSMAP_CipherModeCompl(template OCT1 alg := ?) modifies tr_BSSAP_BSSMAP := {
|
||||
pdu := {
|
||||
bssmap := {
|
||||
cipherModeComplete := {
|
||||
messageType := '55'O,
|
||||
layer3MessageContents := *,
|
||||
chosenEncryptionAlgorithm := {
|
||||
elementIdentifier := '2C'O,
|
||||
algorithmIdentifier := alg
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template PDU_BSSAP tr_BSSMAP_CipherModeRej modifies tr_BSSAP_BSSMAP := {
|
||||
pdu := {
|
||||
bssmap := {
|
||||
cipherModeReject := {
|
||||
messageType := '59'O,
|
||||
cause := ?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} with { encode "RAW" };
|
||||
|
|
|
@ -126,5 +126,20 @@ template (value) PDU_ML3_MS_NW ts_RRM_ModeModifyAck(ChannelDescription2_V desc,
|
|||
}
|
||||
}
|
||||
|
||||
template (value) PDU_ML3_MS_NW ts_RRM_CiphModeCompl := {
|
||||
discriminator := '0000'B, /* overwritten */
|
||||
tiOrSkip := {
|
||||
skipIndicator := '0000'B
|
||||
},
|
||||
msgs := {
|
||||
rrm := {
|
||||
cipheringModeComplete := {
|
||||
messageType := '00110010'B,
|
||||
mobileEquipmentIdentity := omit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -330,6 +330,19 @@ module RSL_Types {
|
|||
uint5_t power_level
|
||||
}
|
||||
|
||||
/* 9.3.7 */
|
||||
type record RSL_IE_EncryptionInfo {
|
||||
uint8_t len,
|
||||
OCT1 alg_id,
|
||||
octetstring key
|
||||
} with { variant (len) "LENGTHTO(alg_id,key)" };
|
||||
|
||||
template RSL_IE_EncryptionInfo tr_RSL_IE_EncrInfo(template OCT1 alg, template octetstring key) := {
|
||||
len := ?,
|
||||
alg_id := alg,
|
||||
key := key
|
||||
}
|
||||
|
||||
/* 9.3.8 */
|
||||
type record RSL_IE_FrameNumber {
|
||||
uint5_t t1_p,
|
||||
|
@ -550,6 +563,7 @@ module RSL_Types {
|
|||
uint8_t paging_group,
|
||||
RSL_IE_ChanNeeded chan_needed,
|
||||
RSL_IE_StartingTime starting_time,
|
||||
RSL_IE_EncryptionInfo encr_info,
|
||||
RSL_IE_RequestRef req_ref,
|
||||
RSL_LV full_imm_ass_info,
|
||||
RSL_LV ms_identity,
|
||||
|
@ -595,6 +609,7 @@ module RSL_Types {
|
|||
paging_group, iei = RSL_IE_PAGING_GROUP;
|
||||
chan_needed, iei = RSL_IE_CHAN_NEEDED;
|
||||
starting_time, iei = RSL_IE_STARTNG_TIME;
|
||||
encr_info, iei = RSL_IE_ENCR_INFO;
|
||||
|
||||
req_ref, iei = RSL_IE_REQ_REFERENCE;
|
||||
full_imm_ass_info, iei = RSL_IE_FULL_IMM_ASS_INFO;
|
||||
|
@ -852,6 +867,22 @@ template RSL_Message tr_RSL_MsgTypeDR(template RSL_MessageType msg_type) modifie
|
|||
}
|
||||
}
|
||||
|
||||
/* 8.4.6 BSC ->BTS */
|
||||
template RSL_Message tr_RSL_ENCR_CMD(template RslChannelNr chan_nr,
|
||||
template RslLinkId link_id := ?,
|
||||
template OCT1 alg := ?,
|
||||
template octetstring key := ?,
|
||||
template octetstring l3_info := ?) := {
|
||||
msg_disc := ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),
|
||||
msg_type := RSL_MT_ENCR_CMD,
|
||||
ies := {
|
||||
tr_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr}),
|
||||
tr_RSL_IE(RSL_IE_Body:{encr_info := tr_RSL_IE_EncrInfo(alg, key)}),
|
||||
tr_RSL_IE(RSL_IE_Body:{link_id := link_id}),
|
||||
tr_RSL_IE(RSL_IE_Body:{l3_info := tr_RSL_L16V(l3_info)})
|
||||
}
|
||||
}
|
||||
|
||||
/* 8.4.10 BTS -> BSC */
|
||||
template RSL_Message ts_RSL_MODE_MODIFY_ACK(RslChannelNr chan_nr) := {
|
||||
msg_disc := ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),
|
||||
|
|
Loading…
Reference in New Issue