summaryrefslogtreecommitdiff
path: root/lib/gnutls_global.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2013-12-05 11:10:28 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2013-12-05 11:10:28 +0100
commitbc1760ff606e52b87c16c87d936df9ebfc729a29 (patch)
treee95e379c903808d452633c1363bc0ee0e83c9fd2 /lib/gnutls_global.c
parentcebd8eb8a47b5edbdcfc6b71c3a0a648d1ef000b (diff)
downloadgnutls-bc1760ff606e52b87c16c87d936df9ebfc729a29.tar.gz
PKCS #11 initialization is delayed until first use.
Diffstat (limited to 'lib/gnutls_global.c')
-rw-r--r--lib/gnutls_global.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/gnutls_global.c b/lib/gnutls_global.c
index 5a4b2eea83..a74878f130 100644
--- a/lib/gnutls_global.c
+++ b/lib/gnutls_global.c
@@ -44,6 +44,7 @@
extern const ASN1_ARRAY_TYPE gnutls_asn1_tab[];
extern const ASN1_ARRAY_TYPE pkix_asn1_tab[];
void *_gnutls_file_mutex;
+void *_gnutls_pkcs11_mutex;
ASN1_TYPE _gnutls_pkix1_asn;
ASN1_TYPE _gnutls_gnutls_asn;
@@ -296,6 +297,12 @@ int gnutls_global_init2(unsigned int flags)
goto out;
}
+ ret = gnutls_mutex_init(&_gnutls_pkcs11_mutex);
+ if (ret < 0) {
+ gnutls_assert();
+ goto out;
+ }
+
ret = gnutls_system_global_init();
if (ret < 0) {
gnutls_assert();
@@ -406,6 +413,7 @@ void gnutls_global_deinit(void)
#endif
gnutls_mutex_deinit(&_gnutls_file_mutex);
+ gnutls_mutex_deinit(&_gnutls_pkcs11_mutex);
loaded_modules = 0;
} else {
if (_gnutls_init > 0)