bsc: implement ttcn API and cfg for A5/4

Implement tools for OsmoBSC a5/4 support testing:

- in f_cipher_mode() and f_check_chan_act(), expect Kc128 key as
  appropriate, using recently added g_pars.encr.enc_kc128
- osmo-bsc.cfg: allow a5/4

Related: SYS#5324
Change-Id: Ifa48a8498dde7d04fb29f497013bdb5a1e5f3597
This commit is contained in:
Neels Hofmeyr 2021-06-11 01:38:18 +02:00 committed by laforge
parent 6c388f209d
commit 0588cadcfd
3 changed files with 20 additions and 5 deletions

View File

@ -3461,7 +3461,7 @@ testcase TC_assignment_fr_a5_not_sup() runs on test_CT {
f_init(1, true);
f_sleep(1.0);
pars.encr := valueof(t_EncrParams('20'O, f_rnd_octstring(8)));
pars.encr := valueof(t_EncrParams('20'O, f_rnd_octstring(8), f_rnd_octstring(16)));
vc_conn := f_start_handler(refers(f_TC_assignment_a5_not_sup), pars);
vc_conn.done;
f_shutdown_helper();

View File

@ -718,6 +718,7 @@ runs on MSC_ConnHdlr {
var PDU_BSSAP bssap;
var RSL_Message rsl;
var RSL_AlgId alg_rsl;
var octetstring expect_kc;
if (isvalue(enc.enc_kc128)) {
BSSAP.send(ts_BSSMAP_CipherModeCmdKc128(enc.enc_alg, enc.enc_key, valueof(enc.enc_kc128)));
@ -729,9 +730,16 @@ runs on MSC_ConnHdlr {
* so we need to convert first */
alg_rsl := f_chipher_mode_bssmap_to_rsl(enc.enc_alg);
if (alg_rsl == RSL_ALG_ID_A5_4 and ispresent(enc.enc_kc128)) {
expect_kc := enc.enc_kc128;
} else {
expect_kc := enc.enc_key;
}
log("for encryption algo ", alg_rsl, " expect kc = ", expect_kc);
alt {
/* RSL/UE Side */
[] RSL.receive(tr_RSL_ENCR_CMD(g_chan_nr, ?, alg_rsl, enc.enc_key)) -> value rsl {
[] RSL.receive(tr_RSL_ENCR_CMD(g_chan_nr, ?, alg_rsl, expect_kc)) -> 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)) {
@ -842,8 +850,15 @@ private function f_check_chan_act(AssignmentState st, RSL_Message chan_act) runs
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Missing Encryption IE in CHAN ACT");
} else {
var RSL_AlgId alg := f_chipher_mode_bssmap_to_rsl(g_pars.encr.enc_alg);
if (not match(encr_info, tr_EncrInfo(alg, g_pars.encr.enc_key))) {
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Wrong Encryption IE in CHAN ACT");
var octetstring expect_key;
if (alg == RSL_ALG_ID_A5_4) {
expect_key := g_pars.encr.enc_kc128;
} else {
expect_key := g_pars.encr.enc_key;
}
if (not match(encr_info, tr_EncrInfo(alg, expect_key))) {
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
"Unexpected Kc in Encryption IE in RSL ENCR CMD");
}
}
} else {

View File

@ -69,7 +69,7 @@ cs7 instance 0
network
network country code 1
mobile network code 1
encryption a5 0 1 3
encryption a5 0 1 3 4
neci 1
paging any use tch 0
handover 1