diff --git a/Makefile b/Makefile index ef07496..fe17617 100755 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/src/stark_utils.c b/src/stark_utils.c index 5e66288..45ec2a9 100644 --- a/src/stark_utils.c +++ b/src/stark_utils.c @@ -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)); }