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
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index a4f1f51..8e915ac 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -544,12 +544,14 @@
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_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 @@
/* 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 */