Change in osmo-bsc[master]: support A5/4 in inter-BSC Handover

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Jun 22 05:56:09 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/24729 )

Change subject: support A5/4 in inter-BSC Handover
......................................................................

support A5/4 in inter-BSC Handover

inter-BSC into this BSC: from BSSMAP Handover Request, parse and store
Kc128. All else is already implemented: depending on the chosen
encryption algorithm, Kc128 will end up in the Channel Activation.

inter-BSC out of this BSC: nothing is needed to support A5/4, the BSSMAP
Handover Required message does not contain any encryption related
information. The MSC already knows the chosen algorithm.

Related: SYS#5324
Change-Id: I7e9590e8c96aa50086148863ad9a2741b978e614
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/handover_fsm.c
2 files changed, 21 insertions(+), 3 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 1755b92..c5d2b86 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -241,6 +241,8 @@
 	struct gsm0808_channel_type ct;
 	struct gsm0808_speech_codec_list scl;
 	struct gsm0808_encrypt_info ei;
+	bool kc128_present;
+	uint8_t kc128[16];
 	struct gsm_classmark classmark;
 	/* chosen_encr_alg reflects the encoded value as in RSL_ENC_ALG_A5(a5_numer):
 	 * chosen_encr_alg == 1 means A5/0 i.e. no encryption, chosen_encr_alg == 4 means A5/3.
diff --git a/src/osmo-bsc/handover_fsm.c b/src/osmo-bsc/handover_fsm.c
index cae5167..5f4b892 100644
--- a/src/osmo-bsc/handover_fsm.c
+++ b/src/osmo-bsc/handover_fsm.c
@@ -454,6 +454,7 @@
 	int payload_length;
 	bool aoip = gscon_is_aoip(conn);
 	bool sccplite = gscon_is_sccplite(conn);
+	bool has_a54 = false;
 
 	if ((aoip && sccplite) || !(aoip || sccplite)) {
 		LOG_HO(conn, LOGL_ERROR, "Received BSSMAP Handover Request, but conn is not"
@@ -485,6 +486,15 @@
 		return false;
 	}
 
+	if ((e = TLVP_GET(tp, GSM0808_IE_KC_128))) {
+		if (e->len != 16) {
+			LOG_HO(conn, LOGL_ERROR, "Invalid length in Kc128 IE: %u bytes (expected 16)\n", e->len);
+			return false;
+		}
+		memcpy(req->kc128, e->val, 16);
+		req->kc128_present = true;
+	}
+
 	if ((e = TLVP_GET(tp, GSM0808_IE_CLASSMARK_INFORMATION_TYPE_1))) {
 		if (e->len != sizeof(req->classmark.classmark1)) {
 			LOG_HO(conn, LOGL_ERROR, "Classmark Information 1 has wrong size\n");
@@ -513,9 +523,10 @@
 			       req->chosen_encr_alg);
 	}
 
-	LOG_HO(conn, LOGL_DEBUG, "Handover Request encryption info: chosen=A5/%u key=%s\n",
-	       (req->chosen_encr_alg ? : 1) - 1, req->ei.key_len?
-	       osmo_hexdump_nospc(req->ei.key, req->ei.key_len) : "none");
+	LOG_HO(conn, LOGL_DEBUG, "Handover Request encryption info: chosen=A5/%u key=%s kc128=%s\n",
+	       (req->chosen_encr_alg ? : 1) - 1,
+	       req->ei.key_len ? osmo_hexdump_nospc(req->ei.key, req->ei.key_len) : "none",
+	       has_a54 ? osmo_hexdump_nospc(req->kc128, 16) : "none");
 
 	if (TLVP_PRESENT(tp, GSM0808_IE_AOIP_TRASP_ADDR)) {
 		int rc;
@@ -720,6 +731,11 @@
 		info.encr.key_len = req->ei.key_len;
 	}
 
+	if (req->kc128_present) {
+		memcpy(info.encr.kc128, req->kc128, 16);
+		info.encr.kc128_present = true;
+	}
+
 	if (req->last_eutran_plmn_valid) {
 		conn->fast_return.allowed = ho->new_bts->srvcc_fast_return_allowed;
 		conn->fast_return.last_eutran_plmn_valid = true;

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I7e9590e8c96aa50086148863ad9a2741b978e614
Gerrit-Change-Number: 24729
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210622/825f859a/attachment.htm>


More information about the gerrit-log mailing list