Wipe the stack after key derivation, signing and the KDF (#5244) Key material should stay in memory no longer than it is needed. BLAKE2b, ed25519 and argon2 do not clear their stack frames before returning, so copies of the seed, private keys and data derived from the password remain on the stack until later calls overwrite them. Add nano::secure_wipe_stack, which zeroes a fixed span of the stack below its caller, and call it after deterministic_key, pub_key, sign_message and kdf::phs. The wipe is best effort: unoptimized builds can keep frames deeper than it reaches. deterministic_key also wipes its hash state, which sits in its own frame. The keypair constructors now derive the public key through nano::pub_key, and the wallet's deterministic account check derives public keys directly instead of passing each private key through a hex string. The fan class comment now says what its XOR shares do not protect against. The secure_memory tests check that secure_wipe_memory zeroes exactly the bytes it is given and that secure_wipe_stack clears what an earlier callee left on the stack.
__________
Type: commit
Hash: da14f14e230b6694c262492c61e4a4c391e5a80a
Created: today
__________
gr0v1ty/nano-node:da14f14e230b6694c262492c61e4a4c391e5a80a
| Test Case | Status | Duration | Median Deviation | Log | Graph |
|---|---|---|---|---|---|
| 5n4pr_conf_10k_bintree | PASS | 109 s | -3.0 s | GitHub job logs | Show |
| 5n4pr_conf_10k_change | PASS | 137 s | 8.0 s | GitHub job logs | Show |
| 5n4pr_conf_change_dependant | PASS | 102 s | -13.0 s | GitHub job logs | - |
| 5n4pr_conf_change_independant | PASS | 109 s | -2.0 s | GitHub job logs | - |
| 5n4pr_conf_send_dependant | PASS | 109 s | -6.0 s | GitHub job logs | - |
| 5n4pr_conf_send_independant | PASS | 97 s | -17.0 s | GitHub job logs | - |
| 5n4pr_rocks_10k_bintree | PASS | 103 s | -9.0 s | GitHub job logs | - |
| 5n4pr_rocks_10k_change | PASS | 166 s | 8.0 s | GitHub job logs | - |