Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,13 @@ extern "C" {
if (!xc->done_cert) {
br_sha1_update(&xc->sha1_cert, buf, len);
br_x509_decoder_push(&xc->ctx, (const void*)buf, len);
#ifdef DEBUG_ESP_SSL
DEBUG_BSSL("CERT: ");
for (size_t i=0; i<len; i++) {
DEBUG_ESP_PORT.printf_P(PSTR("%02x "), buf[i] & 0xff);
}
DEBUG_ESP_PORT.printf_P(PSTR("\n"));
#endif
}
}

Expand All @@ -676,7 +683,24 @@ extern "C" {
char res[20];
br_sha1_out(&xc->sha1_cert, res);
if (xc->match_fingerprint && memcmp(res, xc->match_fingerprint, sizeof(res))) {
#ifdef DEBUG_ESP_SSL
DEBUG_BSSL("insecure_end_chain: Received cert FP doesn't match\n");
char buff[3 * sizeof(res) + 5];
buff[0] = 0;
for (size_t i=0; i<sizeof(res); i++) {
char hex[6];
sprintf(hex, "%02x ", xc->match_fingerprint[i] & 0xff);
strcat(buff, hex);
}
DEBUG_BSSL("insecure_end_chain: wanted %s\n", buff);
buff[0] =0;
for (size_t i=0; i<sizeof(res); i++) {
char hex[6];
sprintf(hex, "%02x ", res[i] & 0xff);
strcat(buff, hex);
}
DEBUG_BSSL("insecure_end_chain: received %s\n", buff);
#endif
return BR_ERR_X509_NOT_TRUSTED;
}

Expand Down