bsc: reduce args to f_cipher_mode()
Instead of passing each part individually, simply pass the entire TestHdlrEncrParams to f_cipher_mode(). Preparation for A5/4. Add the kc128 to TestHdlrEncrParams instead of a function arg. kc128 is so far unused, but will be used in an upcoming patch adding A5/4. Related: SYS#5324 Change-Id: I2cb8282e55436da5ae64ab569df87d5d5a0dd2f0
This commit is contained in:
parent
14b5fea25f
commit
6c388f209d
|
@ -3452,7 +3452,7 @@ private function f_TC_assignment_a5_not_sup(charstring id) runs on MSC_ConnHdlr
|
|||
}
|
||||
|
||||
/* Start ciphering, expect Cipher Mode Reject */
|
||||
f_cipher_mode(g_pars.encr.enc_alg, g_pars.encr.enc_key, exp_fail := true);
|
||||
f_cipher_mode(g_pars.encr, exp_fail := true);
|
||||
}
|
||||
testcase TC_assignment_fr_a5_not_sup() runs on test_CT {
|
||||
var TestHdlrParams pars := f_gen_test_hdlr_pars();
|
||||
|
@ -6776,7 +6776,7 @@ runs on MSC_ConnHdlr {
|
|||
/* start ciphering, if requested */
|
||||
if (ispresent(g_pars.encr)) {
|
||||
f_logp(BSCVTY, "start ciphering");
|
||||
f_cipher_mode(g_pars.encr.enc_alg, g_pars.encr.enc_key);
|
||||
f_cipher_mode(g_pars.encr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -544,12 +544,14 @@ function f_create_bssmap_exp(octetstring l3_enc) runs on MSC_ConnHdlr {
|
|||
|
||||
type record TestHdlrEncrParams {
|
||||
OCT1 enc_alg,
|
||||
octetstring enc_key
|
||||
octetstring enc_key,
|
||||
octetstring enc_kc128 optional
|
||||
};
|
||||
|
||||
template (value) TestHdlrEncrParams t_EncrParams(OCT1 alg, octetstring key) := {
|
||||
template (value) TestHdlrEncrParams t_EncrParams(OCT1 alg, octetstring key, template (omit) octetstring kc128 := omit) := {
|
||||
enc_alg := alg,
|
||||
enc_key := key
|
||||
enc_key := key,
|
||||
enc_kc128 := kc128
|
||||
}
|
||||
|
||||
type record TestHdlrParamsLcls {
|
||||
|
@ -711,25 +713,25 @@ function f_chipher_mode_bssmap_to_rsl(OCT1 alg_bssmap) return RSL_AlgId
|
|||
}
|
||||
}
|
||||
|
||||
function f_cipher_mode(OCT1 alg, OCT8 key, template OCT16 kc128 := omit, boolean exp_fail := false)
|
||||
function f_cipher_mode(TestHdlrEncrParams enc, boolean exp_fail := false)
|
||||
runs on MSC_ConnHdlr {
|
||||
var PDU_BSSAP bssap;
|
||||
var RSL_Message rsl;
|
||||
var RSL_AlgId alg_rsl;
|
||||
|
||||
if (isvalue(kc128)) {
|
||||
BSSAP.send(ts_BSSMAP_CipherModeCmdKc128(alg, key, valueof(kc128)));
|
||||
if (isvalue(enc.enc_kc128)) {
|
||||
BSSAP.send(ts_BSSMAP_CipherModeCmdKc128(enc.enc_alg, enc.enc_key, valueof(enc.enc_kc128)));
|
||||
} else {
|
||||
BSSAP.send(ts_BSSMAP_CipherModeCmd(alg, key));
|
||||
BSSAP.send(ts_BSSMAP_CipherModeCmd(enc.enc_alg, enc.enc_key));
|
||||
}
|
||||
|
||||
/* RSL uses a different representation of the encryption algorithm,
|
||||
* so we need to convert first */
|
||||
alg_rsl := f_chipher_mode_bssmap_to_rsl(alg);
|
||||
alg_rsl := f_chipher_mode_bssmap_to_rsl(enc.enc_alg);
|
||||
|
||||
alt {
|
||||
/* RSL/UE Side */
|
||||
[] RSL.receive(tr_RSL_ENCR_CMD(g_chan_nr, ?, alg_rsl, key)) -> value rsl {
|
||||
[] RSL.receive(tr_RSL_ENCR_CMD(g_chan_nr, ?, alg_rsl, enc.enc_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)) {
|
||||
|
@ -1147,7 +1149,7 @@ runs on MSC_ConnHdlr {
|
|||
|
||||
/* start ciphering, if requested */
|
||||
if (ispresent(g_pars.encr)) {
|
||||
f_cipher_mode(g_pars.encr.enc_alg, g_pars.encr.enc_key);
|
||||
f_cipher_mode(g_pars.encr);
|
||||
}
|
||||
|
||||
/* bail out early if no assignment requested */
|
||||
|
|
Loading…
Reference in New Issue