Skip to content

Commit

Permalink
libressl build fixes.
Browse files Browse the repository at this point in the history
Closes #2198. Thanks to Theo Buehler.
  • Loading branch information
ralight committed Aug 24, 2021
1 parent 0d1837e commit 9b25dd3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.txt
Expand Up @@ -46,6 +46,9 @@ Clients:

Build:
- Fix installation using WITH_TLS=no. Closes #2281.
- Fix builds with libressl 3.4.0. Closes #2198.
- Remove some unnecessary code guards related to libressl.


2.0.11 - 2021-06-08
===================
Expand Down
4 changes: 2 additions & 2 deletions lib/options.c
Expand Up @@ -392,7 +392,7 @@ int mosquitto_opts_set(struct mosquitto *mosq, enum mosq_opt_t option, void *val
#ifdef WITH_TLS
mosq->ssl_ctx = (SSL_CTX *)value;
if(mosq->ssl_ctx){
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
SSL_CTX_up_ref(mosq->ssl_ctx);
#else
CRYPTO_add(&(mosq->ssl_ctx)->references, 1, CRYPTO_LOCK_SSL_CTX);
Expand Down Expand Up @@ -500,7 +500,7 @@ int mosquitto_void_option(struct mosquitto *mosq, enum mosq_opt_t option, void *
#ifdef WITH_TLS
mosq->ssl_ctx = (SSL_CTX *)value;
if(mosq->ssl_ctx){
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
SSL_CTX_up_ref(mosq->ssl_ctx);
#else
CRYPTO_add(&(mosq->ssl_ctx)->references, 1, CRYPTO_LOCK_SSL_CTX);
Expand Down
2 changes: 1 addition & 1 deletion src/conf.c
Expand Up @@ -1188,7 +1188,7 @@ static int config__read_file_core(struct mosquitto__config *config, bool reload,
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: TLS support not available.");
#endif
}else if(!strcmp(token, "ciphers_tls1.3")){
#if defined(WITH_TLS) && !defined(LIBRESSL_VERSION_NUMBER)
#if defined(WITH_TLS) && (!defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER > 0x3040000FL)
if(reload) continue; /* Listeners not valid for reloading. */
if(conf__parse_string(&token, "ciphers_tls1.3", &cur_listener->ciphers_tls13, saveptr)) return MOSQ_ERR_INVAL;
#else
Expand Down
2 changes: 1 addition & 1 deletion src/net.c
Expand Up @@ -404,7 +404,7 @@ int net__tls_server_ctx(struct mosquitto__listener *listener)
return MOSQ_ERR_TLS;
}
}
#if OPENSSL_VERSION_NUMBER >= 0x10101000 && !defined(LIBRESSL_VERSION_NUMBER)
#if OPENSSL_VERSION_NUMBER >= 0x10101000 && (!defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER > 0x3040000FL)
if(listener->ciphers_tls13){
rc = SSL_CTX_set_ciphersuites(listener->ssl_ctx, listener->ciphers_tls13);
if(rc == 0){
Expand Down

0 comments on commit 9b25dd3

Please sign in to comment.