Change in libosmocore[master]: osmo-auc-gen: Print RFC3310 IMS HTTP-AKA style base64 nonce/res

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

laforge gerrit-no-reply at lists.osmocom.org
Tue Sep 21 19:57:57 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/25495 )

Change subject: osmo-auc-gen: Print RFC3310 IMS HTTP-AKA style base64 nonce/res
......................................................................

osmo-auc-gen: Print RFC3310 IMS HTTP-AKA style base64 nonce/res

This is useful when debugging IMS Authentication which uses
RFC3310 representation of the nonce and expected result.

Change-Id: Ibfa72410d8ff8e5b42063f1a12bff69ad2bebbb8
---
M tests/osmo-auc-gen/osmo-auc-gen_test.ok
M utils/osmo-auc-gen.c
2 files changed, 50 insertions(+), 1 deletion(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.ok b/tests/osmo-auc-gen/osmo-auc-gen_test.ok
index 2840783..3c41f41 100644
--- a/tests/osmo-auc-gen/osmo-auc-gen_test.ok
+++ b/tests/osmo-auc-gen/osmo-auc-gen_test.ok
@@ -9,6 +9,8 @@
 IK:	6cf555588bb61ab2ff23cd333c05ed09
 CK:	f0b29f50a7d873f30336473bdc35d04f
 RES:	f511d3a7f06e6a30
+IMS nonce:	amEFB2XKoyyQNxNw5dbcLXkMXYDEewAAcWzgCIO8OeE=
+IMS res:	9RHTp/BuajA=
 SRES:	057fb997
 Kc:	60524000cc5e5407
 SQN:	0
@@ -24,6 +26,8 @@
 IK:	6cf555588bb61ab2ff23cd333c05ed09
 CK:	f0b29f50a7d873f30336473bdc35d04f
 RES:	f511d3a7f06e6a30
+IMS nonce:	amEFB2XKoyyQNxNw5dbcLXkMXYDEegAAWFCKs4ZOJqA=
+IMS res:	9RHTp/BuajA=
 SRES:	057fb997
 Kc:	60524000cc5e5407
 SQN:	1
@@ -39,6 +43,8 @@
 IK:	6cf555588bb61ab2ff23cd333c05ed09
 CK:	f0b29f50a7d873f30336473bdc35d04f
 RES:	f511d3a7f06e6a30
+IMS nonce:	amEFB2XKoyyQNxNw5dbcLXkMXYDEbAAA5015bsCV2+4=
+IMS res:	9RHTp/BuajA=
 SRES:	057fb997
 Kc:	60524000cc5e5407
 SQN:	23
@@ -54,6 +60,8 @@
 IK:	d7213dd74860ccb8c14e54c0c4abc91c
 CK:	c350653d72f7a5bac3a27422e5186019
 RES:	912cdfaadd7b0154
+IMS nonce:	HcT5dDJczmEeVPUW3B/sVkNKRqca6wAA/txWPyegkWw=
+IMS res:	kSzfqt17AVQ=
 SRES:	4c57defe
 Kc:	169d78081b24c007
 SQN:	42
@@ -69,6 +77,8 @@
 IK:	191a93c4396113bff6939d4f98e169a6
 CK:	9c38d9089265ed5ea164e190a65c200d
 RES:	fd40205be2c9c7b2
+IMS nonce:	KkgWL/PtykrfC3teUn1sFr+/MzLJHgAA1hmcrTHRXyY=
+IMS res:	/UAgW+LJx7I=
 SRES:	1f89e7e9
 Kc:	d2d5361395b9b74a
 SQN:	99
@@ -84,6 +94,8 @@
 IK:	c348c2fe2f3e1fb37a7ae1638163bd98
 CK:	e740c156278705a14e1a99ba6d31334f
 RES:	7c04e86a67967fcd
+IMS nonce:	amEFB2XKoyyQNxNw5dbcLa+5k+T0uAAAac3uu0pLW1g=
+IMS res:	fAToameWf80=
 SRES:	1b9297a7
 Kc:	10687b71e4eb94c5
 SQN:	281474976710655
@@ -99,6 +111,8 @@
 IK:	27497388b6cb044648f396aa155b95ef
 CK:	f64735036e5871319c679f4742a75ea1
 RES:	e229c19e791f2e41
+IMS nonce:	OfovTj1SPYYZpztPZcPhTYcE9bpV0wAAVB3ed+pbHYw=
+IMS res:	4inBnnkfLkE=
 SRES:	9b36efdf
 Kc:	059a4f668f6fbe39
 SQN:	32
@@ -115,6 +129,8 @@
 IK:	27497388b6cb044648f396aa155b95ef
 CK:	f64735036e5871319c679f4742a75ea1
 RES:	e229c19e791f2e41
+IMS nonce:	OfovTj1SPYYZpztPZcPhTYcE9bpV1gAAeSZ6SzR62JA=
+IMS res:	4inBnnkfLkE=
 SRES:	9b36efdf
 Kc:	059a4f668f6fbe39
 SQN:	37
@@ -131,6 +147,8 @@
 IK:	27497388b6cb044648f396aa155b95ef
 CK:	f64735036e5871319c679f4742a75ea1
 RES:	e229c19e791f2e41
+IMS nonce:	OfovTj1SPYYZpztPZcPhTYcE9bpVxAAAEp3apPUBbiU=
+IMS res:	4inBnnkfLkE=
 SRES:	9b36efdf
 Kc:	059a4f668f6fbe39
 SQN:	55
@@ -147,6 +165,8 @@
 IK:	27497388b6cb044648f396aa155b95ef
 CK:	f64735036e5871319c679f4742a75ea1
 RES:	e229c19e791f2e41
+IMS nonce:	OfovTj1SPYYZpztPZcPhTYcE9bpVzAAAnRafX/ifYIc=
+IMS res:	4inBnnkfLkE=
 SRES:	9b36efdf
 Kc:	059a4f668f6fbe39
 SQN:	63
@@ -163,6 +183,8 @@
 IK:	27497388b6cb044648f396aa155b95ef
 CK:	f64735036e5871319c679f4742a75ea1
 RES:	e229c19e791f2e41
+IMS nonce:	OfovTj1SPYYZpztPZcPhTYcE9bpV6wAA1/xPfxnPwYA=
+IMS res:	4inBnnkfLkE=
 SRES:	9b36efdf
 Kc:	059a4f668f6fbe39
 SQN:	24
@@ -179,6 +201,8 @@
 IK:	27497388b6cb044648f396aa155b95ef
 CK:	f64735036e5871319c679f4742a75ea1
 RES:	e229c19e791f2e41
+IMS nonce:	OfovTj1SPYYZpztPZcPhTYcE9bpV6wAA1/xPfxnPwYA=
+IMS res:	4inBnnkfLkE=
 SRES:	9b36efdf
 Kc:	059a4f668f6fbe39
 SQN:	24
@@ -195,6 +219,8 @@
 IK:	27497388b6cb044648f396aa155b95ef
 CK:	f64735036e5871319c679f4742a75ea1
 RES:	e229c19e791f2e41
+IMS nonce:	OfovTj1SPYYZpztPZcPhTYcE9bpV6gAAqrBt4/1sAa8=
+IMS res:	4inBnnkfLkE=
 SRES:	9b36efdf
 Kc:	059a4f668f6fbe39
 SQN:	25
@@ -211,6 +237,8 @@
 IK:	27497388b6cb044648f396aa155b95ef
 CK:	f64735036e5871319c679f4742a75ea1
 RES:	e229c19e791f2e41
+IMS nonce:	OfovTj1SPYYZpztPZcPhTYcE9bpU8wAAy7ovu6PF4kI=
+IMS res:	4inBnnkfLkE=
 SRES:	9b36efdf
 Kc:	059a4f668f6fbe39
 SQN:	256
@@ -227,6 +255,8 @@
 IK:	27497388b6cb044648f396aa155b95ef
 CK:	f64735036e5871319c679f4742a75ea1
 RES:	e229c19e791f2e41
+IMS nonce:	OfovTj1SPYYZpztPZcPhTYcE9bpU8gAAj44UV52l7Ls=
+IMS res:	4inBnnkfLkE=
 SRES:	9b36efdf
 Kc:	059a4f668f6fbe39
 SQN:	257
diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c
index eb6c65b..446d8ec 100644
--- a/utils/osmo-auc-gen.c
+++ b/utils/osmo-auc-gen.c
@@ -1,7 +1,7 @@
 /*! \file osmo-auc-gen.c
  * GSM/GPRS/3G authentication testing tool. */
 /*
- * (C) 2010-2012 by Harald Welte <laforge at gnumonks.org>
+ * (C) 2010-2021 by Harald Welte <laforge at gnumonks.org>
  *
  * All Rights Reserved
  *
@@ -34,8 +34,20 @@
 
 #include <osmocom/crypt/auth.h>
 #include <osmocom/core/utils.h>
+#include <osmocom/core/base64.h>
 #include <osmocom/gsm/gsm_utils.h>
 
+static void print_base64(const char *fmt, const uint8_t *data, unsigned int len)
+{
+	uint8_t outbuf[256];
+	size_t olen;
+
+	OSMO_ASSERT(osmo_base64_encode(outbuf, sizeof(outbuf), &olen, data, len) == 0);
+	OSMO_ASSERT(sizeof(outbuf) > olen);
+	outbuf[olen] = '\0';
+	printf(fmt, outbuf);
+}
+
 static void dump_triplets_dat(struct osmo_auth_vector *vec)
 {
 	if (vec->auth_types & OSMO_AUTH_TYPE_UMTS) {
@@ -53,10 +65,17 @@
 	printf("RAND:\t%s\n", osmo_hexdump_nospc(vec->rand, sizeof(vec->rand)));
 
 	if (vec->auth_types & OSMO_AUTH_TYPE_UMTS) {
+		uint8_t inbuf[sizeof(vec->rand) + sizeof(vec->autn)];
+
 		printf("AUTN:\t%s\n", osmo_hexdump_nospc(vec->autn, sizeof(vec->autn)));
 		printf("IK:\t%s\n", osmo_hexdump_nospc(vec->ik, sizeof(vec->ik)));
 		printf("CK:\t%s\n", osmo_hexdump_nospc(vec->ck, sizeof(vec->ck)));
 		printf("RES:\t%s\n", osmo_hexdump_nospc(vec->res, vec->res_len));
+
+		memcpy(inbuf, vec->rand, sizeof(vec->rand));
+		memcpy(inbuf + sizeof(vec->rand), vec->autn, sizeof(vec->autn));
+		print_base64("IMS nonce:\t%s\n", inbuf, sizeof(inbuf));
+		print_base64("IMS res:\t%s\n", vec->res, vec->res_len);
 	}
 
 	if (vec->auth_types & OSMO_AUTH_TYPE_GSM) {

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25495
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ibfa72410d8ff8e5b42063f1a12bff69ad2bebbb8
Gerrit-Change-Number: 25495
Gerrit-PatchSet: 6
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210921/8d6dc108/attachment.htm>


More information about the gerrit-log mailing list