[gnutls-devel] [PATCH 4/9] Add a function to obtain the trust list of a gnutls_certificate_credentials_t

Armin Burgmeier armin at arbur.net
Wed Sep 17 18:30:44 CEST 2014


Signed-off-by: Armin Burgmeier <armin at arbur.net>
---
 lib/gnutls_x509.c          | 18 ++++++++++++++++++
 lib/includes/gnutls/x509.h |  3 +++
 lib/libgnutls.map          |  1 +
 3 files changed, 22 insertions(+)

diff --git a/lib/gnutls_x509.c b/lib/gnutls_x509.c
index b102f4d..f57c6b9 100644
--- a/lib/gnutls_x509.c
+++ b/lib/gnutls_x509.c
@@ -1244,6 +1244,24 @@ gnutls_certificate_set_trust_list(gnutls_certificate_credentials_t res,
 	res->tlist = tlist;
 }
 
+/**
+ * gnutls_certificate_get_trust_list:
+ * @res: is a #gnutls_certificate_credentials_t structure.
+ * @tlist: Location where to store the trust list.
+ *
+ * Obtains the list of trusted certificates stored in @res and writes a
+ * pointer to it to the location @tlist. The pointer will point to memory
+ * internal to @res, and must not be deinitialized. It will be automatically
+ * deallocated when the @res structure is deinitialized.
+ *
+ * Since: 3.4.0
+ */
+void
+gnutls_certificate_get_trust_list(gnutls_certificate_credentials_t res,
+                                  gnutls_x509_trust_list_t *tlist)
+{
+	*tlist = res->tlist;
+}
 
 /**
  * gnutls_certificate_set_x509_key_file:
diff --git a/lib/includes/gnutls/x509.h b/lib/includes/gnutls/x509.h
index d86b0ef..fd02f0c 100644
--- a/lib/includes/gnutls/x509.h
+++ b/lib/includes/gnutls/x509.h
@@ -1354,6 +1354,9 @@ gnutls_x509_trust_list_add_system_trust(gnutls_x509_trust_list_t
 void gnutls_certificate_set_trust_list
     (gnutls_certificate_credentials_t res,
      gnutls_x509_trust_list_t tlist, unsigned flags);
+void gnutls_certificate_get_trust_list
+    (gnutls_certificate_credentials_t res,
+     gnutls_x509_trust_list_t *tlist);
 
 typedef struct gnutls_x509_ext_st {
 	char *oid;
diff --git a/lib/libgnutls.map b/lib/libgnutls.map
index f3a0582..b1121d0 100644
--- a/lib/libgnutls.map
+++ b/lib/libgnutls.map
@@ -899,6 +899,7 @@ GNUTLS_3_1_0 {
 	gnutls_alpn_set_protocols;
 	gnutls_session_set_id;
 	gnutls_certificate_set_trust_list;
+	gnutls_certificate_get_trust_list;
 	gnutls_cipher_get_tag_size;
 	gnutls_record_overhead_size;
 	gnutls_handshake_set_hook_function;
-- 
2.1.0




More information about the Gnutls-devel mailing list