[PATCH] libosmocore[master]: gsup.c: Fix encoding of UMTS auth vectors

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Jun 16 21:15:28 UTC 2016


Review at  https://gerrit.osmocom.org/302

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
---
M src/gsm/gsup.c
1 file changed, 22 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/02/302/1

diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index 3697958..af3c409 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -394,14 +394,30 @@
 	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;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7fa5ba1c950292bd0a9874b3102a27f221ce390d
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list