summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2023-07-24 17:00:11 +0000
committertb <>2023-07-24 17:00:11 +0000
commiteb3aa3efc09d2537c37f5f1e6765cd6e7a6d9a7e (patch)
treef9d748532393e74c137aa9631219ea197e73da4f
parent9f7733330e5ae03e5cb940264dcc27416967ad60 (diff)
downloadopenbsd-eb3aa3efc09d2537c37f5f1e6765cd6e7a6d9a7e.tar.gz
openbsd-eb3aa3efc09d2537c37f5f1e6765cd6e7a6d9a7e.tar.bz2
openbsd-eb3aa3efc09d2537c37f5f1e6765cd6e7a6d9a7e.zip
Fix EC_POINT_is_on_curve() checks.
If not even the idiot who invented this API gets this right...
-rw-r--r--src/regress/lib/libcrypto/ec/ectest.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/regress/lib/libcrypto/ec/ectest.c b/src/regress/lib/libcrypto/ec/ectest.c
index f90263dc2f..a66764a75f 100644
--- a/src/regress/lib/libcrypto/ec/ectest.c
+++ b/src/regress/lib/libcrypto/ec/ectest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ectest.c,v 1.19 2023/04/18 15:28:17 tb Exp $ */ 1/* $OpenBSD: ectest.c,v 1.20 2023/07/24 17:00:11 tb Exp $ */
2/* crypto/ec/ectest.c */ 2/* crypto/ec/ectest.c */
3/* 3/*
4 * Originally written by Bodo Moeller for the OpenSSL project. 4 * Originally written by Bodo Moeller for the OpenSSL project.
@@ -258,7 +258,7 @@ prime_field_tests(void)
258 ABORT; 258 ABORT;
259 if (!EC_POINT_set_compressed_coordinates(group, Q, x, 1, ctx)) 259 if (!EC_POINT_set_compressed_coordinates(group, Q, x, 1, ctx))
260 ABORT; 260 ABORT;
261 if (!EC_POINT_is_on_curve(group, Q, ctx)) { 261 if (EC_POINT_is_on_curve(group, Q, ctx) <= 0) {
262 if (!EC_POINT_get_affine_coordinates(group, Q, x, y, ctx)) 262 if (!EC_POINT_get_affine_coordinates(group, Q, x, y, ctx))
263 ABORT; 263 ABORT;
264 fprintf(stderr, "Point is not on curve: x = 0x"); 264 fprintf(stderr, "Point is not on curve: x = 0x");
@@ -365,7 +365,7 @@ prime_field_tests(void)
365 ABORT; 365 ABORT;
366 if (!EC_POINT_set_affine_coordinates(group, P, x, y, ctx)) 366 if (!EC_POINT_set_affine_coordinates(group, P, x, y, ctx))
367 ABORT; 367 ABORT;
368 if (!EC_POINT_is_on_curve(group, P, ctx)) 368 if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
369 ABORT; 369 ABORT;
370 if (!BN_hex2bn(&z, "0100000000000000000001F4C8F927AED3CA752257")) 370 if (!BN_hex2bn(&z, "0100000000000000000001F4C8F927AED3CA752257"))
371 ABORT; 371 ABORT;
@@ -415,7 +415,7 @@ prime_field_tests(void)
415 ABORT; 415 ABORT;
416 if (!EC_POINT_set_compressed_coordinates(group, P, x, 1, ctx)) 416 if (!EC_POINT_set_compressed_coordinates(group, P, x, 1, ctx))
417 ABORT; 417 ABORT;
418 if (!EC_POINT_is_on_curve(group, P, ctx)) 418 if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
419 ABORT; 419 ABORT;
420 if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831")) 420 if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831"))
421 ABORT; 421 ABORT;
@@ -465,7 +465,7 @@ prime_field_tests(void)
465 ABORT; 465 ABORT;
466 if (!EC_POINT_set_compressed_coordinates(group, P, x, 0, ctx)) 466 if (!EC_POINT_set_compressed_coordinates(group, P, x, 0, ctx))
467 ABORT; 467 ABORT;
468 if (!EC_POINT_is_on_curve(group, P, ctx)) 468 if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
469 ABORT; 469 ABORT;
470 if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D")) 470 if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D"))
471 ABORT; 471 ABORT;
@@ -515,7 +515,7 @@ prime_field_tests(void)
515 ABORT; 515 ABORT;
516 if (!EC_POINT_set_compressed_coordinates(group, P, x, 1, ctx)) 516 if (!EC_POINT_set_compressed_coordinates(group, P, x, 1, ctx))
517 ABORT; 517 ABORT;
518 if (!EC_POINT_is_on_curve(group, P, ctx)) 518 if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
519 ABORT; 519 ABORT;
520 if (!BN_hex2bn(&z, "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E" 520 if (!BN_hex2bn(&z, "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E"
521 "84F3B9CAC2FC632551")) ABORT; 521 "84F3B9CAC2FC632551")) ABORT;
@@ -565,7 +565,7 @@ prime_field_tests(void)
565 "9859F741E082542A385502F25DBF55296C3A545E3872760AB7")) ABORT; 565 "9859F741E082542A385502F25DBF55296C3A545E3872760AB7")) ABORT;
566 if (!EC_POINT_set_compressed_coordinates(group, P, x, 1, ctx)) 566 if (!EC_POINT_set_compressed_coordinates(group, P, x, 1, ctx))
567 ABORT; 567 ABORT;
568 if (!EC_POINT_is_on_curve(group, P, ctx)) 568 if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
569 ABORT; 569 ABORT;
570 if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" 570 if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
571 "FFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973")) ABORT; 571 "FFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973")) ABORT;
@@ -619,7 +619,7 @@ prime_field_tests(void)
619 "3C1856A429BF97E7E31C2E5BD66")) ABORT; 619 "3C1856A429BF97E7E31C2E5BD66")) ABORT;
620 if (!EC_POINT_set_compressed_coordinates(group, P, x, 0, ctx)) 620 if (!EC_POINT_set_compressed_coordinates(group, P, x, 0, ctx))
621 ABORT; 621 ABORT;
622 if (!EC_POINT_is_on_curve(group, P, ctx)) 622 if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
623 ABORT; 623 ABORT;
624 if (!BN_hex2bn(&z, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" 624 if (!BN_hex2bn(&z, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
625 "FFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5" 625 "FFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5"
@@ -664,7 +664,7 @@ prime_field_tests(void)
664 /* P := 2P */ 664 /* P := 2P */
665 if (!EC_POINT_dbl(group, P, P, ctx)) 665 if (!EC_POINT_dbl(group, P, P, ctx))
666 ABORT; 666 ABORT;
667 if (!EC_POINT_is_on_curve(group, P, ctx)) 667 if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
668 ABORT; 668 ABORT;
669 /* Q := -P */ 669 /* Q := -P */
670 if (!EC_POINT_invert(group, Q, ctx)) 670 if (!EC_POINT_invert(group, Q, ctx))