Page MenuHomePhabricator

Switch memory_cleanse implementation to BoringSSL's

Authored by Fabien on May 19 2020, 12:33.


Summary ensure memory clearing even with link-time optimization.

The implementation we currently use from OpenSSL prevents the compiler
from optimizing away clensing operations on blocks of memory that are
about to be released, but this protection is not extended to link-time
optimization. This commit copies the solution cooked up by Google
compiler engineers which uses inline assembly directives to instruct the
compiler not to optimize out the call under any circumstances. As the
code is in-lined, this has the added advantage of removing one more
OpenSSL dependency.

Regarding license compatibility, Google's contributions to BoringSSL
library, including this code, is made available under the ISC license,
which is MIT compatible.

BoringSSL git commit: ad1907fe73334d6c696c8539646c21b11178f20f

Backport of core PR11196.

Test Plan
ninja all check

Run the windows Gitian build.

Diff Detail

rABC Bitcoin ABC
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Fabien created this revision.May 19 2020, 12:33
Herald added a reviewer: Restricted Project. · View Herald TranscriptMay 19 2020, 12:33
Fabien requested review of this revision.May 19 2020, 12:33
teamcity edited the summary of this revision. (Show Details)May 19 2020, 12:33

[Bot Message]
One or more PR numbers were detected in the summary.
Links to those PRs have been inserted into the summary for reference.

deadalnix accepted this revision.May 19 2020, 12:41
deadalnix added a subscriber: deadalnix.
deadalnix added inline comments.
10 ↗(On Diff #20260)

two stars

31 ↗(On Diff #20260)


This revision is now accepted and ready to land.May 19 2020, 12:41
Fabien updated this revision to Diff 20261.May 19 2020, 12:42

Doxygen comments

This revision was automatically updated to reflect the committed changes.