Skip to content

Commit

Permalink
Fixes for LibreSSL
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Jun 29, 2017
1 parent 589e72d commit 2093dc4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,7 @@ int cbtls_verify(int ok, X509_STORE_CTX *ctx)
char cn_str[1024];
char buf[64];
X509 *client_cert;
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
const STACK_OF(X509_EXTENSION) *ext_list;
#else
STACK_OF(X509_EXTENSION) *ext_list;
Expand Down Expand Up @@ -3041,13 +3041,15 @@ SSL_CTX *tls_init_ctx(fr_tls_server_conf_t *conf, int client)
SSL_CTX_set_verify_depth(ctx, conf->verify_depth);
}

#ifndef LIBRESSL_VERSION_NUMBER
/* Load randomness */
if (conf->random_file) {
if (!(RAND_load_file(conf->random_file, 1024*10))) {
tls_error_log(NULL, "Failed loading randomness");
return NULL;
}
}
#endif

/*
* Set the cipher list if we were told to
Expand Down Expand Up @@ -3169,6 +3171,7 @@ fr_tls_server_conf_t *tls_server_conf_parse(CONF_SECTION *cs)
* Only check for certificate things if we don't have a
* PSK query.
*/
#ifdef PSK_MAX_IDENTITY_LEN
if (conf->psk_identity) {
if (conf->private_key_file) {
WARN(LOG_PREFIX ": Ignoring private key file due to psk_identity being used");
Expand All @@ -3178,7 +3181,9 @@ fr_tls_server_conf_t *tls_server_conf_parse(CONF_SECTION *cs)
WARN(LOG_PREFIX ": Ignoring certificate file due to psk_identity being used");
}

} else {
} else
#endif
{
if (!conf->private_key_file) {
ERROR(LOG_PREFIX ": TLS Server requires a private key file");
goto error;
Expand Down

0 comments on commit 2093dc4

Please sign in to comment.