summaryrefslogtreecommitdiff
path: root/src/core/wee-network.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2013-07-27 12:57:08 +0200
committerSebastien Helleu <flashcode@flashtux.org>2013-07-27 12:57:08 +0200
commita4901950324eb47ef5ce09264170281413d4218c (patch)
tree1a371c95401375c91d643e1f498f79d3354b3ba9 /src/core/wee-network.c
parent50ab62b75d50f28c90d9eea1f786d90aa20cdfe1 (diff)
downloadweechat-a4901950324eb47ef5ce09264170281413d4218c.zip
core: add secured data with optional encryption in file sec.conf
Diffstat (limited to 'src/core/wee-network.c')
-rw-r--r--src/core/wee-network.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/core/wee-network.c b/src/core/wee-network.c
index a15eea8b2..aa5ea105e 100644
--- a/src/core/wee-network.c
+++ b/src/core/wee-network.c
@@ -55,7 +55,7 @@
#include "../plugins/plugin.h"
-int network_init_ok = 0;
+int network_init_gnutls_ok = 0;
#ifdef HAVE_GNUTLS
gnutls_certificate_credentials_t gnutls_xcred; /* GnuTLS client credentials */
@@ -63,6 +63,21 @@ gnutls_certificate_credentials_t gnutls_xcred; /* GnuTLS client credentials */
/*
+ * Initializes gcrypt.
+ */
+
+void
+network_init_gcrypt ()
+{
+ if (!weechat_no_gcrypt)
+ {
+ gcry_check_version (GCRYPT_VERSION);
+ gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
+ gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
+ }
+}
+
+/*
* Sets trust file with option "gnutls_ca_file".
*/
@@ -91,11 +106,11 @@ network_set_gnutls_ca_file ()
}
/*
- * Initializes network.
+ * Initializes GnuTLS.
*/
void
-network_init ()
+network_init_gnutls ()
{
#ifdef HAVE_GNUTLS
if (!weechat_no_gnutls)
@@ -121,14 +136,7 @@ network_init ()
}
#endif /* HAVE_GNUTLS */
- if (!weechat_no_gcrypt)
- {
- gcry_check_version (GCRYPT_VERSION);
- gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
- gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
- }
-
- network_init_ok = 1;
+ network_init_gnutls_ok = 1;
}
/*
@@ -138,7 +146,7 @@ network_init ()
void
network_end ()
{
- if (network_init_ok)
+ if (network_init_gnutls_ok)
{
#ifdef HAVE_GNUTLS
if (!weechat_no_gnutls)
@@ -147,7 +155,7 @@ network_end ()
gnutls_global_deinit();
}
#endif
- network_init_ok = 0;
+ network_init_gnutls_ok = 0;
}
}