adapt the reorder of hash_final functions

pull/25/head
Pavol Rusnak 8 years ago
parent b8539a6972
commit 5e5138066a
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -426,7 +426,7 @@ static void hid_rx_callback(usbd_device *dev, uint8_t ep)
return;
}
uint8_t hash[32];
sha256_Final(hash, &ctx);
sha256_Final(&ctx, hash);
layoutFirmwareHash(hash);
do {
delay(100000);

@ -110,7 +110,7 @@ int cryptoMessageSign(const HDNode *node, const uint8_t *message, size_t message
sha256_Update(&ctx, varint, l);
sha256_Update(&ctx, message, message_len);
uint8_t hash[32];
sha256_Final(hash, &ctx);
sha256_Final(&ctx, hash);
sha256_Raw(hash, 32, hash);
uint8_t pby;
int result = hdnode_sign_digest(node, hash, signature + 1, &pby);
@ -151,7 +151,7 @@ int cryptoMessageVerify(const uint8_t *message, size_t message_len, const uint8_
uint32_t l = ser_length(message_len, varint);
sha256_Update(&ctx, varint, l);
sha256_Update(&ctx, message, message_len);
sha256_Final(hash, &ctx);
sha256_Final(&ctx, hash);
sha256_Raw(hash, 32, hash);
// e = -hash
bn_read_be(hash, &e);
@ -357,7 +357,7 @@ int cryptoMultisigFingerprint(const MultisigRedeemScriptType *multisig, uint8_t
sha256_Update(&ctx, ptr[i]->node.public_key.bytes, 33);
}
sha256_Update(&ctx, (const uint8_t *)&n, sizeof(uint32_t));
sha256_Final(hash, &ctx);
sha256_Final(&ctx, hash);
layoutProgressUpdate(true);
return 1;
}
@ -385,6 +385,6 @@ int cryptoIdentityFingerprint(const IdentityType *identity, uint8_t *hash)
if (identity->has_path && identity->path[0]) {
sha256_Update(&ctx, (const uint8_t *)(identity->path), strlen(identity->path));
}
sha256_Final(hash, &ctx);
sha256_Final(&ctx, hash);
return 1;
}

@ -89,7 +89,7 @@ void reset_entropy(const uint8_t *ext_entropy, uint32_t len)
sha256_Init(&ctx);
sha256_Update(&ctx, int_entropy, 32);
sha256_Update(&ctx, ext_entropy, len);
sha256_Final(int_entropy, &ctx);
sha256_Final(&ctx, int_entropy);
strlcpy(storage.mnemonic, mnemonic_from_data(int_entropy, strength / 8), sizeof(storage.mnemonic));
memset(int_entropy, 0, 32);
awaiting_entropy = false;

@ -416,7 +416,7 @@ void signing_txack(TransactionType *tx)
idx1++;
send_req_3_output();
} else {
sha256_Final(hash_check, &tc);
sha256_Final(&tc, hash_check);
// check fees
if (spending > to_spend) {
fsm_sendFailure(FailureType_Failure_NotEnoughFunds, "Not enough funds");
@ -527,7 +527,7 @@ void signing_txack(TransactionType *tx)
idx2++;
send_req_4_output();
} else {
sha256_Final(hash, &tc);
sha256_Final(&tc, hash);
if (memcmp(hash, hash_check, 32) != 0) {
fsm_sendFailure(FailureType_Failure_Other, "Transaction has changed during signing");
signing_abort();

@ -223,7 +223,7 @@ uint32_t compile_script_multisig_hash(const MultisigRedeemScriptType *multisig,
d[1] = 0xAE;
sha256_Update(&ctx, d, 2);
sha256_Final(hash, &ctx);
sha256_Final(&ctx, hash);
return 1;
}
@ -425,7 +425,7 @@ void tx_init(TxStruct *tx, uint32_t inputs_len, uint32_t outputs_len, uint32_t v
void tx_hash_final(TxStruct *t, uint8_t *hash, bool reverse)
{
sha256_Final(hash, &(t->ctx));
sha256_Final(&(t->ctx), hash);
sha256_Raw(hash, 32, hash);
if (!reverse) return;
uint8_t i, k;

@ -1 +1 @@
Subproject commit 55edf71e274c4b803f9b0acb2847df51532fa302
Subproject commit ed6debf8c4ec5ef9c7ef31a1a7eddf76aa33ccd8
Loading…
Cancel
Save