summaryrefslogtreecommitdiff
path: root/src/global.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-11-17 17:02:56 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2014-11-17 20:19:49 +0100
commit7b85608728b38aafd66931ffdcff4e8979dfe3ec (patch)
tree1612c2118142adcbef2e71f27c1da18c4fd68271 /src/global.c
parent92e76f40e6239474e320feb42b1dbb9a1da9346e (diff)
downloadlibgit2-cmn/io-stream-backends.tar.gz
Tentative support for GnuTLScmn/io-stream-backends
Add GnuTLS support for the hashing functions as well as start work on a GnuTLS IO stream.
Diffstat (limited to 'src/global.c')
-rw-r--r--src/global.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/global.c b/src/global.c
index 006202a2c..9e35ef39c 100644
--- a/src/global.c
+++ b/src/global.c
@@ -25,6 +25,10 @@ static git_mutex *openssl_locks;
# endif
#endif
+#ifdef GIT_GNUTLS
+# include <gnutls/gnutls.h>
+#endif
+
static git_global_shutdown_fn git__shutdown_callbacks[MAX_SHUTDOWN_CB];
static git_atomic git__n_shutdown_callbacks;
static git_atomic git__n_inits;
@@ -276,6 +280,11 @@ static void init_once(void)
/* OpenSSL needs to be initialized from the main thread */
init_ssl();
+#ifdef GIT_GNUTLS
+ gnutls_global_init();
+ git__on_shutdown(gnutls_global_deinit);
+#endif
+
GIT_MEMORY_BARRIER;
}
@@ -336,6 +345,11 @@ int git_libgit2_init(void)
ssl_inited = 1;
}
+#ifdef GIT_GNUTLS
+ gnutls_global_init();
+ git__on_shutdown(gnutls_global_deinit);
+#endif
+
git_atomic_inc(&git__n_inits);
return 0;
}