From d8931291f08c947667ab86e6804a5027fa706f4b Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Tue, 11 Jan 2022 07:34:59 +0100 Subject: global: add API to retrieve library configuration at run time Signed-off-by: Daiki Ueno --- lib/global.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'lib/global.c') 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; +} -- cgit v1.2.1 From 53bd182ef262be22ad4fc3bcba33a0ca64e7e6c3 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Tue, 11 Jan 2022 07:36:27 +0100 Subject: fips: add build option to embed FIPS module info in library config This adds a couple of configure options, --with-fips140-module-name and --with-fips140-module-version, which packagers can use to embed FIPS module information in the library. Signed-off-by: Daiki Ueno --- lib/global.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/global.c') diff --git a/lib/global.c b/lib/global.c index 8a84bb6e1f..65c0b81709 100644 --- a/lib/global.c +++ b/lib/global.c @@ -533,6 +533,12 @@ static void _DESTRUCTOR lib_deinit(void) } static const struct gnutls_library_config_st _gnutls_library_config[] = { +#ifdef FIPS_MODULE_NAME + { "fips-module-name", FIPS_MODULE_NAME }, +#endif +#ifdef FIPS_MODULE_VERSION + { "fips-module-version", FIPS_MODULE_VERSION }, +#endif { "libgnutls-soname", GNUTLS_LIBRARY_SONAME }, { "libnettle-soname", NETTLE_LIBRARY_SONAME }, { "libhogweed-soname", HOGWEED_LIBRARY_SONAME }, @@ -548,6 +554,10 @@ static const struct gnutls_library_config_st _gnutls_library_config[] = { * Returns the library configuration as key value pairs. * Currently defined keys are: * + * - fips-module-name: the name of the FIPS140 module + * + * - fips-module-version: the version of the FIPS140 module + * * - libgnutls-soname: the SONAME of the library itself * * - libnettle-soname: the library SONAME of linked libnettle -- cgit v1.2.1