/*
* ngIRCd -- The Next Generation IRC Daemon
- *
- * SSL wrapper functions.
* Copyright (c) 2005-2008 Florian Westphal <fw@strlen.de>
*/
#include "portab.h"
+
+/**
+ * @file
+ * SSL wrapper functions
+ */
+
#include "imp.h"
#include "conf-ssl.h"
#include <unistd.h>
#include <gnutls/x509.h>
-#define DH_BITS 1024
+#define DH_BITS 2048
static gnutls_certificate_credentials_t x509_cred;
static gnutls_dh_params_t dh_params;
int ret;
assert(c != NULL);
#ifdef HAVE_LIBSSL
- if (!ssl_ctx) /* NULL when library initialization failed */
+ if (!ssl_ctx) {
+ Log(LOG_ERR, "Cannot init ssl_ctx: OpenSSL initialization failed at startup");
return false;
-
+ }
assert(c->ssl_state.ssl == NULL);
c->ssl_state.ssl = SSL_new(ssl_ctx);
if (ret < 0) {
Log(LOG_ERR, "gnutls_set_default_priority: %s", gnutls_strerror(ret));
ConnSSL_Free(c);
+ return false;
}
/*
* The intermediate (long) cast is here to avoid a warning like:
if (ret < 0) {
Log(LOG_ERR, "gnutls_credentials_set: %s", gnutls_strerror(ret));
ConnSSL_Free(c);
+ return false;
}
gnutls_dh_set_prime_bits(c->ssl_state.gnutls_session, DH_BITS);
#endif