Skip to content

Commit 70c24a4

Browse files
authored
Merge pull request #105 from arduino/bearssl-fixes
Bearssl Client fixes
2 parents 7a552ca + 24b5719 commit 70c24a4

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

arduino/libraries/ArduinoBearSSL/src/BearSSLClient.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,6 @@ int BearSSLClient::connectSSL(const char* host)
274274
// inject entropy in engine
275275
unsigned char entropy[32];
276276

277-
if (ECCX08.begin() && ECCX08.locked() && ECCX08.random(entropy, sizeof(entropy))) {
278-
ESP_LOGI("BearSSLClient::connectSSL", "init");
279-
}
280-
281277
if (ECCX08.begin() && ECCX08.locked() && ECCX08.random(entropy, sizeof(entropy))) {
282278
// ECC508 random success, add custom ECDSA vfry and EC sign
283279
br_ssl_engine_set_ecdsa(&_sc.eng, eccX08_vrfy_asn1);
@@ -320,6 +316,7 @@ int BearSSLClient::connectSSL(const char* host)
320316
} else if (state & BR_SSL_CLOSED) {
321317
return 0;
322318
}
319+
delay(1);
323320
}
324321

325322
return 1;

arduino/libraries/ArduinoECCX08/src/ECCX08.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,12 @@ int ECCX08Class::random(byte data[], size_t length)
143143
return 0;
144144
}
145145

146+
147+
#if defined (ESP_PLATFORM)
148+
delay(50);
149+
#else
146150
delay(23);
151+
#endif
147152

148153
byte response[32];
149154

main/sketch.ino.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,7 @@ void setupBluetooth() {
152152
}
153153

154154
unsigned long getTime() {
155-
int ret = 0;
156-
do {
157-
ret = WiFi.getTime();
158-
} while (ret == 0);
159-
return ret;
155+
return time(nullptr);
160156
}
161157

162158
void setupWiFi() {

0 commit comments

Comments
 (0)