mirror of https://github.com/arendst/Tasmota.git
Fix tls time with new NTP client
This commit is contained in:
parent
fa7fdbd51a
commit
a2b11520fe
|
@ -433,7 +433,9 @@
|
|||
*/
|
||||
|
||||
#ifndef BR_USE_UNIX_TIME
|
||||
#if defined __unix__ || defined __linux__ || defined ESP8266 || defined ESP32\
|
||||
/*#if defined __unix__ || defined __linux__ || defined ESP8266 || defined ESP32\*/
|
||||
// Tasmota now uses its own NTP client so we need to pass explicitly the current time
|
||||
#if defined __unix__ || defined __linux__ || defined ESP32\
|
||||
|| defined _POSIX_SOURCE || defined _POSIX_C_SOURCE \
|
||||
|| (defined __APPLE__ && defined __MACH__)
|
||||
#define BR_USE_UNIX_TIME 1
|
||||
|
|
|
@ -67,6 +67,9 @@ void _Log_heap_size(const char *msg) {
|
|||
#define LOG_HEAP_SIZE(a)
|
||||
#endif
|
||||
|
||||
// get UTC time from Tasmota
|
||||
extern uint32_t UtcTime(void);
|
||||
|
||||
// Stack thunked versions of calls
|
||||
// Initially in BearSSLHelpers.h
|
||||
extern "C" {
|
||||
|
@ -179,7 +182,6 @@ void WiFiClientSecure_light::_clear() {
|
|||
_eng = nullptr;
|
||||
_iobuf_in = nullptr;
|
||||
_iobuf_out = nullptr;
|
||||
_now = 0; // You can override or ensure time() is correct w/configTime
|
||||
setBufferSizes(1024, 1024); // reasonable minimum
|
||||
_handshake_done = false;
|
||||
_last_error = 0;
|
||||
|
@ -918,6 +920,8 @@ bool WiFiClientSecure_light::_connectSSL(const char* hostName) {
|
|||
br_x509_minimal_set_rsa(x509_minimal, br_ssl_engine_get_rsavrfy(_eng));
|
||||
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();
|
||||
br_x509_minimal_set_time(x509_minimal, now / 86400 + 719528, now % 86400);
|
||||
|
||||
#else
|
||||
x509_insecure = (br_x509_pubkeyfingerprint_context*) malloc(sizeof(br_x509_pubkeyfingerprint_context));
|
||||
|
|
|
@ -112,7 +112,6 @@ class WiFiClientSecure_light : public WiFiClient {
|
|||
br_ssl_engine_context *_eng; // &_sc->eng, to allow for client or server contexts
|
||||
std::shared_ptr<unsigned char> _iobuf_in;
|
||||
std::shared_ptr<unsigned char> _iobuf_out;
|
||||
time_t _now;
|
||||
int _iobuf_in_size;
|
||||
int _iobuf_out_size;
|
||||
bool _handshake_done;
|
||||
|
|
Loading…
Reference in New Issue