Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jaykishanmutkawoa/c7dea04d9dbe9441168a822b84d67799 to your computer and use it in GitHub Desktop.
Save jaykishanmutkawoa/c7dea04d9dbe9441168a822b84d67799 to your computer and use it in GitHub Desktop.
tls1.3 for paho.mqtt.c
--- SSLSocket.c.orig 2018-03-18 01:35:55.748629591 -0400
+++ SSLSocket.c 2018-03-18 01:46:42.564598773 -0400
@@ -264,6 +264,9 @@ char* SSLSocket_get_version_string(int v
#if defined(TLS3_VERSION)
{ TLS3_VERSION, "TLS 1.2" },
#endif
+#if defined(TLS4_VERSION)
+ { TLS4_VERSION, "TLS 1.3" },
+#endif
};
for (i = 0; i < ARRAY_SIZE(version_string_table); ++i)
@@ -544,6 +547,11 @@ int SSLSocket_createContext(networkHandl
net->ctx = SSL_CTX_new(TLSv1_2_client_method());
break;
#endif
+#if defined(SSL_OP_NO_TLSv1_3) && !defined(OPENSSL_NO_TLS1)
+ case MQTT_SSL_VERSION_TLS_1_3:
+ net->ctx = SSL_CTX_new(TLSv1_3_client_method());
+ break;
+#endif
default:
break;
}
root@Nagios:~/paho
=================================================
root@Nagios:~/paho.mqtt.c/src# diff -uNp MQTTClient.h.orig MQTTClient.h
--- MQTTClient.h.orig 2018-03-18 01:48:32.214262816 -0400
+++ MQTTClient.h 2018-03-18 01:50:20.423428399 -0400
@@ -490,6 +490,7 @@ typedef struct
#define MQTT_SSL_VERSION_TLS_1_0 1
#define MQTT_SSL_VERSION_TLS_1_1 2
#define MQTT_SSL_VERSION_TLS_1_2 3
+#define MQTT_SSL_VERSION_TLS_1_3 4
/**
* MQTTClient_sslProperties defines the settings to establish an SSL/TLS connection using the
===========================================================
root@Nagios:~/paho.mqtt.c/src# diff -uNp MQTTAsync.h.orig MQTTAsync.h
--- MQTTAsync.h.orig 2018-03-18 01:51:46.853886166 -0400
+++ MQTTAsync.h 2018-03-18 01:52:38.083379287 -0400
@@ -644,6 +644,7 @@ typedef struct
#define MQTT_SSL_VERSION_TLS_1_0 1
#define MQTT_SSL_VERSION_TLS_1_1 2
#define MQTT_SSL_VERSION_TLS_1_2 3
+#define MQTT_SSL_VERSION_TLS_1_3 4
/**
* MQTTAsync_sslProperties defines the settings to establish an SSL/TLS connection using the
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment