*/
/*@{*/
-#include "config.h"
+#include "sysdep.h"
#ifdef HAVE_OPENSSL
#include "webcit.h"
/** \todo dirify */
/** where to find the keys */
#define CTDL_CRYPTO_DIR "./keys"
-#define CTDL_KEY_PATH CTDL_CRYPTO_DIR "/citadel.key" /**< the key */
-#define CTDL_CSR_PATH CTDL_CRYPTO_DIR "/citadel.csr" /**< the csr file */
-#define CTDL_CER_PATH CTDL_CRYPTO_DIR "/citadel.cer" /**< the cer file */
+#define CTDL_KEY_PATH file_crpt_file_key /**< the key */
+#define CTDL_CSR_PATH file_crpt_file_csr /**< the csr file */
+#define CTDL_CER_PATH file_crpt_file_cer /**< the cer file */
#define SIGN_DAYS 365 /**< how long our certificate should live */
SSL_CTX *ssl_ctx; /**< SSL context */
}
}
- /**
- * Generate a CSR if we don't have one.
+ /*
+ * If there is no certificate file on disk, we will be generating a self-signed certificate
+ * in the next step. Therefore, if we have neither a CSR nor a certificate, generate
+ * the CSR in this step so that the next step may commence.
*/
- if (access(CTDL_CSR_PATH, R_OK) != 0) {
+ if ( (access(CTDL_CER_PATH, R_OK) != 0) && (access(CTDL_CSR_PATH, R_OK) != 0) ) {
lprintf(5, "Generating a certificate signing request.\n");
/**
return(4);
}
BIO_set_close(newssl->rbio, BIO_NOCLOSE);
- bits =
- SSL_CIPHER_get_bits(SSL_get_current_cipher(newssl),
- &alg_bits);
+ bits = SSL_CIPHER_get_bits(SSL_get_current_cipher(newssl), &alg_bits);
lprintf(5, "SSL/TLS using %s on %s (%d of %d bits)\n",
SSL_CIPHER_get_name(SSL_get_current_cipher(newssl)),
SSL_CIPHER_get_version(SSL_get_current_cipher(newssl)),