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
Fri Sep 17 06:01:59 UTC 2021


laforge has uploaded this change for review. ( 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 utils/Makefile.am
M utils/osmo-auc-gen.c
2 files changed, 29 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/95/25495/1

diff --git a/utils/Makefile.am b/utils/Makefile.am
index 3f2b13f..f8fe895 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -2,8 +2,8 @@
 bin_PROGRAMS =
 noinst_PROGRAMS =
 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(TALLOC_CFLAGS)
-AM_CFLAGS = -Wall $(PTHREAD_CFLAGS)
-LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la $(PTHREAD_LIBS)
+AM_CFLAGS = -Wall $(PTHREAD_CFLAGS) $(LIBGNUTLS_CFLAGS)
+LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la $(PTHREAD_LIBS) $(LIBGNUTLS_LIBS)
 
 if ENABLE_UTILITIES
 EXTRA_DIST = conv_gen.py conv_codes_gsm.py
diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c
index eb6c65b..f0c733e 100644
--- a/utils/osmo-auc-gen.c
+++ b/utils/osmo-auc-gen.c
@@ -36,6 +36,24 @@
 #include <osmocom/core/utils.h>
 #include <osmocom/gsm/gsm_utils.h>
 
+#include "../config.h"
+
+#ifdef USE_GNUTLS
+#include <gnutls/gnutls.h>
+static void print_base64(const char *fmt, const uint8_t *data, unsigned int len)
+{
+	gnutls_datum_t in, out;
+
+	in.data = (uint8_t *)data;
+	in.size = len;
+
+	gnutls_base64_encode2(&in, &out);
+
+	printf(fmt, out.data);
+	gnutls_free(out.data);
+}
+#endif /* USE_GNUTLS */
+
 static void dump_triplets_dat(struct osmo_auth_vector *vec)
 {
 	if (vec->auth_types & OSMO_AUTH_TYPE_UMTS) {
@@ -57,6 +75,15 @@
 		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));
+
+#ifdef USE_GNUTLS
+#include <gnutls/gnutls.h>
+		uint8_t inbuf[sizeof(vec->rand) + sizeof(vec->autn)];
+		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);
+#endif /* USE_GNUTLS */
 	}
 
 	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: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210917/466ce206/attachment.htm>


More information about the gerrit-log mailing list