File tree 2 files changed +8
-12
lines changed 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -24,15 +24,3 @@ void ArduinoBearSSLClass::onGetTime(unsigned long(*callback)(void))
24
24
}
25
25
26
26
ArduinoBearSSLClass ArduinoBearSSL;
27
-
28
- extern " C" {
29
- #include < sys/time.h>
30
-
31
- int _gettimeofday (struct timeval * tp, void * /* tzvp*/ )
32
- {
33
- tp->tv_sec = ArduinoBearSSL.getTime ();
34
- tp->tv_usec = 0 ;
35
-
36
- return 0 ;
37
- }
38
- }
Original file line number Diff line number Diff line change
1
+ #include " ArduinoBearSSL.h"
1
2
#include " BearSSLTrustAnchors.h"
2
3
3
4
#include " BearSSLClient.h"
@@ -161,6 +162,13 @@ int BearSSLClient::connectSSL(const char* host)
161
162
*/
162
163
br_ssl_client_reset (&_sc, host, 0 );
163
164
165
+ // get the current time and set it for X.509 validation
166
+ uint32_t now = ArduinoBearSSL.getTime ();
167
+ uint32_t days = now / 86400 + 719528 ;
168
+ uint32_t sec = now % 86400 ;
169
+
170
+ br_x509_minimal_set_time (&_xc, days, sec);
171
+
164
172
/*
165
173
* Initialise the simplified I/O wrapper context, to use our
166
174
* SSL client context, and the two callbacks for socket I/O.
You can’t perform that action at this time.
0 commit comments