aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2018-02-07 18:36:25 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2018-02-08 15:17:30 +0100
commitb20c3dccedb721b6c1c060809a90d0311bfa293c (patch)
tree8fe2519b55368f98a23f732150703624c790e05a
parent86f3920e5b7a0fa141f4dcf2831237d9a155a6ac (diff)
msc: convert bssmap chipher to rsl chiper representation
The representation of the chiphering algorithm is different bssmap and RSL. BSSMAP uses a bitmask and RSL a numeric value. For A50 and A51 the values match up by coincidence, from A5/2 onwards they differ. - Add a function to convert the BSSMAP representation to the RSL representation and use the converted value to set up the temlate for the expected RSL message Change-Id: I274c1ff0b5636c48411f994f918e783b468cb3be
-rw-r--r--bsc/MSC_ConnectionHandler.ttcn48
1 files changed, 47 insertions, 1 deletions
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 5a645bdc..51aebd2e 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -323,19 +323,65 @@ function f_rsl_reply(template PDU_ML3_MS_NW l3, RSL_Message orig) runs on MSC_Co
f_rsl_send_l3(l3, link_id, chan_nr);
}
+/* Convert the chipher representation on BSSMAP to the representation used on RSL */
+function f_chipher_mode_bssmap_to_rsl(OCT1 alg_bssmap) return OCT1
+{
+ /* A5 0 */
+ if (alg_bssmap == '01'O) {
+ return '01'O;
+ }
+ /* A5 1 */
+ else if (alg_bssmap == '02'O) {
+ return '02'O;
+ }
+ /* A5 2 */
+ else if (alg_bssmap == '04'O) {
+ return '03'O;
+ }
+ /* A5 3 */
+ else if (alg_bssmap == '08'O) {
+ return '04'O;
+ }
+ /* A5 4 */
+ else if (alg_bssmap == '10'O) {
+ return '05'O;
+ }
+ /* A5 5 */
+ else if (alg_bssmap == '20'O) {
+ return '06'O;
+ }
+ /* A5 6 */
+ else if (alg_bssmap == '40'O) {
+ return '07'O;
+ }
+ /* A5 7 */
+ else if (alg_bssmap == '80'O) {
+ return '08'O;
+ } else {
+ setverdict(fail, "Unexpected Encryption Algorithm");
+ return '00'O;
+ }
+}
+
function f_cipher_mode(OCT1 alg, OCT8 key, template OCT16 kc128 := omit, boolean exp_fail := false)
runs on MSC_ConnHdlr {
var PDU_BSSAP bssap;
var RSL_Message rsl;
+ var OCT1 alg_rsl;
if (isvalue(kc128)) {
BSSAP.send(ts_BSSMAP_CipherModeCmdKc128(alg, key, valueof(kc128)));
} else {
BSSAP.send(ts_BSSMAP_CipherModeCmd(alg, 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);
+
alt {
/* RSL/UE Side */
- [] RSL.receive(tr_RSL_ENCR_CMD(g_chan_nr, ?, alg, key)) -> value rsl {
+ [] RSL.receive(tr_RSL_ENCR_CMD(g_chan_nr, ?, alg_rsl, 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)) {