Skip to content

Commit b464613

Browse files
committed
Disable server name identification when using IPAddress objects
1 parent 2c4714e commit b464613

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: src/ArduinoIoTCloudTCP.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ int ArduinoIoTCloudTCP::begin(ConnectionHandler & connection, uint16_t brokerPor
117117
if (!CryptoUtil::readDeviceId(ECCX08, getDeviceId(), ECCX08Slot::DeviceId)) { Debug.print(DBG_ERROR, "Cryptography processor read failure."); return 0; }
118118
if (!CryptoUtil::reconstructCertificate(_eccx08_cert, getDeviceId(), ECCX08Slot::Key, ECCX08Slot::CompressedCertificate, ECCX08Slot::SerialNumberAndAuthorityKeyIdentifier)) { Debug.print(DBG_ERROR, "Cryptography certificate reconstruction failure."); return 0; }
119119
ArduinoBearSSL.onGetTime(getTime);
120-
_sslClient = new BearSSLClient(_connection->getClient(), ArduinoIoTCloudTrustAnchor, ArduinoIoTCloudTrustAnchor_NUM);
120+
bool const noSNI = (_brokerIp != INADDR_NONE); /* Disable server name identification when using IPAddress objects */
121+
_sslClient = new BearSSLClient(_connection->getClient(), ArduinoIoTCloudTrustAnchor, ArduinoIoTCloudTrustAnchor_NUM, noSNI);
121122
_sslClient->setEccSlot(static_cast<int>(ECCX08Slot::Key), _eccx08_cert.bytes(), _eccx08_cert.length());
122123
#elif defined(BOARD_ESP)
123124
_sslClient = new WiFiClientSecure();

0 commit comments

Comments
 (0)