aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-11-30 02:57:33 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-11-30 22:46:15 +0100
commit8b6e536007815a0337fbae70917702c8e06b4bb5 (patch)
tree90e2d7cba504d7c60b29874e0ec17def5a20f823
parentdf6d2e3838f9f47e36541fdfa7b88c6fdb0c8e6f (diff)
move gsm_auth_tuple to vlr.h as vlr_auth_tuple
Along goes GSM_KEYSEQ_INVAL as VLR_*. It's where it logically belongs, and is almost the only reason why vlr.h includes gsm_data.h. The remaining reason, GSM_EXTENSION_LENGTH, will be moved by upcoming patch. Change-Id: I122feae7ee3cbc59e941daef35a954bce29fec76
-rw-r--r--include/osmocom/msc/gsm_data.h7
-rw-r--r--include/osmocom/msc/vlr.h14
-rw-r--r--src/libmsc/gsm_04_08.c6
-rw-r--r--src/libmsc/msc_vty.c2
-rw-r--r--src/libvlr/vlr.c4
-rw-r--r--src/libvlr/vlr_auth_fsm.c18
-rw-r--r--tests/msc_vlr/msc_vlr_tests.c2
7 files changed, 27 insertions, 26 deletions
diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index 3ffa100a2..30a3c795b 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -42,13 +42,6 @@ typedef int gsm_cbfn(unsigned int hooknum,
struct msgb *msg,
void *data, void *param);
-struct gsm_auth_tuple {
- int use_count;
- int key_seq;
- struct osmo_auth_vector vec;
-};
-#define GSM_KEY_SEQ_INVAL 7 /* GSM 04.08 - 10.5.1.2 */
-
enum {
MSC_CTR_LOC_UPDATE_TYPE_ATTACH,
MSC_CTR_LOC_UPDATE_TYPE_NORMAL,
diff --git a/include/osmocom/msc/vlr.h b/include/osmocom/msc/vlr.h
index 1168c3242..1865618b7 100644
--- a/include/osmocom/msc/vlr.h
+++ b/include/osmocom/msc/vlr.h
@@ -77,6 +77,14 @@ enum vlr_ciph_result_cause {
VLR_CIPH_COMPL,
};
+struct vlr_auth_tuple {
+ int use_count;
+ int key_seq;
+ struct osmo_auth_vector vec;
+};
+#define VLR_KEY_SEQ_INVAL 7 /* GSM 04.08 - 10.5.1.2 */
+
+
struct vlr_ciph_result {
enum vlr_ciph_result_cause cause;
char imeisv[GSM48_MI_SIZE];
@@ -122,8 +130,8 @@ struct vlr_subscr {
uint32_t age_indicator; /* 2.17.1 */
/* Authentication Data */
- struct gsm_auth_tuple auth_tuples[5]; /* 2.3.1-2.3.4 */
- struct gsm_auth_tuple *last_tuple;
+ struct vlr_auth_tuple auth_tuples[5]; /* 2.3.1-2.3.4 */
+ struct vlr_auth_tuple *last_tuple;
enum vlr_subscr_security_context sec_ctx;
/* Data local to VLR is below */
@@ -205,7 +213,7 @@ struct vlr_ops {
* \param[in] at auth tuple providing rand, key_seq and autn.
* \param[in] send_autn True to send AUTN, for r99 UMTS auth.
*/
- int (*tx_auth_req)(void *msc_conn_ref, struct gsm_auth_tuple *at,
+ int (*tx_auth_req)(void *msc_conn_ref, struct vlr_auth_tuple *at,
bool send_autn);
/* encode + transmit an AUTH REJECT towards the MS */
int (*tx_auth_rej)(void *msc_conn_ref);
diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index 38376d01b..29627602e 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -1514,7 +1514,7 @@ int gsm0408_dispatch(struct ran_conn *conn, struct msgb *msg)
***********************************************************************/
/* VLR asks us to send an authentication request */
-static int msc_vlr_tx_auth_req(void *msc_conn_ref, struct gsm_auth_tuple *at,
+static int msc_vlr_tx_auth_req(void *msc_conn_ref, struct vlr_auth_tuple *at,
bool send_autn)
{
struct ran_conn *conn = msc_conn_ref;
@@ -1600,7 +1600,7 @@ int ran_conn_geran_set_cipher_mode(struct ran_conn *conn, bool umts_aka, bool re
int i, j = 0;
int request_classmark = 0;
int request_classmark_for_a5_n = 0;
- struct gsm_auth_tuple *tuple = conn->vsub->last_tuple;
+ struct vlr_auth_tuple *tuple = conn->vsub->last_tuple;
if (!conn || !conn->vsub || !conn->vsub->last_tuple) {
/* This should really never happen, because we checked this in msc_vlr_set_ciph_mode()
@@ -1680,7 +1680,7 @@ int msc_vlr_set_ciph_mode(void *msc_conn_ref,
{
struct ran_conn *conn = msc_conn_ref;
struct vlr_subscr *vsub;
- struct gsm_auth_tuple *tuple;
+ struct vlr_auth_tuple *tuple;
if (!conn || !conn->vsub) {
LOGP(DMM, LOGL_ERROR, "Cannot send Ciphering Mode Command to"
diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index b63211734..aaefb0b7b 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -602,7 +602,7 @@ static void subscr_dump_full_vty(struct vty *vty, struct vlr_subscr *vsub)
#endif
if (vsub->last_tuple) {
- struct gsm_auth_tuple *t = vsub->last_tuple;
+ struct vlr_auth_tuple *t = vsub->last_tuple;
vty_out(vty, " A3A8 last tuple (used %d times):%s",
t->use_count, VTY_NEWLINE);
vty_out(vty, " seq # : %d%s",
diff --git a/src/libvlr/vlr.c b/src/libvlr/vlr.c
index 189cb6646..76c84dec4 100644
--- a/src/libvlr/vlr.c
+++ b/src/libvlr/vlr.c
@@ -242,7 +242,7 @@ static struct vlr_subscr *_vlr_subscr_alloc(struct vlr_instance *vlr)
vsub->tmsi_new = GSM_RESERVED_TMSI;
for (i = 0; i < ARRAY_SIZE(vsub->auth_tuples); i++)
- vsub->auth_tuples[i].key_seq = GSM_KEY_SEQ_INVAL;
+ vsub->auth_tuples[i].key_seq = VLR_KEY_SEQ_INVAL;
INIT_LLIST_HEAD(&vsub->cs.requests);
INIT_LLIST_HEAD(&vsub->ps.pdp_list);
@@ -661,7 +661,7 @@ void vlr_subscr_update_tuples(struct vlr_subscr *vsub,
if (gsup->num_auth_vectors) {
memset(&vsub->auth_tuples, 0, sizeof(vsub->auth_tuples));
for (i = 0; i < ARRAY_SIZE(vsub->auth_tuples); i++)
- vsub->auth_tuples[i].key_seq = GSM_KEY_SEQ_INVAL;
+ vsub->auth_tuples[i].key_seq = VLR_KEY_SEQ_INVAL;
}
got_tuples = 0;
diff --git a/src/libvlr/vlr_auth_fsm.c b/src/libvlr/vlr_auth_fsm.c
index d5a8555b7..84196965e 100644
--- a/src/libvlr/vlr_auth_fsm.c
+++ b/src/libvlr/vlr_auth_fsm.c
@@ -65,13 +65,13 @@ struct auth_fsm_priv {
* least used auth tuple without enforcing a maximum use count. If there are
* no auth tuples, return NULL.
*/
-static struct gsm_auth_tuple *
+static struct vlr_auth_tuple *
_vlr_subscr_next_auth_tuple(struct vlr_subscr *vsub, int max_reuse_count)
{
unsigned int count;
unsigned int idx;
- struct gsm_auth_tuple *at = NULL;
- unsigned int key_seq = GSM_KEY_SEQ_INVAL;
+ struct vlr_auth_tuple *at = NULL;
+ unsigned int key_seq = VLR_KEY_SEQ_INVAL;
if (!vsub)
return NULL;
@@ -79,7 +79,7 @@ _vlr_subscr_next_auth_tuple(struct vlr_subscr *vsub, int max_reuse_count)
if (vsub->last_tuple)
key_seq = vsub->last_tuple->key_seq;
- if (key_seq == GSM_KEY_SEQ_INVAL)
+ if (key_seq == VLR_KEY_SEQ_INVAL)
/* Start with 0 after increment modulo array size */
idx = ARRAY_SIZE(vsub->auth_tuples) - 1;
else
@@ -88,7 +88,7 @@ _vlr_subscr_next_auth_tuple(struct vlr_subscr *vsub, int max_reuse_count)
for (count = ARRAY_SIZE(vsub->auth_tuples); count > 0; count--) {
idx = (idx + 1) % ARRAY_SIZE(vsub->auth_tuples);
- if (vsub->auth_tuples[idx].key_seq == GSM_KEY_SEQ_INVAL)
+ if (vsub->auth_tuples[idx].key_seq == VLR_KEY_SEQ_INVAL)
continue;
if (!at || vsub->auth_tuples[idx].use_count < at->use_count)
@@ -102,10 +102,10 @@ _vlr_subscr_next_auth_tuple(struct vlr_subscr *vsub, int max_reuse_count)
}
/* Return an auth tuple and increment its use count. */
-static struct gsm_auth_tuple *
+static struct vlr_auth_tuple *
vlr_subscr_get_auth_tuple(struct vlr_subscr *vsub, int max_reuse_count)
{
- struct gsm_auth_tuple *at = _vlr_subscr_next_auth_tuple(vsub,
+ struct vlr_auth_tuple *at = _vlr_subscr_next_auth_tuple(vsub,
max_reuse_count);
if (!at)
return NULL;
@@ -124,7 +124,7 @@ static bool check_auth_resp(struct vlr_subscr *vsub, bool is_r99,
bool is_utran, const uint8_t *res,
uint8_t res_len)
{
- struct gsm_auth_tuple *at = vsub->last_tuple;
+ struct vlr_auth_tuple *at = vsub->last_tuple;
struct osmo_auth_vector *vec = &at->vec;
bool check_umts;
bool res_is_umts_aka;
@@ -263,7 +263,7 @@ static int _vlr_subscr_authenticate(struct osmo_fsm_inst *fi)
{
struct auth_fsm_priv *afp = fi->priv;
struct vlr_subscr *vsub = afp->vsub;
- struct gsm_auth_tuple *at;
+ struct vlr_auth_tuple *at;
bool use_umts_aka;
/* Caller ensures we have vectors available */
diff --git a/tests/msc_vlr/msc_vlr_tests.c b/tests/msc_vlr/msc_vlr_tests.c
index 2443e3107..29ffdbfd7 100644
--- a/tests/msc_vlr/msc_vlr_tests.c
+++ b/tests/msc_vlr/msc_vlr_tests.c
@@ -714,7 +714,7 @@ static int fake_vlr_tx_cm_serv_rej(void *msc_conn_ref, enum gsm48_reject_value c
return 0;
}
-static int fake_vlr_tx_auth_req(void *msc_conn_ref, struct gsm_auth_tuple *at,
+static int fake_vlr_tx_auth_req(void *msc_conn_ref, struct vlr_auth_tuple *at,
bool send_autn)
{
struct ran_conn *conn = msc_conn_ref;