Merge pull request #7600 from SparkiDev/wc_ecc_mulmod_zero_z1

ECC: when multiplying by zero, set z to 1
This commit is contained in:
JacobBarthelmeh
2024-06-18 16:36:35 -06:00
committed by GitHub
2 changed files with 5 additions and 1 deletions

View File

@@ -4061,7 +4061,7 @@ int wc_ecc_mulmod(const mp_int* k, ecc_point *G, ecc_point *R, mp_int* a,
if ((k != NULL) && (R != NULL) && (mp_iszero(k))) {
mp_zero(R->x);
mp_zero(R->y);
mp_zero(R->z);
mp_set(R->z, 1);
return MP_OKAY;
}
return wc_ecc_mulmod_ex(k, G, R, a, modulus, map, NULL);

View File

@@ -31085,6 +31085,10 @@ static wc_test_ret_t ecc_mulmod_test(ecc_key* key1)
ret = WC_TEST_RET_ENC_EC(ret);
goto done;
}
if (mp_cmp_d(key3->pubkey.z, 1) != MP_EQ) {
ret = WC_TEST_RET_ENC_EC(ret);
goto done;
}
#endif
done: