summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2017-03-28 18:36:52 +0200
committerHarald Welte <laforge@gnumonks.org>2017-04-08 07:44:46 +0000
commit14e76b9958b6cb93944a991ffaa5125f601f3d20 (patch)
tree2786a32ba58f56531d1ffb1e1b397bf08f753cd2 /include
parente0c65301d5786be04cf4731f1cdeed05c4442482 (diff)
gsm0808: Add utils for Encryption Information
The planned support for true A over IP requires the encoding of the an Encryption Information element (see also BSS_MAP_MSG_CIPHER_MODE_CMD). This commt adds encoding/decoding functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I8262050a9d9fd3f17462cfbb046c6e034dccc6fb
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/gsm/gsm0808_utils.h8
-rw-r--r--include/osmocom/gsm/protocol/gsm_08_08.h10
2 files changed, 18 insertions, 0 deletions
diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h
index 48e737d1..5bd27c76 100644
--- a/include/osmocom/gsm/gsm0808_utils.h
+++ b/include/osmocom/gsm/gsm0808_utils.h
@@ -55,3 +55,11 @@ uint8_t gsm0808_enc_channel_type(struct msgb *msg,
/* Decode Channel Type element */
int gsm0808_dec_channel_type(struct gsm0808_channel_type *ct,
const uint8_t *elem, uint8_t len);
+
+/* Encode Encryption Information element */
+uint8_t gsm0808_enc_encrypt_info(struct msgb *msg,
+ const struct gsm0808_encrypt_info *ei);
+
+/* Decode Encryption Information element */
+int gsm0808_dec_encrypt_info(struct gsm0808_encrypt_info *ei,
+ const uint8_t *elem, uint8_t len);
diff --git a/include/osmocom/gsm/protocol/gsm_08_08.h b/include/osmocom/gsm/protocol/gsm_08_08.h
index e2355f68..3939aedd 100644
--- a/include/osmocom/gsm/protocol/gsm_08_08.h
+++ b/include/osmocom/gsm/protocol/gsm_08_08.h
@@ -447,3 +447,13 @@ struct gsm0808_channel_type {
uint8_t perm_spch[CH_TYPE_PERM_SPCH_MAXLEN];
unsigned int perm_spch_len;
};
+
+/* 3GPP TS 48.008 3.2.2.10 Encryption Information */
+#define ENCRY_INFO_KEY_MAXLEN 252
+#define ENCRY_INFO_PERM_ALGO_MAXLEN 8
+struct gsm0808_encrypt_info {
+ uint8_t perm_algo[ENCRY_INFO_PERM_ALGO_MAXLEN];
+ unsigned int perm_algo_len;
+ uint8_t key[ENCRY_INFO_KEY_MAXLEN];
+ unsigned int key_len;
+};