summaryrefslogtreecommitdiff
path: root/lib/pkcs11_int.h
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-03-10 17:37:10 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-03-13 08:29:54 +0100
commit7332b6c2b9586d02a87a1950124a3b447f6aec22 (patch)
tree5f227bb14c61de2ff1a9012b24ea38ffc1daaabc /lib/pkcs11_int.h
parent8a3773782f59df8ac9ad6ff3758c330559e860ad (diff)
downloadgnutls-7332b6c2b9586d02a87a1950124a3b447f6aec22.tar.gz
pkcs11: re-open private key session inside a locked section
This prevents clashes when the same operation is carried in other threads. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'lib/pkcs11_int.h')
-rw-r--r--lib/pkcs11_int.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/pkcs11_int.h b/lib/pkcs11_int.h
index f012773e69..bcde4d8ce8 100644
--- a/lib/pkcs11_int.h
+++ b/lib/pkcs11_int.h
@@ -62,8 +62,10 @@ struct gnutls_pkcs11_obj_st {
};
/* This must be called on every function that uses a PKCS #11 function
- * directly */
-int _gnutls_pkcs11_check_init(void);
+ * directly. It can be provided a callback function to run when a reinitialization
+ * occurs. */
+typedef int (*pkcs11_reinit_function)(void *priv);
+int _gnutls_pkcs11_check_init(void *priv, pkcs11_reinit_function cb);
#define FIX_KEY_USAGE(pk, usage) \
if (usage == 0) { \
@@ -74,12 +76,12 @@ int _gnutls_pkcs11_check_init(void);
}
#define PKCS11_CHECK_INIT \
- ret = _gnutls_pkcs11_check_init(); \
+ ret = _gnutls_pkcs11_check_init(NULL, NULL); \
if (ret < 0) \
return gnutls_assert_val(ret)
#define PKCS11_CHECK_INIT_RET(x) \
- ret = _gnutls_pkcs11_check_init(); \
+ ret = _gnutls_pkcs11_check_init(NULL, NULL); \
if (ret < 0) \
return gnutls_assert_val(x)