diff options
Diffstat (limited to 'src/regress/lib')
-rw-r--r-- | src/regress/lib/libcrypto/ec/ectest.c | 50 |
1 files changed, 1 insertions, 49 deletions
diff --git a/src/regress/lib/libcrypto/ec/ectest.c b/src/regress/lib/libcrypto/ec/ectest.c index 6984db6d60..4f412d64e6 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.15 2023/04/18 07:54:42 tb Exp $ */ | 1 | /* $OpenBSD: ectest.c,v 1.16 2023/04/18 07:56:58 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. |
@@ -724,54 +724,6 @@ prime_field_tests(void) | |||
724 | 724 | ||
725 | } | 725 | } |
726 | 726 | ||
727 | /* Change test based on whether binary point compression is enabled or not. */ | ||
728 | #ifdef OPENSSL_EC_BIN_PT_COMP | ||
729 | #define CHAR2_CURVE_TEST_INTERNAL(_name, _p, _a, _b, _x, _y, _y_bit, _order, _cof, _degree, _variable) \ | ||
730 | if (!BN_hex2bn(&x, _x)) ABORT; \ | ||
731 | if (!EC_POINT_set_compressed_coordinates(group, P, x, _y_bit, ctx)) ABORT; \ | ||
732 | if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; \ | ||
733 | if (!BN_hex2bn(&z, _order)) ABORT; \ | ||
734 | if (!BN_hex2bn(&cof, _cof)) ABORT; \ | ||
735 | if (!EC_GROUP_set_generator(group, P, z, cof)) ABORT; \ | ||
736 | if (!EC_POINT_get_affine_coordinates(group, P, x, y, ctx)) ABORT; \ | ||
737 | fprintf(stdout, "\n%s -- Generator:\n x = 0x", _name); \ | ||
738 | BN_print_fp(stdout, x); \ | ||
739 | fprintf(stdout, "\n y = 0x"); \ | ||
740 | BN_print_fp(stdout, y); \ | ||
741 | fprintf(stdout, "\n"); \ | ||
742 | /* G_y value taken from the standard: */ \ | ||
743 | if (!BN_hex2bn(&z, _y)) ABORT; \ | ||
744 | if (0 != BN_cmp(y, z)) ABORT; | ||
745 | #else | ||
746 | #define CHAR2_CURVE_TEST_INTERNAL(_name, _p, _a, _b, _x, _y, _y_bit, _order, _cof, _degree, _variable) \ | ||
747 | if (!BN_hex2bn(&x, _x)) ABORT; \ | ||
748 | if (!BN_hex2bn(&y, _y)) ABORT; \ | ||
749 | if (!EC_POINT_set_affine_coordinates(group, P, x, y, ctx)) ABORT; \ | ||
750 | if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; \ | ||
751 | if (!BN_hex2bn(&z, _order)) ABORT; \ | ||
752 | if (!BN_hex2bn(&cof, _cof)) ABORT; \ | ||
753 | if (!EC_GROUP_set_generator(group, P, z, cof)) ABORT; \ | ||
754 | fprintf(stdout, "\n%s -- Generator:\n x = 0x", _name); \ | ||
755 | BN_print_fp(stdout, x); \ | ||
756 | fprintf(stdout, "\n y = 0x"); \ | ||
757 | BN_print_fp(stdout, y); \ | ||
758 | fprintf(stdout, "\n"); | ||
759 | #endif | ||
760 | |||
761 | #define CHAR2_CURVE_TEST(_name, _p, _a, _b, _x, _y, _y_bit, _order, _cof, _degree, _variable) \ | ||
762 | if (!BN_hex2bn(&p, _p)) ABORT; \ | ||
763 | if (!BN_hex2bn(&a, _a)) ABORT; \ | ||
764 | if (!BN_hex2bn(&b, _b)) ABORT; \ | ||
765 | if (!EC_GROUP_set_curve(group, p, a, b, ctx)) ABORT; \ | ||
766 | CHAR2_CURVE_TEST_INTERNAL(_name, _p, _a, _b, _x, _y, _y_bit, _order, _cof, _degree, _variable) \ | ||
767 | fprintf(stdout, "verify degree ..."); \ | ||
768 | if (EC_GROUP_get_degree(group) != _degree) ABORT; \ | ||
769 | fprintf(stdout, " ok\n"); \ | ||
770 | group_order_tests(group); \ | ||
771 | if (!(_variable = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT; \ | ||
772 | if (!EC_GROUP_copy(_variable, group)) ABORT; \ | ||
773 | |||
774 | |||
775 | static void | 727 | static void |
776 | internal_curve_test(void) | 728 | internal_curve_test(void) |
777 | { | 729 | { |