Change in libosmocore[master]: [WIP] a54 libfuncs

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/.

Hoernchen gerrit-no-reply at lists.osmocom.org
Wed Jun 9 01:27:14 UTC 2021


Hoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/24628 )


Change subject: [WIP] a54 libfuncs
......................................................................

[WIP] a54 libfuncs

Change-Id: I0fc25c6f23e76d210cbb9822b7e0a8184144ec42
Related: SYS#5324
---
M include/osmocom/gsm/gsm0808.h
M src/gsm/gsm0808.c
2 files changed, 13 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/28/24628/1

diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h
index dc3610f..0cbe787 100644
--- a/include/osmocom/gsm/gsm0808.h
+++ b/include/osmocom/gsm/gsm0808.h
@@ -52,8 +52,8 @@
 struct msgb *gsm0808_create_clear_command(uint8_t cause);
 struct msgb *gsm0808_create_clear_command2(uint8_t cause, bool csfb_ind);
 struct msgb *gsm0808_create_clear_complete(void);
-struct msgb *gsm0808_create_cipher(const struct gsm0808_encrypt_info *ei,
-				   const uint8_t *cipher_response_mode);
+struct msgb *gsm0808_create_cipher(const struct gsm0808_encrypt_info *ei, uint8_t *kc128,
+                   const uint8_t *cipher_response_mode);
 struct msgb *gsm0808_create_cipher_complete(struct msgb *layer3, uint8_t alg_id);
 struct msgb *gsm0808_create_cipher_reject(enum gsm0808_cause cause);
 struct msgb *gsm0808_create_cipher_reject_ext(enum gsm0808_cause_class class, uint8_t ext);
@@ -165,6 +165,7 @@
 struct gsm0808_handover_request {
 	struct gsm0808_channel_type channel_type;
 	struct gsm0808_encrypt_info encryption_information;
+	uint8_t kc128[16];
 	struct osmo_gsm48_classmark classmark_information;
 	struct gsm0808_cell_id cell_identifier_serving;
 	struct gsm0808_cell_id cell_identifier_target;
@@ -200,7 +201,7 @@
 	/* more items are defined in the spec and may be added later */
 	bool more_items; /*!< always set this to false */
 };
-struct msgb *gsm0808_create_handover_request(const struct gsm0808_handover_request *params);
+struct msgb *gsm0808_create_handover_request(const struct gsm0808_handover_request *params, uint8_t *kc128);
 
 struct msgb *gsm0808_create_handover_request_ack(const uint8_t *l3_info, uint8_t l3_info_len,
 						 uint8_t chosen_channel, uint8_t chosen_encr_alg,
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index 3a39fd1..4b2a786 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -230,9 +230,10 @@
 
 /*! Create BSSMAP Cipher Mode Command message
  *  \param[in] ei Mandatory Encryption Information
+ *  \param[in] kc128 optional kc128 key for A5/4
  *  \param[in] cipher_response_mode optional 1-byte Cipher Response Mode
  *  \returns callee-allocated msgb with BSSMAP Cipher Mode Command message */
-struct msgb *gsm0808_create_cipher(const struct gsm0808_encrypt_info *ei,
+struct msgb *gsm0808_create_cipher(const struct gsm0808_encrypt_info *ei, uint8_t* kc128,
 				   const uint8_t *cipher_response_mode)
 {
 	/* See also: 3GPP TS 48.008 3.2.1.30 CIPHER MODE COMMAND */
@@ -258,6 +259,9 @@
 		msgb_tv_put(msg, GSM0808_IE_CIPHER_RESPONSE_MODE,
 			    *cipher_response_mode);
 
+	if(kc128)
+		msgb_tv_fixed_put(msg, GSM0808_IE_KC_128, 16, kc128);
+
 	/* pre-pend the header */
 	msg->l3h =
 	    msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg));
@@ -905,7 +909,7 @@
  * Sent from the MSC to the potential new target cell during inter-BSC handover, or to the target MSC during inter-MSC
  * handover.
  */
-struct msgb *gsm0808_create_handover_request(const struct gsm0808_handover_request *params)
+struct msgb *gsm0808_create_handover_request(const struct gsm0808_handover_request *params, uint8_t* kc128)
 {
 	struct msgb *msg;
 
@@ -991,6 +995,9 @@
 		msgb_tv_fixed_put(msg, GSM0808_IE_CALL_ID, 4, val);
 	}
 
+	if(kc128)
+		msgb_tv_fixed_put(msg, GSM0808_IE_KC_128, 16, kc128);
+
 	if (params->global_call_reference && params->global_call_reference_len) {
 		msgb_tlv_put(msg, GSM0808_IE_GLOBAL_CALL_REF,
 			     params->global_call_reference_len, params->global_call_reference);

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I0fc25c6f23e76d210cbb9822b7e0a8184144ec42
Gerrit-Change-Number: 24628
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen <ewild at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210609/05c0bfff/attachment.htm>


More information about the gerrit-log mailing list