Merge pull request #140 from LedgerHQ/fix_stark_firmware_v2

Fix stark firmware v2
This commit is contained in:
Salvatore Ingala
2021-05-10 08:41:49 +02:00
committed by GitHub
2 changed files with 5 additions and 2 deletions

View File

@@ -30,7 +30,7 @@ APP_LOAD_PARAMS += --path "1517992542'/1101353413'"
APPVERSION_M=1
APPVERSION_N=7
APPVERSION_P=4
APPVERSION_P=5
APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)
APP_LOAD_FLAGS= --appFlags 0x240 --dep Ethereum:$(APPVERSION)

View File

@@ -67,9 +67,12 @@ static const ECPoint PEDERSEN_POINTS[4] = {
void accum_ec_mul(ECPoint *hash, uint8_t *buf, int len, int pedersen_idx) {
ECPoint tmp;
if (!allzeroes(buf, len)) {
uint8_t pad[32];
memcpy(tmp, PEDERSEN_POINTS[pedersen_idx], sizeof(ECPoint));
io_seproxyhal_io_heartbeat();
cx_ecfp_scalar_mult(CX_CURVE_Stark256, tmp, sizeof(ECPoint), buf, len);
memset(pad, 0, sizeof(pad));
memmove(pad + 32 - len, buf, len);
cx_ecfp_scalar_mult(CX_CURVE_Stark256, tmp, sizeof(ECPoint), pad, sizeof(pad));
io_seproxyhal_io_heartbeat();
cx_ecfp_add_point(CX_CURVE_Stark256, *hash, *hash, tmp, sizeof(ECPoint));
}