- /**
- * Initialize SSL transport layer
- */
- SSL_library_init();
- SSL_load_error_strings();
- ssl_method = SSLv23_server_method();
- if (!(ssl_ctx = SSL_CTX_new(ssl_method))) {
- lprintf(3, "SSL_CTX_new failed: %s\n",
- ERR_reason_error_string(ERR_get_error()));
- return;
- }
-
- CRYPTO_set_locking_callback(ssl_lock);
- CRYPTO_set_id_callback(id_callback);
-
- /**
- * Get our certificates in order. \todo dirify. this is a setup job.
- * First, create the key/cert directory if it's not there already...
- */
- mkdir(CTDL_CRYPTO_DIR, 0700);
-
- /**
- * Before attempting to generate keys/certificates, first try
- * link to them from the Citadel server if it's on the same host.
- * We ignore any error return because it either meant that there
- * was nothing in Citadel to link from (in which case we just
- * generate new files) or the target files already exist (which
- * is not fatal either). \todo dirify
- */
- if (!strcasecmp(ctdlhost, "uds")) {
- sprintf(buf, "%s/keys/citadel.key", ctdlport);
- symlink(buf, CTDL_KEY_PATH);
- sprintf(buf, "%s/keys/citadel.csr", ctdlport);
- symlink(buf, CTDL_CSR_PATH);
- sprintf(buf, "%s/keys/citadel.cer", ctdlport);
- symlink(buf, CTDL_CER_PATH);
- }