[MERGED] libosmocore[master]: auth: add value_strings for osmo_sub_auth_type, comment on o...

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

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Oct 9 14:31:03 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: auth: add value_strings for osmo_sub_auth_type, comment on osmo_auth_alg_name()
......................................................................


auth: add value_strings for osmo_sub_auth_type, comment on osmo_auth_alg_name()

Add osmo_sub_auth_type_names[] and osmo_sub_auth_type_name().

Also add a hint to enum osmo_auth_algo's API doc that osmo_auth_alg_name()
already exists (it is defined further below).

Change-Id: I652a929bcd11c694d86812fb03d0a1cbd985efda
---
M include/osmocom/crypt/auth.h
M src/gsm/auth_core.c
M src/gsm/libosmogsm.map
3 files changed, 15 insertions(+), 1 deletion(-)

Approvals:
  Max: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved



diff --git a/include/osmocom/crypt/auth.h b/include/osmocom/crypt/auth.h
index 2f2a8d3..7064c99 100644
--- a/include/osmocom/crypt/auth.h
+++ b/include/osmocom/crypt/auth.h
@@ -7,6 +7,7 @@
 #include <stdint.h>
 
 #include <osmocom/core/linuxlist.h>
+#include <osmocom/core/utils.h>
 
 #define OSMO_A5_MAX_KEY_LEN_BYTES (128/8)
 
@@ -17,7 +18,12 @@
 	OSMO_AUTH_TYPE_UMTS	= 0x02,
 };
 
-/*! Authentication Algorithm */
+extern const struct value_string osmo_sub_auth_type_names[];
+static inline const char *osmo_sub_auth_type_name(enum osmo_sub_auth_type val)
+{ return get_value_string(osmo_sub_auth_type_names, val); }
+
+/*! Authentication Algorithm.
+ * See also osmo_auth_alg_name() and osmo_auth_alg_parse(). */
 enum osmo_auth_algo {
 	OSMO_AUTH_ALG_NONE,
 	OSMO_AUTH_ALG_COMP128v1,
diff --git a/src/gsm/auth_core.c b/src/gsm/auth_core.c
index 4156695..738e860 100644
--- a/src/gsm/auth_core.c
+++ b/src/gsm/auth_core.c
@@ -221,4 +221,11 @@
 	return get_string_value(auth_alg_vals, name);
 }
 
+const struct value_string osmo_sub_auth_type_names[] = {
+	{ OSMO_AUTH_TYPE_NONE, "None" },
+	{ OSMO_AUTH_TYPE_GSM, "GSM" },
+	{ OSMO_AUTH_TYPE_UMTS, "UMTS" },
+	{ 0, NULL }
+};
+
 /*! @} */
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 5598859..a72db52 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -339,6 +339,7 @@
 osmo_auth_load;
 osmo_auth_register;
 osmo_auth_supported;
+osmo_sub_auth_type_names;
 
 osmo_rsl2sitype;
 osmo_sitype2rsl;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I652a929bcd11c694d86812fb03d0a1cbd985efda
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list