Skip to content

hardening: add MP_ZERO_BUFFER, MP_ZERO_DIGITS #255

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 1 commit into from
May 12, 2019
Merged

Conversation

minad
Copy link
Member

@minad minad commented May 11, 2019

  • (!) Always zero buffer before freeing if MP_NO_ZERO_ON_FREE is not defined
  • Add MP_NO_ZERO_ON_FREE to disable hardening
  • Add MP_ZERO_BUFFER, MP_ZERO_DIGITS, MP_FREE_BUFFFER, MP_FREE_DIGITS
  • Never use MP_FREE directly, use MP_FREE_DIGITS or MP_FREE_BUFFER
  • Add MP_USE_MEMSET to use memset instead of loop
  • Disable astyle backups which are annonying in the times of git

@minad minad force-pushed the hardening branch 3 times, most recently from bc8d46d to 95513f1 Compare May 11, 2019 09:48
@minad minad requested review from czurnieden and sjaeckel May 11, 2019 10:01
Copy link
Contributor

@czurnieden czurnieden left a comment

Choose a reason for hiding this comment

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

As long as it can be switched off when not needed: yepp, good idea.

* (!) Always zero buffer before freeing if MP_NO_ZERO_ON_FREE is not defined
* Add MP_NO_ZERO_ON_FREE to disable hardening
* Add MP_ZERO_BUFFER, MP_ZERO_DIGITS, MP_FREE_BUFFFER, MP_FREE_DIGITS
* Never use MP_FREE directly, use MP_FREE_DIGITS or MP_FREE_BUFFER
* Add MP_USE_MEMSET to use memset instead of loop
* Disable astyle backups which are annonying in the times of git
@minad
Copy link
Member Author

minad commented May 11, 2019

rebased and missing casts added

@minad
Copy link
Member Author

minad commented May 12, 2019

@sjaeckel This one should be ready.

@sjaeckel sjaeckel merged commit 235e831 into develop May 12, 2019
@sjaeckel sjaeckel deleted the hardening branch May 12, 2019 09:52
@minad
Copy link
Member Author

minad commented May 17, 2019

See https://www.usenix.org/system/files/conference/usenixsecurity17/sec17-yang.pdf for issues regarding memset deadstore elim. There is explicit_bzero for example in OpenBSD. Maybe more relevant for LTC.

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.

3 participants