mirror of https://github.com/arendst/Tasmota.git
Make TLS resilient to NTP failure
This commit is contained in:
parent
8f76f8197a
commit
32ea8e503d
|
@ -69,6 +69,7 @@ void _Log_heap_size(const char *msg) {
|
|||
|
||||
// get UTC time from Tasmota
|
||||
extern uint32_t UtcTime(void);
|
||||
extern uint32_t CfgTime(void);
|
||||
|
||||
// Stack thunked versions of calls
|
||||
// Initially in BearSSLHelpers.h
|
||||
|
@ -921,6 +922,8 @@ bool WiFiClientSecure_light::_connectSSL(const char* hostName) {
|
|||
br_x509_minimal_set_hash(x509_minimal, br_sha256_ID, &br_sha256_vtable);
|
||||
br_ssl_engine_set_x509(_eng, &x509_minimal->vtable);
|
||||
uint32_t now = UtcTime();
|
||||
uint32_t cfg_time = CfgTime();
|
||||
if (cfg_time > now) { now = cfg_time; }
|
||||
br_x509_minimal_set_time(x509_minimal, now / 86400 + 719528, now % 86400);
|
||||
|
||||
#else
|
||||
|
|
|
@ -613,6 +613,11 @@ void SettingsLoad(void) {
|
|||
RtcSettingsLoad();
|
||||
}
|
||||
|
||||
// Used in TLS - returns the timestamp of the last Flash settings write
|
||||
uint32_t CfgTime(void) {
|
||||
return Settings.cfg_timestamp;
|
||||
}
|
||||
|
||||
void EspErase(uint32_t start_sector, uint32_t end_sector)
|
||||
{
|
||||
bool serial_output = (LOG_LEVEL_DEBUG_MORE <= TasmotaGlobal.seriallog_level);
|
||||
|
|
Loading…
Reference in New Issue