File tree 2 files changed +9
-4
lines changed
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -229,8 +229,11 @@ void WebSocketsClient::loop(void) {
229
229
#else
230
230
#error setCACert not implemented
231
231
#endif
232
- #if defined(SSL_BARESSL)
233
- } else if (_fingerprint) {
232
+ #if defined(ESP32)
233
+ } else if (!SSL_FINGERPRINT_IS_SET) {
234
+ _client.ssl ->setInsecure ();
235
+ #elif defined(SSL_BARESSL)
236
+ } else if (SSL_FINGERPRINT_IS_SET) {
234
237
_client.ssl ->setFingerprint (_fingerprint);
235
238
} else {
236
239
_client.ssl ->setInsecure ();
@@ -865,14 +868,14 @@ void WebSocketsClient::connectedCb() {
865
868
866
869
#if defined(HAS_SSL)
867
870
#if defined(SSL_AXTLS) || defined(ESP32)
868
- if (_client.isSSL && _fingerprint. length () ) {
871
+ if (_client.isSSL && SSL_FINGERPRINT_IS_SET ) {
869
872
if (!_client.ssl ->verify (_fingerprint.c_str (), _host.c_str ())) {
870
873
DEBUG_WEBSOCKETS (" [WS-Client] certificate mismatch\n " );
871
874
WebSockets::clientDisconnect (&_client, 1000 );
872
875
return ;
873
876
}
874
877
#else
875
- if (_client.isSSL && _fingerprint ) {
878
+ if (_client.isSSL && SSL_FINGERPRINT_IS_SET ) {
876
879
#endif
877
880
} else if (_client.isSSL && !_CA_cert) {
878
881
#if defined(SSL_BARESSL)
Original file line number Diff line number Diff line change @@ -112,12 +112,14 @@ class WebSocketsClient : protected WebSockets {
112
112
#ifdef SSL_AXTLS
113
113
String _fingerprint;
114
114
const char * _CA_cert;
115
+ #define SSL_FINGERPRINT_IS_SET (_fingerprint.length())
115
116
#define SSL_FINGERPRINT_NULL " "
116
117
#else
117
118
const uint8_t * _fingerprint;
118
119
BearSSL::X509List * _CA_cert;
119
120
BearSSL::X509List * _client_cert;
120
121
BearSSL::PrivateKey * _client_key;
122
+ #define SSL_FINGERPRINT_IS_SET (_fingerprint != NULL )
121
123
#define SSL_FINGERPRINT_NULL NULL
122
124
#endif
123
125
You can’t perform that action at this time.
0 commit comments