-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Drop X509 context after successful server verification to save heap space #6065
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! We're in a release freeze, so this will get in right after.
Added the change for reporting not connected if TLS session is broken and there is no more buffered decrypted data. TLS can be broken if message authentication (MAC) cannot be verified. BearSSL enters BR_SSL_CLOSED state when processing invalid encrypted application data fragment. In such situation the current implementation get stuck forever unless user has own timeout mechanism build on top of WiFiClientSecureBearSSL. This change introduce fail fast via connected() returning false. Further it imply return -1 from read methods indicating broken channel upon which user should perform reconnect if needed. |
It seems that I cannot create another PR for the change in the same file unless previous change is merged. Hopefully, this second change can be included in this open PR. |
Yes, GH works on PRs per-branch, so you'd need to make a new branch off master for each separate PR. It's fine the way you've done it, we'll push them all at the same time. We'll adjust the title to reflect the two (or more) different updates. |
Thank you very much! |
Changes since 2.5.1 (to 2.5.2) Core ---- * Add explicit Print::write(char) (esp8266#6101) Build system ---- * Fix typo in elf2bin for QOUT binary generation (esp8266#6116) * Support PIO Wl-T and Arduino -T linking properly (esp8266#6095) * Allow *.cc files to be linked into flash by default (esp8266#6100) * Use custom "ElfToBin" builder for PIO (esp8266#6091) * Fail if generated JSON file cannot be read (esp8266#6076) * Moved 'Dropping' print from stdout to stderr in drop_versions.py (esp8266#6071) * Fix PIO issue when build environment contains spaces (esp8266#6119) Libraries ---- * Remove deadlock when server is not acking our data (esp8266#6107) * Bugfix for stuck in write method of WiFiClient and WiFiClientSecure until the remote peer closed connection (esp8266#6104) * Re-add original SD FAT info access methods (esp8266#6092) * Make FILE_WRITE append in SD.h wrapper (esp8266#6106) * Drop X509 after connection, avoid hang on TLS broken (esp8266#6065)
Changes since 2.5.1 (to 2.5.2) Core ---- * Add explicit Print::write(char) (#6101) Build system ---- * Fix typo in elf2bin for QOUT binary generation (#6116) * Support PIO Wl-T and Arduino -T linking properly (#6095) * Allow *.cc files to be linked into flash by default (#6100) * Use custom "ElfToBin" builder for PIO (#6091) * Fail if generated JSON file cannot be read (#6076) * Moved 'Dropping' print from stdout to stderr in drop_versions.py (#6071) * Fix PIO issue when build environment contains spaces (#6119) Libraries ---- * Remove deadlock when server is not acking our data (#6107) * Bugfix for stuck in write method of WiFiClient and WiFiClientSecure until the remote peer closed connection (#6104) * Re-add original SD FAT info access methods (#6092) * Make FILE_WRITE append in SD.h wrapper (#6106) * Drop X509 after connection, avoid hang on TLS broken (#6065)
Hi, I have this setup: Internet Router <=> WIFI AP <=> NodeMCU 12E The ESP8266 hangs in the last line of this debug output: or
i'm posting HTTPS and receiving data while the connection is broken. have no clue... :( Thanks for any help you can provide. |
Hi,
need to declare the global rcont as int
|
@mnunespt This hack is dangerous. ClientContext is used by WiFiClient, and your restart impacts long transfers (even those unrelated with SSL) because rcont is never reset. |
Yes you are right. rcont is reinitiated in the function:
It's not a elegant solution, but in my case, my specific sketch, it works very well. |
After completing handshake in BSSL, server is already verified and X509 context is no longer needed. Depending on verification method it save more or less heap space.
#6005