dpp_pkex: EC point mul w/ value < prime

crypto_ec_point_mul() with mbedtls requires point
be multiplied by a multiplicand with value < prime

Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
This commit is contained in:
Glenn Strauss 2022-10-04 17:09:24 -04:00 committed by sinavir
parent 687ef821ce
commit c82091cbaa
No known key found for this signature in database

View file

@ -1588,7 +1588,9 @@ dpp_pkex_derive_Qr(const struct dpp_curve_params *curve, const u8 *mac_resp,
Pr = crypto_ec_key_get_public_key(Pr_key);
Qr = crypto_ec_point_init(ec);
hash_bn = crypto_bignum_init_set(hash, curve->hash_len);
if (!Pr || !Qr || !hash_bn || crypto_ec_point_mul(ec, Pr, hash_bn, Qr))
if (!Pr || !Qr || !hash_bn ||
crypto_bignum_mod(hash_bn, crypto_ec_get_prime(ec), hash_bn) ||
crypto_ec_point_mul(ec, Pr, hash_bn, Qr))
goto fail;
if (crypto_ec_point_is_at_infinity(ec, Qr)) {