From 2227c85a940277e01a46f2c02fcc6c4df7a61ec6 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 8 May 2022 00:31:25 +0300 Subject: [PATCH] DPP: Verify that crypto_ec_point_to_bin() succeeds This is testing code, but it's better to check the return value explicitly even if this were not really able to fail in practice. Signed-off-by: Jouni Malinen --- src/common/dpp_crypto.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/common/dpp_crypto.c b/src/common/dpp_crypto.c index 47f56c258..8d3f3abfa 100644 --- a/src/common/dpp_crypto.c +++ b/src/common/dpp_crypto.c @@ -2472,11 +2472,9 @@ retry: /* Retrieve public key coordinates */ pub_key = crypto_ec_key_get_public_key(key); - if (!pub_key) + if (!pub_key || crypto_ec_point_to_bin(ec, pub_key, x, y)) goto fail; - crypto_ec_point_to_bin(ec, pub_key, x, y); - /* And corrupt them */ y[curve->prime_len - 1] ^= 0x01; p = crypto_ec_point_from_bin(ec, x);