From 94619905c86d434feba3d7bb902aa228418349c6 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 18 Nov 2017 13:22:17 +0200 Subject: [PATCH] DPP: Fix dpp_test_gen_invalid_key() with BoringSSL Unlike OpenSSL, BoringSSL returns an error from EC_POINT_set_affine_coordinates_GFp() is not on the curve. As such, need to behave differently here depending on which library is used. Signed-off-by: Jouni Malinen --- src/common/dpp.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/common/dpp.c b/src/common/dpp.c index 9f10a4cd1..cc8f31720 100644 --- a/src/common/dpp.c +++ b/src/common/dpp.c @@ -5842,8 +5842,15 @@ static int dpp_test_gen_invalid_key(struct wpabuf *msg, goto fail; if (EC_POINT_set_affine_coordinates_GFp(group, point, x, y, - ctx) != 1) + ctx) != 1) { +#ifdef OPENSSL_IS_BORINGSSL + /* Unlike OpenSSL, BoringSSL returns an error from + * EC_POINT_set_affine_coordinates_GFp() is not on the curve. */ + break; +#else /* OPENSSL_IS_BORINGSSL */ goto fail; +#endif /* OPENSSL_IS_BORINGSSL */ + } if (!EC_POINT_is_on_curve(group, point, ctx)) break; @@ -5857,6 +5864,8 @@ static int dpp_test_gen_invalid_key(struct wpabuf *msg, ret = 0; fail: + if (ret < 0) + wpa_printf(MSG_INFO, "DPP: Failed to generate invalid key"); BN_free(x); BN_free(y); EC_POINT_free(point);