Skip to content

Commit

Permalink
No need to support versions that aren't supported by upstream.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralight committed Apr 11, 2019
1 parent 77aaec6 commit f041cb4
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions lib/net_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,10 +527,8 @@ static int net__init_ssl_ctx(struct mosquitto *mosq)
{
int ret;
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_len;
#endif

if(mosq->ssl_ctx){
if(!mosq->ssl_ctx_defaults){
Expand Down Expand Up @@ -588,14 +586,10 @@ static int net__init_ssl_ctx(struct mosquitto *mosq)

/* Set 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_wire[0] = tls_alpn_len; // first byte is length of string
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);
#else
log__printf(mosq, MOSQ_LOG_ERR, "Error: TLS ALPN not supported by version of OpenSSL.");
#endif
}

#ifdef SSL_MODE_RELEASE_BUFFERS
Expand Down

0 comments on commit f041cb4

Please sign in to comment.