summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/crypt/auth.h3
-rw-r--r--src/gsm/auth_core.c20
2 files changed, 23 insertions, 0 deletions
diff --git a/include/osmocom/crypt/auth.h b/include/osmocom/crypt/auth.h
index 12690f84..23e104c1 100644
--- a/include/osmocom/crypt/auth.h
+++ b/include/osmocom/crypt/auth.h
@@ -84,4 +84,7 @@ int osmo_auth_load(const char *path);
int osmo_auth_supported(enum osmo_auth_algo algo);
+const char *osmo_auth_alg_name(enum osmo_auth_algo alg);
+enum osmo_auth_algo osmo_auth_alg_parse(const char *name);
+
#endif /* _OSMOCRYPTO_AUTH_H */
diff --git a/src/gsm/auth_core.c b/src/gsm/auth_core.c
index c578df9d..c2a13a58 100644
--- a/src/gsm/auth_core.c
+++ b/src/gsm/auth_core.c
@@ -91,3 +91,23 @@ int osmo_auth_gen_vec_auts(struct osmo_auth_vector *vec,
return impl->gen_vec_auts(vec, aud, rand_auts, auts, _rand);
}
+
+const struct value_string auth_alg_vals[] = {
+ { OSMO_AUTH_ALG_NONE, "None" },
+ { OSMO_AUTH_ALG_COMP128v1, "COMP128v1" },
+ { OSMO_AUTH_ALG_COMP128v2, "COMP128v2" },
+ { OSMO_AUTH_ALG_COMP128v3, "COMP128v3" },
+ { OSMO_AUTH_ALG_XOR, "XOR" },
+ { OSMO_AUTH_ALG_MILENAGE, "MILENAGE" },
+ { 0, NULL }
+};
+
+const char *osmo_auth_alg_name(enum osmo_auth_algo alg)
+{
+ return get_value_string(auth_alg_vals, alg);
+}
+
+enum osmo_auth_algo osmo_auth_alg_parse(const char *name)
+{
+ return get_string_value(auth_alg_vals, name);
+}