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 <j@w1.fi>
This commit is contained in:
Jouni Malinen 2022-05-08 00:31:25 +03:00
parent a8c3199527
commit 2227c85a94

View file

@ -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);