summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/cert-cred.c35
-rw-r--r--lib/includes/gnutls/x509.h4
-rw-r--r--lib/libgnutls.map2
-rw-r--r--lib/x509/verify-high.h2
4 files changed, 43 insertions, 0 deletions
diff --git a/lib/cert-cred.c b/lib/cert-cred.c
index a5b9493ab4..06a7054330 100644
--- a/lib/cert-cred.c
+++ b/lib/cert-cred.c
@@ -914,6 +914,41 @@ void gnutls_x509_trust_list_set_getissuer_function(gnutls_x509_trust_list_t tlis
tlist->issuer_callback = func;
}
+/**
+ * gnutls_x509_trust_list_set_ptr:
+ * @tlist: is a #gnutls_x509_trust_list_t type.
+ * @ptr: is the user pointer
+ *
+ * This function will set (associate) the user given pointer @ptr to
+ * the tlist structure. This pointer can be accessed with
+ * gnutls_x509_trust_list_get_ptr(). Useful in the callback function
+ * gnutls_x509_trust_list_set_getissuer_function.
+ *
+ * Since: 3.7.0
+ **/
+void gnutls_x509_trust_list_set_ptr(gnutls_x509_trust_list_t tlist, void *ptr)
+{
+ tlist->usr_ptr = ptr;
+}
+
+/**
+ * gnutls_x509_trust_list_get_ptr:
+ * @tlist: is a #gnutls_x509_trust_list_t type.
+ *
+ * Get user pointer for tlist. Useful in callback function
+ * gnutls_x509_trust_list_set_getissuer_function.
+ * This is the pointer set with gnutls_x509_trust_list_set_ptr().
+ *
+ * Returns: the user given pointer from the tlist structure, or
+ * %NULL if it was never set.
+ *
+ * Since: 3.7.0
+ **/
+void *gnutls_x509_trust_list_get_ptr(gnutls_x509_trust_list_t tlist)
+{
+ return tlist->usr_ptr;
+}
+
#define TEST_TEXT "test text"
/* returns error if the certificate has different algorithm than
* the given key parameters.
diff --git a/lib/includes/gnutls/x509.h b/lib/includes/gnutls/x509.h
index 444c9f0494..c0c509dc11 100644
--- a/lib/includes/gnutls/x509.h
+++ b/lib/includes/gnutls/x509.h
@@ -1704,6 +1704,10 @@ typedef int gnutls_x509_trust_list_getissuer_function(gnutls_x509_trust_list_t t
void gnutls_x509_trust_list_set_getissuer_function(gnutls_x509_trust_list_t tlist,
gnutls_x509_trust_list_getissuer_function *func);
+void gnutls_x509_trust_list_set_ptr(gnutls_x509_trust_list_t tlist, void *ptr);
+
+void *gnutls_x509_trust_list_get_ptr(gnutls_x509_trust_list_t tlist);
+
void gnutls_certificate_set_trust_list
(gnutls_certificate_credentials_t res,
gnutls_x509_trust_list_t tlist, unsigned flags);
diff --git a/lib/libgnutls.map b/lib/libgnutls.map
index e29f064a30..61276e5340 100644
--- a/lib/libgnutls.map
+++ b/lib/libgnutls.map
@@ -1335,6 +1335,8 @@ GNUTLS_3_7_0
{
global:
gnutls_x509_trust_list_set_getissuer_function;
+ gnutls_x509_trust_list_get_ptr;
+ gnutls_x509_trust_list_set_ptr;
local:
*;
} GNUTLS_3_4;
diff --git a/lib/x509/verify-high.h b/lib/x509/verify-high.h
index 6ce5f958ae..4cbb29a9c8 100644
--- a/lib/x509/verify-high.h
+++ b/lib/x509/verify-high.h
@@ -45,6 +45,8 @@ struct gnutls_x509_trust_list_st {
/* set this callback if the issuer in the certificate
* chain is missing. */
gnutls_x509_trust_list_getissuer_function *issuer_callback;
+ /* set user pointer. */
+ void *usr_ptr;
};
int _gnutls_trustlist_inlist(gnutls_x509_trust_list_t list,