No need to support versions that aren't supported by upstream.

This commit is contained in:
Roger A. Light 2019-04-11 11:13:58 +01:00
parent 77aaec686e
commit f041cb484a

View File

@ -527,10 +527,8 @@ static int net__init_ssl_ctx(struct mosquitto *mosq)
{ {
int ret; int ret;
ENGINE *engine = NULL; ENGINE *engine = NULL;
#if OPENSSL_VERSION_NUMBER >= 0x10002000L /* ALPN was added into OpenSSL 1.0.2 */
uint8_t tls_alpn_wire[256]; uint8_t tls_alpn_wire[256];
uint8_t tls_alpn_len; uint8_t tls_alpn_len;
#endif
if(mosq->ssl_ctx){ if(mosq->ssl_ctx){
if(!mosq->ssl_ctx_defaults){ if(!mosq->ssl_ctx_defaults){
@ -588,14 +586,10 @@ static int net__init_ssl_ctx(struct mosquitto *mosq)
/* Set ALPN */ /* Set ALPN */
if(mosq->tls_alpn) { if(mosq->tls_alpn) {
#if OPENSSL_VERSION_NUMBER >= 0x10002000L /* ALPN was added into OpenSSL 1.0.2 */
tls_alpn_len = (uint8_t) strnlen(mosq->tls_alpn, 254); tls_alpn_len = (uint8_t) strnlen(mosq->tls_alpn, 254);
tls_alpn_wire[0] = tls_alpn_len; // first byte is length of string tls_alpn_wire[0] = tls_alpn_len; // first byte is length of string
memcpy(tls_alpn_wire + 1, mosq->tls_alpn, tls_alpn_len); memcpy(tls_alpn_wire + 1, mosq->tls_alpn, tls_alpn_len);
SSL_CTX_set_alpn_protos(mosq->ssl_ctx, tls_alpn_wire, tls_alpn_len + 1); SSL_CTX_set_alpn_protos(mosq->ssl_ctx, tls_alpn_wire, tls_alpn_len + 1);
#else
log__printf(mosq, MOSQ_LOG_ERR, "Error: TLS ALPN not supported by version of OpenSSL.");
#endif
} }
#ifdef SSL_MODE_RELEASE_BUFFERS #ifdef SSL_MODE_RELEASE_BUFFERS