aboutsummaryrefslogtreecommitdiffstats
path: root/src/gsm/gsup.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-06-06 13:47:07 +0200
committerHarald Welte <laforge@gnumonks.org>2016-06-16 21:25:18 +0000
commitdb78d2172b1d2ecdcbdc54d601a6477b101ebfbc (patch)
tree374d30de63524c15996c27738aa32ce6db26a678 /src/gsm/gsup.c
parentf624c33ef2e394949c10453b327e248aa27680e2 (diff)
gsup.c: Fix encoding of UMTS auth vectors
Encoding auth vectors worked fine for GSM authentication, but didn't yet include the new IEs for UMTS authentication yet. Change-Id: I7fa5ba1c950292bd0a9874b3102a27f221ce390d Reviewed-on: https://gerrit.osmocom.org/302 Reviewed-by: Harald Welte <laforge@gnumonks.org> Tested-by: Jenkins Builder
Diffstat (limited to 'src/gsm/gsup.c')
-rw-r--r--src/gsm/gsup.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index 3697958b..af3c409f 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -394,14 +394,30 @@ static void encode_auth_info(struct msgb *msg, enum osmo_gsup_iei iei,
len_field = msgb_tlv_put(msg, iei, 0, NULL) - 1;
old_len = msgb_length(msg);
- msgb_tlv_put(msg, OSMO_GSUP_RAND_IE,
- sizeof(auth_vector->rand), auth_vector->rand);
+ if (auth_vector->auth_types & OSMO_AUTH_TYPE_GSM) {
+ msgb_tlv_put(msg, OSMO_GSUP_RAND_IE,
+ sizeof(auth_vector->rand), auth_vector->rand);
- msgb_tlv_put(msg, OSMO_GSUP_SRES_IE,
- sizeof(auth_vector->sres), auth_vector->sres);
+ msgb_tlv_put(msg, OSMO_GSUP_SRES_IE,
+ sizeof(auth_vector->sres), auth_vector->sres);
- msgb_tlv_put(msg, OSMO_GSUP_KC_IE,
- sizeof(auth_vector->kc), auth_vector->kc);
+ msgb_tlv_put(msg, OSMO_GSUP_KC_IE,
+ sizeof(auth_vector->kc), auth_vector->kc);
+ }
+
+ if (auth_vector->auth_types & OSMO_AUTH_TYPE_UMTS) {
+ msgb_tlv_put(msg, OSMO_GSUP_IK_IE,
+ sizeof(auth_vector->ik), auth_vector->ik);
+
+ msgb_tlv_put(msg, OSMO_GSUP_CK_IE,
+ sizeof(auth_vector->ck), auth_vector->ck);
+
+ msgb_tlv_put(msg, OSMO_GSUP_AUTN_IE,
+ sizeof(auth_vector->autn), auth_vector->autn);
+
+ msgb_tlv_put(msg, OSMO_GSUP_RES_IE,
+ auth_vector->res_len, auth_vector->res);
+ }
/* Update length field */
*len_field = msgb_length(msg) - old_len;