[PATCH] libosmocore[master]: Add function to check GMM encryptability

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

Max gerrit-no-reply at lists.osmocom.org
Tue Jul 5 14:18:30 UTC 2016


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/465

to look at the new patch set (#2).

Add function to check GMM encryptability

Check if particular GMM message can be encrypted according to 3GPP TS
24.008 § 4.7.1.2

Related: OS#1582
Change-Id: I7ad0e03c2c738d174dd6bc3453f332eeb8da1e7d
---
M include/osmocom/gsm/protocol/gsm_04_08.h
1 file changed, 25 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/65/465/2

diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h
index 074c258..957353b 100644
--- a/include/osmocom/gsm/protocol/gsm_04_08.h
+++ b/include/osmocom/gsm/protocol/gsm_04_08.h
@@ -5,7 +5,7 @@
 
 #include <osmocom/core/utils.h>
 #include <osmocom/core/endian.h>
-
+#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
 
 /* GSM TS 04.08  definitions */
 struct gsm_lchan;
@@ -946,6 +946,30 @@
 	return (hdr->proto_discr & 0xf0) >> 4;
 }
 
+/*! \brief Checks is particular message is cipherable in A/Gb mode according to
+ *         3GPP TS 24.008 § 4.7.1.2
+ *  \param[in] hdr Message header
+ *  \return true if message can be encrypted, false otherwise
+ */
+static inline bool gsm48_hdr_gmm_cipherable(const struct gsm48_hdr *hdr)
+{
+	switch(hdr->msg_type) {
+	case GSM48_MT_GMM_ATTACH_REQ:
+	case GSM48_MT_GMM_ATTACH_REJ:
+	case GSM48_MT_GMM_AUTH_CIPH_REQ:
+	case GSM48_MT_GMM_AUTH_CIPH_RESP:
+	case GSM48_MT_GMM_AUTH_CIPH_REJ:
+	case GSM48_MT_GMM_AUTH_CIPH_FAIL:
+	case GSM48_MT_GMM_ID_REQ:
+	case GSM48_MT_GMM_ID_RESP:
+	case GSM48_MT_GMM_RA_UPD_REQ:
+	case GSM48_MT_GMM_RA_UPD_REJ:
+		return false;
+	default:
+		return true;
+	}
+}
+
 static inline uint8_t gsm48_hdr_trans_id_flip_ti(const struct gsm48_hdr *hdr)
 {
 	return gsm48_hdr_trans_id(hdr) ^ 0x08;

-- 
To view, visit https://gerrit.osmocom.org/465
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I7ad0e03c2c738d174dd6bc3453f332eeb8da1e7d
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list