Skip to content

Move all SSL constants into PROGMEM, free 1.2KB #6162

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

Merged
merged 6 commits into from
Jun 6, 2019

Conversation

earlephilhower
Copy link
Collaborator

Rewrite all the integer math operations with const input parameters to
use PROGMEM properly (pgm_read_xx or memcpy_P), and move all the EC
order and generators and SHA OIDs to PROGMEM.

This frees around 1.2KB of heap for any SSL applications with no
perceptible speed impact.

Also delete unneeded objects from the bearssl.a library to shrink the
GIT repo size.

This runs everything I've tried without incident, but needs community testing to validate I've covered all the constant use cases

Rewrite all the integer math operations with const input parameters to
use PROGMEM properly (pgm_read_xx or memcpy_P), and move all the EC
order and generators and SHA OIDs to PROGMEM.

This frees around 1.2KB of heap for any SSL applications.

Also delete unneeded objects from the bearssl.a library to shrink the
GIT repo size.
@earlephilhower
Copy link
Collaborator Author

@mcspr @sislakd, you should give this a try if you're still doing SSL development.

@mcspr
Copy link
Collaborator

mcspr commented May 28, 2019

No problems so far using HTTPS updater.
More heap as advertised too.

@earlephilhower
Copy link
Collaborator Author

@TD-er, did you give this PR a test with your app? Anything to report?

@TD-er
Copy link
Contributor

TD-er commented Jun 6, 2019

@earlephilhower Nope, haven't tested it, since we currently have no SSL code in use.
It was simply taking too much resources, but this may help.

So I cannot say it will break previous implementations, since we simply have none (yet).

Copy link
Collaborator

@devyte devyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing jumps out at me.

@earlephilhower earlephilhower merged commit 6bfb1ba into esp8266:master Jun 6, 2019
@earlephilhower earlephilhower deleted the all-ssl-to-flash branch June 6, 2019 20:05
earlephilhower added a commit to earlephilhower/Arduino that referenced this pull request Jun 7, 2019
Undo the BearSSL RODATA->PROGMEM changes because there are some bad
performance regressions in EC server operations which can result in
timeouts and WDTs.

Keep the shrunked bearssl.a library as that is orthogonal to the PROGMEM
changes.
earlephilhower added a commit that referenced this pull request Jun 7, 2019
Undo the BearSSL RODATA->PROGMEM changes because there are some bad
performance regressions in EC server operations which can result in
timeouts and WDTs.

Keep the shrunked bearssl.a library as that is orthogonal to the PROGMEM
changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants