From 727493405758ccdee2f665a2ad036d75836d0748 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Fri, 11 Jun 2021 02:41:37 +0200 Subject: [PATCH] bsc: f_cipher_mode(): fail quicker on key mismatch Related: SYS#5324 Change-Id: Ia79779f4229da4a5af271235a5e82c6fd59ea3a2 --- bsc/MSC_ConnectionHandler.ttcn | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn index ec1f80624..0d46bc6d4 100644 --- a/bsc/MSC_ConnectionHandler.ttcn +++ b/bsc/MSC_ConnectionHandler.ttcn @@ -739,9 +739,19 @@ runs on MSC_ConnHdlr { alt { /* RSL/UE Side */ - [] RSL.receive(tr_RSL_ENCR_CMD(g_chan_nr, ?, alg_rsl, expect_kc)) -> value rsl { + [] RSL.receive(tr_RSL_ENCR_CMD(g_chan_nr, ?, alg_rsl, ?)) -> 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); + + var RSL_IE_Body encr_info; + if (not f_rsl_find_ie(rsl, RSL_IE_ENCR_INFO, encr_info)) { + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Missing Encryption IE in RSL ENCR CMD"); + } else { + if (not match(encr_info, tr_EncrInfo(alg_rsl, expect_kc))) { + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, + "Unexpected Kc in Encryption IE in RSL ENCR CMD"); + } + } if (ischosen(l3.msgs.rrm.cipheringModeCommand)) { f_rsl_reply(ts_RRM_CiphModeCompl, rsl); }