]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
global: add API to retrieve library configuration at run time
authorDaiki Ueno <ueno@gnu.org>
Tue, 11 Jan 2022 06:34:59 +0000 (07:34 +0100)
committerDaiki Ueno <ueno@gnu.org>
Sun, 16 Jan 2022 16:58:33 +0000 (17:58 +0100)
Signed-off-by: Daiki Ueno <ueno@gnu.org>
devel/libgnutls.abignore
devel/symbols.last
doc/Makefile.am
doc/manpages/Makefile.am
lib/global.c
lib/includes/gnutls/gnutls.h.in
lib/libgnutls.map

index afa9168b792c900d0528b320b2e8e470e745a550..8c7e7f2abec0c82e211dc977ce4fdc260fd34c74 100644 (file)
@@ -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
index d10b12d3ed643239fbdc46a6d7251c8028d07aba..7535696f832c679775737d35ae29efafc5eb9aef 100644 (file)
@@ -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
index 833c75ef6e20f3d0a7bb753d60d12106e8eab1a9..9d54110ac9359ed96303b3661e580ceafadf5cf1 100644 (file)
@@ -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
index 8e1e25d06e1f7d8132df5e3353cd5cc0310a9d04..2037bf91a97dc03ec94ffcb610c376832e162109 100644 (file)
@@ -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
index 77039d9dedc072d64879223a775f1707b4ad6d3b..8a84bb6e1f170a75e176d0e835721214faccecec 100644 (file)
@@ -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;
+}
index 0e96be81e87e93d56fd4e3d0d7b790f8bf85bf44..6359a0edb6ff39eb1e57391eeab2a7357bc291d5 100644 (file)
@@ -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.
index 40a3984cbfd82bcd30ed39f72e79f87a38bf6c6f..30e96abafeb45e4629d15ac7b90f7d7b0ed421dc 100644 (file)
@@ -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;