29
29
#include " WiFiClientSecureBearSSL.h"
30
30
#include " WiFiNTP.h"
31
31
#include " StackThunk.h"
32
- #include " lwip/opt.h"
33
- #include " lwip/ip.h"
34
- #include " lwip/tcp.h"
35
- #include " lwip/inet.h"
36
- #include " lwip/netif.h"
32
+ #include < lwip/opt.h>
33
+ #include < lwip/ip.h>
34
+ #include < lwip/tcp.h>
35
+ #include < lwip/inet.h>
36
+ #include < lwip/netif.h>
37
37
#include < include/ClientContext.h>
38
- // #include "c_types.h"
39
- // #include <mmu_iram.h>
40
- // #include <umm_malloc/umm_malloc.h>
41
- // #include <umm_malloc/umm_heap_select.h>
42
- #if 1
43
- #if !CORE_MOCK
38
+
39
+ #if !defined(CORE_MOCK)
44
40
45
41
// The BearSSL thunks in use for now
46
42
#define br_ssl_engine_recvapp_ack thunk_br_ssl_engine_recvapp_ack
52
48
#define br_ssl_engine_sendrec_ack thunk_br_ssl_engine_sendrec_ack
53
49
#define br_ssl_engine_sendrec_buf thunk_br_ssl_engine_sendrec_buf
54
50
55
- #endif
56
51
#endif
57
52
58
- #if defined(DEBUG_ESP_SSL ) && defined(DEBUG_ESP_PORT )
59
- #define DEBUG_BSSL (fmt, ...) DEBUG_ESP_PORT .printf_P((PGM_P)PSTR( " BSSL:" fmt), ## __VA_ARGS__)
53
+ #if defined(DEBUG_RP2040_CORE ) && defined(DEBUG_RP2040_PORT )
54
+ #define DEBUG_BSSL (fmt, ...) DEBUG_RP2040_PORT .printf_P((PGM_P)PSTR( " BSSL:" fmt), ## __VA_ARGS__)
60
55
#else
61
56
#define DEBUG_BSSL (...)
62
57
#endif
@@ -721,12 +716,12 @@ extern "C" {
721
716
if (!xc->done_cert ) {
722
717
br_sha1_update (&xc->sha1_cert , buf, len);
723
718
br_x509_decoder_push (&xc->ctx , (const void *)buf, len);
724
- #if defined(DEBUG_ESP_SSL ) && defined(DEBUG_ESP_PORT )
719
+ #if defined(DEBUG_RP2040_CORE ) && defined(DEBUG_RP2040_PORT )
725
720
DEBUG_BSSL (" CERT: " );
726
721
for (size_t i = 0 ; i < len; i++) {
727
- DEBUG_ESP_PORT .printf_P (PSTR (" %02x " ), buf[i] & 0xff );
722
+ DEBUG_RP2040_PORT .printf_P (PSTR (" %02x " ), buf[i] & 0xff );
728
723
}
729
- DEBUG_ESP_PORT .printf_P (PSTR (" \n " ));
724
+ DEBUG_RP2040_PORT .printf_P (PSTR (" \n " ));
730
725
#endif
731
726
}
732
727
}
@@ -750,7 +745,7 @@ extern "C" {
750
745
char res[20 ];
751
746
br_sha1_out (&xc->sha1_cert , res);
752
747
if (xc->match_fingerprint && memcmp (res, xc->match_fingerprint , sizeof (res))) {
753
- #ifdef DEBUG_ESP_SSL
748
+ #if defined(DEBUG_RP2040_CORE) && defined(DEBUG_RP2040_PORT)
754
749
DEBUG_BSSL (" insecure_end_chain: Received cert FP doesn't match\n " );
755
750
char buff[3 * sizeof (res) + 1 ]; // 3 chars per byte XX_, and null
756
751
buff[0 ] = 0 ;
@@ -1143,7 +1138,7 @@ bool WiFiClientSecureCtx::_connectSSL(const char* hostName) {
1143
1138
}
1144
1139
}
1145
1140
1146
- #ifdef DEBUG_ESP_SSL
1141
+ #if defined(DEBUG_RP2040_CORE) && defined(DEBUG_RP2040_PORT)
1147
1142
// BearSSL will reject all connections unless an authentication option is set, warn in DEBUG builds
1148
1143
if (!_use_insecure && !_use_fingerprint && !_use_self_signed && !_knownkey && !_certStore && !_ta) {
1149
1144
DEBUG_BSSL (" Connection *will* fail, no authentication method is setup\n " );
@@ -1213,7 +1208,7 @@ bool WiFiClientSecureCtx::_connectSSL(const char* hostName) {
1213
1208
}
1214
1209
1215
1210
auto ret = _wait_for_handshake ();
1216
- #ifdef DEBUG_ESP_SSL
1211
+ #if defined(DEBUG_RP2040_CORE) && defined(DEBUG_RP2040_PORT)
1217
1212
if (!ret) {
1218
1213
char err[256 ];
1219
1214
getLastSSLError (err, sizeof (err));
0 commit comments