Change in osmo-ttcn3-hacks[master]: bsc: f_cipher_mode(): fail quicker on key mismatch

neels gerrit-no-reply at lists.osmocom.org
Tue Jun 15 13:19:07 UTC 2021


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24670 )


Change subject: bsc: f_cipher_mode(): fail quicker on key mismatch
......................................................................

bsc: f_cipher_mode(): fail quicker on key mismatch

Related: SYS#5324
Change-Id: Ia79779f4229da4a5af271235a5e82c6fd59ea3a2
---
M bsc/MSC_ConnectionHandler.ttcn
1 file changed, 13 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/70/24670/1

diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 799d41e..d902301 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -730,6 +730,8 @@
 
 	if (alg_rsl == RSL_ALG_ID_A5_4 and ispresent(enc.enc_kc128)) {
 		expect_kc := enc.enc_kc128;
+	} else if (alg_rsl == RSL_ALG_ID_A5_0) {
+		expect_kc := ''O;
 	} else {
 		expect_kc := enc.enc_key;
 	}
@@ -737,9 +739,19 @@
 
 	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);
 		}

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24670
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ia79779f4229da4a5af271235a5e82c6fd59ea3a2
Gerrit-Change-Number: 24670
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210615/30e0617c/attachment.htm>


More information about the gerrit-log mailing list