/*
* 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
+#define DH_BITS_MIN 1024
+
static gnutls_certificate_credentials_t x509_cred;
static gnutls_dh_params_t dh_params;
-
static bool ConnSSL_LoadServerKey_gnutls PARAMS(( void ));
#endif
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);
ConnSSL_Free(c);
return false;
}
- gnutls_dh_set_prime_bits(c->ssl_state.gnutls_session, DH_BITS);
+ gnutls_dh_set_prime_bits(c->ssl_state.gnutls_session, DH_BITS_MIN);
#endif
Conn_OPTION_ADD(c, CONN_SSL);
return true;
assert(ssl);
- Log(LOG_INFO, "New %s connection using cipher %s on socket %d.",
- SSL_get_version(ssl), SSL_get_cipher(ssl), c->sock);
+ Log(LOG_INFO, "Connection %d: initialized %s using cipher %s.",
+ c->sock, SSL_get_version(ssl), SSL_get_cipher(ssl));
#endif
#ifdef HAVE_LIBGNUTLS
gnutls_session_t sess = c->ssl_state.gnutls_session;
gnutls_cipher_algorithm_t cipher = gnutls_cipher_get(sess);
- Log(LOG_INFO, "New %s connection using cipher %s-%s on socket %d.",
+ Log(LOG_INFO, "Connection %d: initialized %s using cipher %s-%s.",
+ c->sock,
gnutls_protocol_get_name(gnutls_protocol_get_version(sess)),
gnutls_cipher_get_name(cipher),
- gnutls_mac_get_name(gnutls_mac_get(sess)), c->sock);
+ gnutls_mac_get_name(gnutls_mac_get(sess)));
#endif
}