2929#include " WiFiClientSecureBearSSL.h"
3030#include " WiFiNTP.h"
3131#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>
3737#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)
4440
4541// The BearSSL thunks in use for now
4642#define br_ssl_engine_recvapp_ack thunk_br_ssl_engine_recvapp_ack
5248#define br_ssl_engine_sendrec_ack thunk_br_ssl_engine_sendrec_ack
5349#define br_ssl_engine_sendrec_buf thunk_br_ssl_engine_sendrec_buf
5450
55- #endif
5651#endif
5752
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__)
6055#else
6156#define DEBUG_BSSL (...)
6257#endif
@@ -721,12 +716,12 @@ extern "C" {
721716 if (!xc->done_cert ) {
722717 br_sha1_update (&xc->sha1_cert , buf, len);
723718 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 )
725720 DEBUG_BSSL (" CERT: " );
726721 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 );
728723 }
729- DEBUG_ESP_PORT .printf_P (PSTR (" \n " ));
724+ DEBUG_RP2040_PORT .printf_P (PSTR (" \n " ));
730725#endif
731726 }
732727 }
@@ -750,7 +745,7 @@ extern "C" {
750745 char res[20 ];
751746 br_sha1_out (&xc->sha1_cert , res);
752747 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)
754749 DEBUG_BSSL (" insecure_end_chain: Received cert FP doesn't match\n " );
755750 char buff[3 * sizeof (res) + 1 ]; // 3 chars per byte XX_, and null
756751 buff[0 ] = 0 ;
@@ -1143,7 +1138,7 @@ bool WiFiClientSecureCtx::_connectSSL(const char* hostName) {
11431138 }
11441139 }
11451140
1146- #ifdef DEBUG_ESP_SSL
1141+ #if defined(DEBUG_RP2040_CORE) && defined(DEBUG_RP2040_PORT)
11471142 // BearSSL will reject all connections unless an authentication option is set, warn in DEBUG builds
11481143 if (!_use_insecure && !_use_fingerprint && !_use_self_signed && !_knownkey && !_certStore && !_ta) {
11491144 DEBUG_BSSL (" Connection *will* fail, no authentication method is setup\n " );
@@ -1213,7 +1208,7 @@ bool WiFiClientSecureCtx::_connectSSL(const char* hostName) {
12131208 }
12141209
12151210 auto ret = _wait_for_handshake ();
1216- #ifdef DEBUG_ESP_SSL
1211+ #if defined(DEBUG_RP2040_CORE) && defined(DEBUG_RP2040_PORT)
12171212 if (!ret) {
12181213 char err[256 ];
12191214 getLastSSLError (err, sizeof (err));
0 commit comments