Skip to content

fix(k1util): zeroize secret key buffers in load and save - #686

Open
varex83agent wants to merge 1 commit into
mainfrom
fix/issue-111-zeroize-k1util
Open

fix(k1util): zeroize secret key buffers in load and save#686
varex83agent wants to merge 1 commit into
mainfrom
fix/issue-111-zeroize-k1util

Conversation

@varex83agent

Copy link
Copy Markdown
Collaborator

Closes #111.

k1util::load and k1util::save moved the raw secp256k1 secret through
intermediate buffers — the hex string read from disk and the decoded scalar in
load, the serialized scalar and its hex encoding in save — that were dropped
without being wiped. Each is now held in zeroize::Zeroizing so it is cleared on
drop, matching the existing precedent in crates/crypto and crates/eth2util.

Behaviour, file contents and the 0o600 permissions are unchanged; this is
defence-in-depth only. Charon's Go Load/Save do not zeroize (Go offers no
equivalent guarantee), so this is a Rust-side hardening rather than a parity fix.

Co-Authored-By: Bohdan Ohorodnii 35969035+varex83@users.noreply.github.com

Closes #111.

Co-Authored-By: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
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.

Use Zeroize in sensitive sections

2 participants