Skip to content

Crash/Panic after SSL Handshake fails #211

Closed
@bkgoodman

Description

@bkgoodman

This only happens under a kind of odd edge-case - I specified my own Root CA, Client Cert and Key, and under "normal" conditions (when I access my server) this works fine.

In the case of the crash - this occurred when I inadvertently connected to the www.howsmyssl.com server when using my own certs. When I tried this only specifying my Root CA, I got the appropriate error that the certificate verify mismatched/failed, and everything aborted normally. But when I had my client cert and key in as well, I got this guru meditation.

Crash, I assume at the line:

DEBUG_PRINT("Protocol is %s \nCiphersuite is %s\n", mbedtls_ssl_get_version(&ssl_client->ssl_ctx), mbedtls_ssl_get_ciphersuite(&ssl_client->ssl_ctx));

So, in other words - I believe once the handshake failed (as it should have) - maybe it should just have aborted, rather than to continue - which might have (as a result of the handshake failure) gotten back bad pointers from the mbedtls_ssl_get_ciphersuite and/or mbedtls_ssl_get_version calls?

(I could try a fix - if I new how to build it? First time with Arduino here...)

Starting connection to server...
Free heap before TLS 106160
Seeding the random number generator
Loading CA cert
Loading CRT cert
Loading private key
Setting up the SSL/TLS structure...
Performing the SSL/TLS handshake...
mbedtls_ssl_handshake returned -0x2700
Guru Meditation Error of type LoadProhibited occurred on core  1. Exception was unhandled.
Register dump:
PC      : 0x400014fd  PS      : 0x00060430  A0      : 0x800d861c  A1      : 0x3ffde0f0  
A2      : 0x00000000  A3      : 0xfffffffc  A4      : 0x000000ff  A5      : 0x0000ff00  
A6      : 0x00ff0000  A7      : 0xff000000  A8      : 0x00000000  A9      : 0x3ffde0a0  
A10     : 0x00000000  A11     : 0x3f4042df  A12     : 0x3ffde334  A13     : 0x3ffc8ff0  
A14     : 0x00000000  A15     : 0x00000001  SAR     : 0x00000016  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000000  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xffffffff  

Backtrace: 0x400014fd:0x3ffde0f0 0x400d861c:0x3ffde100 0x400d3008:0x3ffde410 0x400d1972:0x3ffde460 0x400d15aa:0x3ffde6b0 0x400d1608:0x3ffde6d0 0x400d13f3:0x3ffde700 0x4012934e:0x3ffde720

CPU halted.
0x400014fd: ?? ??:0
0x400d861c: _vfprintf_r at vfprintf.c:1529
0x400d3008: printf at printf.c:61
0x400d1972: start_ssl_client(sslclient_context*, unsigned int, unsigned int, unsigned char*, unsigned char*, unsigned char*) at ssl_client.cpp:230
0x400d15aa: WiFiClientSecure::connect(IPAddress, unsigned short, unsigned char*, unsigned char*, unsigned char*) at WiFiClientSecure.cpp:188
0x400d1608: WiFiClientSecure::connect(char const*, unsigned short, unsigned char*, unsigned char*, unsigned char*) at WiFiClientSecure.cpp:188
0x400d13f3: setup at BKGSecureWifi.ino:124
0x4012934e: loopTask(void*) at main.cpp:11 (discriminator 1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions