mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-06 12:51:21 +00:00
Merge pull request #29 from dstanchfield/master
fixed salt passing to pbkdf2_hmac_sha512
This commit is contained in:
commit
72f2f5ced6
@ -267,8 +267,10 @@ bool storage_getRootNode(HDNode *node)
|
|||||||
if (storage.has_passphrase_protection && storage.passphrase_protection && strlen(sessionPassphrase)) {
|
if (storage.has_passphrase_protection && storage.passphrase_protection && strlen(sessionPassphrase)) {
|
||||||
// decrypt hd node
|
// decrypt hd node
|
||||||
uint8_t secret[64];
|
uint8_t secret[64];
|
||||||
|
uint8_t salt[12];
|
||||||
|
memcpy(salt, "TREZORHD", 8);
|
||||||
layoutProgressSwipe("Waking up", 0);
|
layoutProgressSwipe("Waking up", 0);
|
||||||
pbkdf2_hmac_sha512((const uint8_t *)sessionPassphrase, strlen(sessionPassphrase), (uint8_t *)"TREZORHD", 8, BIP39_PBKDF2_ROUNDS, secret, 64, get_root_node_callback);
|
pbkdf2_hmac_sha512((const uint8_t *)sessionPassphrase, strlen(sessionPassphrase), salt, 8, BIP39_PBKDF2_ROUNDS, secret, 64, get_root_node_callback);
|
||||||
aes_decrypt_ctx ctx;
|
aes_decrypt_ctx ctx;
|
||||||
aes_decrypt_key256(secret, &ctx);
|
aes_decrypt_key256(secret, &ctx);
|
||||||
aes_cbc_decrypt(sessionRootNode.chain_code, sessionRootNode.chain_code, 32, secret + 32, &ctx);
|
aes_cbc_decrypt(sessionRootNode.chain_code, sessionRootNode.chain_code, 32, secret + 32, &ctx);
|
||||||
|
Loading…
Reference in New Issue
Block a user