aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/msc/vlr.h
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-12-14 03:57:31 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2017-12-18 03:48:24 +0100
commitcf30913c8e2a43606edff751268dacc4886d7e4c (patch)
tree452645e3f8f39af3fc0f46ee1289b4fe3c211d96 /include/osmocom/msc/vlr.h
parent4cf4fddf287edb171939c5585db576be9addd474 (diff)
fix BSSMAP Cipher Mode Cmd: properly set permitted algorithms
The bit shifting is performed in gsm0808_enc_encrypt_info(), and must not be done when populating the gsm0808_encrypt_info struct. Provide vlr_ciph_to_gsm0808_alg_id() to translate the enum vlr_ciph to the GSM0808_* constants we need to put in the gsm0808_encrypt_info struct instead. Related: OS#2745 Change-Id: If75f95e8a5cc8b9979610ce6d746c1f0073ee39a
Diffstat (limited to 'include/osmocom/msc/vlr.h')
-rw-r--r--include/osmocom/msc/vlr.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/osmocom/msc/vlr.h b/include/osmocom/msc/vlr.h
index 9e6b12c33..640d35b46 100644
--- a/include/osmocom/msc/vlr.h
+++ b/include/osmocom/msc/vlr.h
@@ -7,6 +7,7 @@
#include <osmocom/gsm/protocol/gsm_23_003.h>
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
#include <osmocom/gsm/gsm23003.h>
+#include <osmocom/gsm/gsm0808.h>
#include <osmocom/msc/gsm_data.h>
// for GSM_NAME_LENGTH
#include <osmocom/msc/gsm_subscriber.h>
@@ -172,6 +173,21 @@ enum vlr_ciph {
VLR_CIPH_A5_3, /*< A5/3, 'new secure' encryption */
};
+static inline uint8_t vlr_ciph_to_gsm0808_alg_id(enum vlr_ciph ciph)
+{
+ switch (ciph) {
+ default:
+ case VLR_CIPH_NONE:
+ return GSM0808_ALG_ID_A5_0;
+ case VLR_CIPH_A5_1:
+ return GSM0808_ALG_ID_A5_1;
+ case VLR_CIPH_A5_2:
+ return GSM0808_ALG_ID_A5_2;
+ case VLR_CIPH_A5_3:
+ return GSM0808_ALG_ID_A5_3;
+ }
+}
+
struct vlr_ops {
/* encode + transmit an AUTH REQ towards the MS.
* \param[in] at auth tuple providing rand, key_seq and autn.