You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge bitcoin#31398: wallet: refactor: various master key encryption cleanups
a8333fc scripted-diff: wallet: rename plain and encrypted master key variables (Sebastian Falbesoner)
5a92077 wallet: refactor: dedup master key decryption (Sebastian Falbesoner)
8465459 wallet: refactor: dedup master key encryption / derivation rounds setting (Sebastian Falbesoner)
a6d9b41 wallet: refactor: introduce `CMasterKey::DEFAULT_DERIVE_ITERATIONS` constant (Sebastian Falbesoner)
62c209f wallet: doc: remove mentions of unavailable scrypt derivation method (Sebastian Falbesoner)
Pull request description:
This PR contains various cleanups around the wallet's master key encryption logic. The default/minimum key derivation rounds magic number of 25000 is hoisted into a constant (member of `CMasterKey`) and two new functions `EncryptMasterKey`/`DecryptMasterKey` are introduced in order to deduplicate code for the derivation round determination and master key en/decryption. Also, mentions of the never-implemented derivation method `scrypt` are removed from the wallet crypter header and both plain and encrypted master key instances are renamed to adapt to moderning coding style (hopefully improving readability).
ACKs for top commit:
davidgumberg:
ACK bitcoin@a8333fc
achow101:
ACK a8333fc
Tree-SHA512: 5a66d3b26f481347d0b5b4f742dd237803a35aad6e3480ed15fd38b7fa3700650bd5f67f4c30ed88f5fad45d6cd4c893fe4f1657e36e563b4294fd3596187724
WalletLogPrintf("Wallet passphrase changed to an nDeriveIterations of %i\n", pMasterKey.second.nDeriveIterations);
635
-
636
-
if (!crypter.SetKeyFromPassphrase(strNewWalletPassphrase, pMasterKey.second.vchSalt, pMasterKey.second.nDeriveIterations, pMasterKey.second.nDerivationMethod))
637
-
returnfalse;
638
-
if (!crypter.Encrypt(_vMasterKey, pMasterKey.second.vchCryptedKey))
660
+
if (!EncryptMasterKey(strNewWalletPassphrase, plain_master_key, master_key)) {
0 commit comments