[PATCH 3/6] dpp_pkex: EC point mul w/ value < prime

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Glenn Strauss <gstrauss@xxxxxxxxxxxxx>
---
 src/common/dpp_crypto.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/common/dpp_crypto.c b/src/common/dpp_crypto.c
index 1fbdc86a8..381dd0ed2 100644
--- a/src/common/dpp_crypto.c
+++ b/src/common/dpp_crypto.c
@@ -1567,7 +1567,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)) {
-- 
2.38.1

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux