-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mbedtls_ssl_free hangs #371
Comments
if I skip mbedtls_ssl_close_notify(&ssl_ctx) it crashes and occasionally give me a coredump: `================== CURRENT THREAD REGISTERS =================== ==================== CURRENT THREAD STACK ===================== idf/components/mbedtls/library/bignum.c:104 |
check return code of mbedtls_ssl_close_notify? |
mbedtls_ssl_close_notify ends with ESP_OK. mbedtls_ssl_free crashes while trying to release memory allocated during handshake at ssl_context.handshake->dhm_ctx.pX.p, I commented out everything between handshake and ssl_free, and it still crashes. Also tried with disabled hardware acceleration for mbedtls, no luck. |
rookie mistake - I've passed mbedtls_ssl_context by value instead of a pointer so handshake() modified a copy. |
Thanks for letting us know, glad you got this working correctly.
BTW, if passed by value instead of pointer in C then mbedtls_ssl_context will actually treat the first 4 bytes of the structure contents as the pointer. The first 4 bytes of mbedtls_ssl_context struct is a pointer to mbedtls_ssl_config, so the handshake would have treated the config structure as if it was the context and probably totally corrupted it. Yay memory unsafe languages? At least the compiler can warn for this particular one. |
I'm trying to rework 'https' example to use a client certificate and make a POST to AWS-Iot.
Request itself actually succeeds, but I'm unable to release ssl resources afterwards. mbedtls_ssl_free() hangs (or, rarely, crashes). I see similar effect with mbedtls_ssl_session_reset.
code available here (last line fails) [https://github.com/openairproject/sensor-esp32/blob/aws-iot/components/awsiot/awsiot_rest.c]
The text was updated successfully, but these errors were encountered: