Skip to content

Commit

Permalink
include a switch to disable elliptic curve support in the broker
Browse files Browse the repository at this point in the history
Change-Id: Ic874a92b79b32b4ebd2b8130fefe2b31fddd43b6
Signed-off-by: Bart Van Der Meerssche <[email protected]>
  • Loading branch information
Bart Van Der Meerssche committed Jul 3, 2014
1 parent fb7dd42 commit 59eb5a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ WITH_PYTHON:=yes
# Build with SRV lookup support.
WITH_SRV:=yes

# Use elliptic keys in broker
WITH_EC:=yes

# =============================================================================
# End of user configuration
# =============================================================================
Expand Down Expand Up @@ -211,6 +214,9 @@ ifeq ($(UNAME),SunOS)
LIB_LIBS:=$(LIB_LIBS) -lsocket -lnsl
endif

ifeq ($(WITH_EC),yes)
BROKER_CFLAGS:=$(BROKER_CFLAGS) -DWITH_EC
endif

INSTALL?=install
prefix=/usr/local
Expand Down
4 changes: 4 additions & 0 deletions src/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,11 @@ static int _mosquitto_tls_server_ctx(struct _mqtt3_listener *listener)
int ssl_options = 0;
char buf[256];
int rc;
#ifdef WITH_EC
#if OPENSSL_VERSION_NUMBER >= 0x10000000L && OPENSSL_VERSION_NUMBER < 0x10002000L
EC_KEY *ecdh = NULL;
#endif
#endif

#if OPENSSL_VERSION_NUMBER >= 0x10001000L
if(listener->tls_version == NULL){
Expand Down Expand Up @@ -295,6 +297,7 @@ static int _mosquitto_tls_server_ctx(struct _mqtt3_listener *listener)
SSL_CTX_set_mode(listener->ssl_ctx, SSL_MODE_RELEASE_BUFFERS);
#endif

#ifdef WITH_EC
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
SSL_CTX_set_ecdh_auto(listener->ssl_ctx, 1);
#elif OPENSSL_VERSION_NUMBER >= 0x10000000L && OPENSSL_VERSION_NUMBER < 0x10002000L
Expand All @@ -305,6 +308,7 @@ static int _mosquitto_tls_server_ctx(struct _mqtt3_listener *listener)
}
SSL_CTX_set_tmp_ecdh(listener->ssl_ctx, ecdh);
EC_KEY_free(ecdh);
#endif
#endif

snprintf(buf, 256, "mosquitto-%d", listener->port);
Expand Down

0 comments on commit 59eb5a6

Please sign in to comment.