Repository navigation
Prevent default/invalid CKey objects from allocating secure memory - #28500
Merged
Merged
Conversation
Contributor
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. |
ajtowns
reviewed
Sep 21, 2023
ajtowns
left a comment
Contributor
There was a problem hiding this comment.
Approach ACK f2156d613e6e8cc6a6c3d860b74d912515dc782a
sipa
force-pushed
the
202309_no_null_key_alloc
branch
2 times, most recently
from
September 22, 2023 22:58
9752422 to
cd23401
Compare
ajtowns
reviewed
Sep 24, 2023
sipa
force-pushed
the
202309_no_null_key_alloc
branch
from
September 24, 2023 11:22
cd23401 to
94d58fe
Compare
Contributor
|
ACK 94d58fe942fd86fc8d3b11e3f75e4a4f82c86e38 lgtm |
john-moffett
left a comment
Contributor
There was a problem hiding this comment.
Approach ACK. One minor suggestion and one nit.
Co-authored-by: Pieter Wuille <[email protected]>
Instead of storing the key material as an std::vector (with secure allocator), use a secure_unique_ptr to a 32-byte array, and use nullptr for invalid keys. This means a smaller CKey type, and no secure/dynamic memory usage for invalid keys.
sipa
force-pushed
the
202309_no_null_key_alloc
branch
from
September 27, 2023 19:05
94d58fe to
6ef405d
Compare
Contributor
|
ACK 6ef405d |
Frank-GER
pushed a commit
to syscoin/syscoin
that referenced
this pull request
Oct 5, 2023
…ting secure memory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bitcoin Core has
secure_allocator, which allocates inside special "secure" (non-swappable) memory pages, which may be limited in availability. Currently, everyCKeyobject uses 32 such secure bytes, even when theCKeyobject contains the (invalid) value zero.Change this to not use memory when the
CKeyis invalid. This is particularly relevant forBIP324Cipherwhich briefly holds aCKey, but after receiving the remote's public key and initializing the encryption ciphers, the key is wiped. In case secure memory usage is in high demand, it'd be silly to waste it on P2P encryption keys instead of wallet keys.