blob: 8946b06da23e90c138d46ab2f3ea111c3ad64ee9 [file] [log] [blame]
diff --git a/iot/mqtt-ciotc/Makefile b/iot/mqtt-ciotc/Makefile
index 7efc82c..ca1c4ad 100644
--- a/iot/mqtt-ciotc/Makefile
+++ b/iot/mqtt-ciotc/Makefile
@@ -1,6 +1,6 @@
OPENSSL_DIR ?= /usr/local/lib
CC=gcc # gcc || clang
-CCOPTIONS=-std=c11 -Werror -Wall -Wextra -pedantic -Wstrict-overflow -fno-strict-aliasing -fdiagnostics-show-option
+CCOPTIONS=-std=c11 -Werror -Wall -Wextra -pedantic -Wstrict-overflow -fno-strict-aliasing -fdiagnostics-show-option -lpthread
SSLPATH=-L$(OPENSSL_DIR)
all: mqtt_ciotc.c
diff --git a/iot/mqtt-ciotc/mqtt_ciotc.c b/iot/mqtt-ciotc/mqtt_ciotc.c
index 3b85866..4349791 100644
--- a/iot/mqtt-ciotc/mqtt_ciotc.c
+++ b/iot/mqtt-ciotc/mqtt_ciotc.c
@@ -25,6 +25,7 @@
#include "jwt.h"
#include "openssl/ec.h"
#include "openssl/evp.h"
+#include "openssl/conf.h"
// [END iot_mqtt_include]
#define TRACE 1 /* Set to 1 to enable tracing */
@@ -345,6 +346,11 @@ int Publish(char* payload, int payload_size) {
*/
// [START iot_mqtt_run]
int main(int argc, char* argv[]) {
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
+ OPENSSL_config(NULL);
+#else
+ OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);
+#endif
OpenSSL_add_all_algorithms();
OpenSSL_add_all_digests();
OpenSSL_add_all_ciphers();