Skip to content

Commit

Permalink
Merge pull request #988 from pennam/se050-sni-fix
Browse files Browse the repository at this point in the history
WiFiSSLSE050Client: fix sni setting 2nd part
  • Loading branch information
pennam authored Nov 7, 2024
2 parents 11c3c83 + 148b74c commit 0705aa1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions libraries/SE05X/src/WiFiSSLSE050Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ class MbedSSLSE050Client : public arduino::MbedSSLClient {
return 0;
}

if(_hostname && !_disableSNI) {
((TLSSocket*)sock)->set_hostname(_hostname);
}

if( NSAPI_ERROR_OK != ((TLSSocket*)sock)->append_root_ca_cert(_ca_cert_custom)) {
return 0;
}
Expand Down
6 changes: 5 additions & 1 deletion libraries/SocketWrapper/src/MbedSSLClient.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#include "MbedSSLClient.h"

arduino::MbedSSLClient::MbedSSLClient(): _disableSNI{false} {
arduino::MbedSSLClient::MbedSSLClient()
: _ca_cert_custom(nullptr),
_hostname(nullptr),
_disableSNI(false) {

onBeforeConnect(mbed::callback(this, &MbedSSLClient::setRootCA));
};
7 changes: 3 additions & 4 deletions libraries/SocketWrapper/src/MbedSSLClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ class MbedSSLClient : public arduino::MbedClient {
}

protected:
const char* _ca_cert_custom = NULL;
const char* _hostname = NULL;
const char* _ca_cert_custom;
const char* _hostname;
bool _disableSNI;

private:
int setRootCA() {
Expand Down Expand Up @@ -90,8 +91,6 @@ class MbedSSLClient : public arduino::MbedClient {
}
return err;
}

bool _disableSNI;
};

}
Expand Down

0 comments on commit 0705aa1

Please sign in to comment.