summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2022-01-11 07:34:59 +0100
committerDaiki Ueno <ueno@gnu.org>2022-01-16 17:58:33 +0100
commitd8931291f08c947667ab86e6804a5027fa706f4b (patch)
treebf997fbcfd47f43506693a73d24d4498647cf507
parentedd6d699e53b258dcf2f523286674bea1f532758 (diff)
downloadgnutls-d8931291f08c947667ab86e6804a5027fa706f4b.tar.gz
global: add API to retrieve library configuration at run time
Signed-off-by: Daiki Ueno <ueno@gnu.org>
-rw-r--r--devel/libgnutls.abignore3
-rw-r--r--devel/symbols.last1
-rw-r--r--doc/Makefile.am2
-rw-r--r--doc/manpages/Makefile.am1
-rw-r--r--lib/global.c38
-rw-r--r--lib/includes/gnutls/gnutls.h.in7
-rw-r--r--lib/libgnutls.map1
7 files changed, 53 insertions, 0 deletions
diff --git a/devel/libgnutls.abignore b/devel/libgnutls.abignore
index afa9168b79..8c7e7f2abe 100644
--- a/devel/libgnutls.abignore
+++ b/devel/libgnutls.abignore
@@ -123,3 +123,6 @@ name = gnutls_fips140_get_operation_state
[suppress_type]
name = gnutls_fips140_operation_state_t
+
+[suppress_function]
+name = gnutls_get_library_config
diff --git a/devel/symbols.last b/devel/symbols.last
index d10b12d3ed..7535696f83 100644
--- a/devel/symbols.last
+++ b/devel/symbols.last
@@ -258,6 +258,7 @@ gnutls_fips140_pop_context@GNUTLS_3_7_3
gnutls_fips140_push_context@GNUTLS_3_7_3
gnutls_fips140_set_mode@GNUTLS_3_6_3
gnutls_free@GNUTLS_3_4
+gnutls_get_library_config@GNUTLS_3_7_3
gnutls_get_system_config_file@GNUTLS_3_6_9
gnutls_global_deinit@GNUTLS_3_4
gnutls_global_init@GNUTLS_3_4
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 833c75ef6e..9d54110ac9 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1072,6 +1072,8 @@ FUNCS += functions/gnutls_fips140_push_context
FUNCS += functions/gnutls_fips140_push_context.short
FUNCS += functions/gnutls_fips140_set_mode
FUNCS += functions/gnutls_fips140_set_mode.short
+FUNCS += functions/gnutls_get_library_config
+FUNCS += functions/gnutls_get_library_config.short
FUNCS += functions/gnutls_get_system_config_file
FUNCS += functions/gnutls_get_system_config_file.short
FUNCS += functions/gnutls_global_deinit
diff --git a/doc/manpages/Makefile.am b/doc/manpages/Makefile.am
index 8e1e25d06e..2037bf91a9 100644
--- a/doc/manpages/Makefile.am
+++ b/doc/manpages/Makefile.am
@@ -376,6 +376,7 @@ APIMANS += gnutls_fips140_mode_enabled.3
APIMANS += gnutls_fips140_pop_context.3
APIMANS += gnutls_fips140_push_context.3
APIMANS += gnutls_fips140_set_mode.3
+APIMANS += gnutls_get_library_config.3
APIMANS += gnutls_get_system_config_file.3
APIMANS += gnutls_global_deinit.3
APIMANS += gnutls_global_init.3
diff --git a/lib/global.c b/lib/global.c
index 77039d9ded..8a84bb6e1f 100644
--- a/lib/global.c
+++ b/lib/global.c
@@ -531,3 +531,41 @@ static void _DESTRUCTOR lib_deinit(void)
_gnutls_global_deinit(1);
}
+
+static const struct gnutls_library_config_st _gnutls_library_config[] = {
+ { "libgnutls-soname", GNUTLS_LIBRARY_SONAME },
+ { "libnettle-soname", NETTLE_LIBRARY_SONAME },
+ { "libhogweed-soname", HOGWEED_LIBRARY_SONAME },
+ { "libgmp-soname", GMP_LIBRARY_SONAME },
+ { "hardware-features", HW_FEATURES },
+ { "tls-features", TLS_FEATURES },
+ { NULL, NULL }
+};
+
+/**
+ * gnutls_get_library_config:
+ *
+ * Returns the library configuration as key value pairs.
+ * Currently defined keys are:
+ *
+ * - libgnutls-soname: the SONAME of the library itself
+ *
+ * - libnettle-soname: the library SONAME of linked libnettle
+ *
+ * - libhogweed-soname: the library SONAME of linked libhogweed
+ *
+ * - libgmp-soname: the library SONAME of linked libgmp
+ *
+ * - hardware-features: enabled hardware support features
+ *
+ * - tls-features: enabled TLS protocol features
+ *
+ * Returns: a NUL-terminated %gnutls_library_config_st array
+ *
+ * Since: 3.7.3
+ */
+const gnutls_library_config_st *
+gnutls_get_library_config(void)
+{
+ return _gnutls_library_config;
+}
diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in
index 0e96be81e8..6359a0edb6 100644
--- a/lib/includes/gnutls/gnutls.h.in
+++ b/lib/includes/gnutls/gnutls.h.in
@@ -1232,6 +1232,11 @@ typedef struct {
unsigned int size;
} gnutls_datum_t;
+typedef struct gnutls_library_config_st {
+ const char *name;
+ const char *value;
+} gnutls_library_config_st;
+
typedef struct gnutls_params_st {
gnutls_params_type_t type;
@@ -2284,6 +2289,8 @@ int gnutls_certificate_set_rawpk_key_file(gnutls_certificate_credentials_t cred,
int gnutls_global_init(void);
void gnutls_global_deinit(void);
+const gnutls_library_config_st *gnutls_get_library_config(void);
+
/**
* gnutls_time_func:
* @t: where to store time.
diff --git a/lib/libgnutls.map b/lib/libgnutls.map
index 40a3984cbf..30e96abafe 100644
--- a/lib/libgnutls.map
+++ b/lib/libgnutls.map
@@ -1375,6 +1375,7 @@ GNUTLS_3_7_3
gnutls_fips140_get_operation_state;
gnutls_fips140_push_context;
gnutls_fips140_pop_context;
+ gnutls_get_library_config;
local:
*;
} GNUTLS_3_7_2;