-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
espconn_secure/tls: eliminate funky flash game #3032
Comments
Split out espconn_mbedtls_parse, which we can use as part of our effort towards addressing nodemcu#3032
The new feature part of nodemcu#3032 Subsequent work will remove the old mechanism.
Split out espconn_mbedtls_parse, which we can use as part of our effort towards addressing nodemcu#3032
The new feature part of nodemcu#3032 Subsequent work will remove the old mechanism.
Split out espconn_mbedtls_parse, which we can use as part of our effort towards addressing nodemcu#3032
The new feature part of nodemcu#3032 Subsequent work will remove the old mechanism.
Split out espconn_mbedtls_parse, which we can use as part of our effort towards addressing nodemcu#3032
The new feature part of nodemcu#3032 Subsequent work will remove the old mechanism.
Split out espconn_mbedtls_parse, which we can use as part of our effort towards addressing nodemcu#3032
The new feature part of nodemcu#3032 Subsequent work will remove the old mechanism.
Split out espconn_mbedtls_parse, which we can use as part of our effort towards addressing nodemcu#3032
The new feature part of nodemcu#3032 Subsequent work will remove the old mechanism.
The new feature part of nodemcu#3032 Subsequent work will remove the old mechanism.
The new feature part of nodemcu#3032 Subsequent work will remove the old mechanism.
The new feature part of nodemcu#3032 Subsequent work will remove the old mechanism.
Split out espconn_mbedtls_parse, which we can use as part of our effort towards addressing nodemcu#3032
The new feature part of nodemcu#3032 Subsequent work will remove the old mechanism.
* espconn: remove unused espconn code, take 1 This is the easiest part of #3004 . It removes a bunch of functions that were never called in our tree. * espconn: De-orbit espconn_gethostbyname Further work on #3004 While here, remove `mqtt`'s charming DNS-retry logic (which is neither shared with nor duplicated in other modules) and update its :connect() return value behavior and documentation. * espconn: remove scary global pktinfo A write-only global! How about that. * net: remove deprecated methods All the TLS stuff moved over there a long time ago, and net_createUDPSocket should just do what it says on the tin. * espconn_secure: remove ESPCONN_SERVER support We can barely function as a TLS client; being a TLS server seems like a real stretch. This code was never called from Lua anyway. * espconn_secure: more code removal * espconn_secure: simplify ssl options structure There is nothing "ssl_packet" about this structure. Get rid of the terrifying "pbuffer" pointer. Squash two structure types together and eliminate an unused field. * espconn_secure: refactor mbedtls_msg_info_load Split out espconn_mbedtls_parse, which we can use as part of our effort towards addressing #3032 * espconn_secure: introduce TLS cert/key callbacks The new feature part of #3032 Subsequent work will remove the old mechanism. * tls: add deprecation warnings * luacheck: net.ifinfo is a thing now * tls: remove use of espconn->reverse * mqtt: stop using espconn->reverse Instead, just place the espconn structure itself at the top of the user data. This enlarges the structure somewhat but removes one more layer of dynamic heap usage and NULL checks. While here, simplify the code a bit. * mqtt: remove redundant pointer to connect_info Everywhere we have the mqtt_state_t we also have the lmqtt_userdata. * mqtt: doc fixes * mqtt: note bug * tls: allow :on(...,nil) to unregister a callback
* espconn: remove unused espconn code, take 1 This is the easiest part of #3004 . It removes a bunch of functions that were never called in our tree. * espconn: De-orbit espconn_gethostbyname Further work on #3004 While here, remove `mqtt`'s charming DNS-retry logic (which is neither shared with nor duplicated in other modules) and update its :connect() return value behavior and documentation. * espconn: remove scary global pktinfo A write-only global! How about that. * net: remove deprecated methods All the TLS stuff moved over there a long time ago, and net_createUDPSocket should just do what it says on the tin. * espconn_secure: remove ESPCONN_SERVER support We can barely function as a TLS client; being a TLS server seems like a real stretch. This code was never called from Lua anyway. * espconn_secure: more code removal * espconn_secure: simplify ssl options structure There is nothing "ssl_packet" about this structure. Get rid of the terrifying "pbuffer" pointer. Squash two structure types together and eliminate an unused field. * espconn_secure: refactor mbedtls_msg_info_load Split out espconn_mbedtls_parse, which we can use as part of our effort towards addressing #3032 * espconn_secure: introduce TLS cert/key callbacks The new feature part of #3032 Subsequent work will remove the old mechanism. * tls: add deprecation warnings * luacheck: net.ifinfo is a thing now * tls: remove use of espconn->reverse * mqtt: stop using espconn->reverse Instead, just place the espconn structure itself at the top of the user data. This enlarges the structure somewhat but removes one more layer of dynamic heap usage and NULL checks. While here, simplify the code a bit. * mqtt: remove redundant pointer to connect_info Everywhere we have the mqtt_state_t we also have the lmqtt_userdata. * mqtt: doc fixes * mqtt: note bug * tls: allow :on(...,nil) to unregister a callback
@nwk, are you aware of the platform_rcr functions (read/write/delete) ? But that aside, I also feel on balance that it is a lot simpler to use SPIFFS as the repository for such data. |
I was not aware of the I admit I've stalled on actually eliminating the funky TLS flash goo because I haven't yet figured out a good replacement for the
Because our build system doesn't, historically, construct LFS or SPIFFS images as part of its operation, there's presently no real other way to do this. Given the existence of RCRs.... maybe we should expose those to Lua (at least in a RO way)... hm. This may also be related to #3117 and #3128 and attendant platform support. |
There are It isn't fully safe in that once the 4Kb page is used, the GC requires it to be erased and rewritten, which might occur every 50-100 config updates. Because it is at a fixed location, you can update it using ESPtool, and this is what nodemcu-partition does, so we could just add the extra logic to this. |
Yea, I think having |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Missing feature
I would like to propose that the current
tls.cert.verify
andtls.cert.auth
API is unfortunate. It directly accesses particular sectors of flash and is holographically embedded within bothapp/mbedtls/app/espconn_secure.c
andapp/mbedtls/app/espconn_mbedtls.c
. I would prefer, instead, I think, either a more elaborate per-connection configuration mechanism or, failing that,that the API be such that these two functions take Lua functions that return certificates or keys when invoked:
We can encode the current behavior by making the PEM-string forms of these functions write to
a particular name in SPIFFS and make the boolean forms install default functions that read those files.
Justification
At least in the test harness I'm working on, there's a fair bit of juggling of SSL keys and certs, and I'd much rather have these as files in the SPIFFS than in particular sectors of flash.
Workarounds
Lots and lots of flash overwrites.
The text was updated successfully, but these errors were encountered: