]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Fix dpp_test_gen_invalid_key() with BoringSSL
authorJouni Malinen <jouni@qca.qualcomm.com>
Sat, 18 Nov 2017 11:22:17 +0000 (13:22 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 18 Nov 2017 15:50:08 +0000 (17:50 +0200)
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 <jouni@qca.qualcomm.com>
src/common/dpp.c

index 9f10a4cd1839d0986da03f91663e2d9b0d601075..cc8f31720f5c5eecc57a536c97e02d16db676520 100644 (file)
@@ -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);