diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/regress/lib/libcrypto/ec/Makefile | 4 | ||||
| -rw-r--r-- | src/regress/lib/libcrypto/ec/ec_point_conversion.c | 8 | ||||
| -rw-r--r-- | src/regress/lib/libcrypto/ec/ectest.c | 10 |
3 files changed, 14 insertions, 8 deletions
diff --git a/src/regress/lib/libcrypto/ec/Makefile b/src/regress/lib/libcrypto/ec/Makefile index 081eeb56bd..0826b44a25 100644 --- a/src/regress/lib/libcrypto/ec/Makefile +++ b/src/regress/lib/libcrypto/ec/Makefile | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.7 2023/04/17 20:36:08 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.8 2023/04/17 20:41:02 tb Exp $ |
| 2 | 2 | ||
| 3 | PROGS += ectest | 3 | PROGS += ectest |
| 4 | PROGS += ec_asn1_test | 4 | PROGS += ec_asn1_test |
| 5 | PROGS += ec_point_conversion | 5 | PROGS += ec_point_conversion |
| 6 | 6 | ||
| 7 | LDADD = ${CRYPTO_INT} | 7 | LDADD = -lcrypto |
| 8 | DPADD = ${LIBCRYPTO} | 8 | DPADD = ${LIBCRYPTO} |
| 9 | WARNINGS = Yes | 9 | WARNINGS = Yes |
| 10 | CFLAGS += -DLIBRESSL_CRYPTO_INTERNAL -DLIBRESSL_INTERNAL | 10 | CFLAGS += -DLIBRESSL_CRYPTO_INTERNAL -DLIBRESSL_INTERNAL |
diff --git a/src/regress/lib/libcrypto/ec/ec_point_conversion.c b/src/regress/lib/libcrypto/ec/ec_point_conversion.c index 5a97f67b94..dca35ced59 100644 --- a/src/regress/lib/libcrypto/ec/ec_point_conversion.c +++ b/src/regress/lib/libcrypto/ec/ec_point_conversion.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_point_conversion.c,v 1.9 2023/04/15 21:53:38 tb Exp $ */ | 1 | /* $OpenBSD: ec_point_conversion.c,v 1.10 2023/04/17 20:41:02 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2021 Theo Buehler <tb@openbsd.org> | 3 | * Copyright (c) 2021 Theo Buehler <tb@openbsd.org> |
| 4 | * Copyright (c) 2021 Joel Sing <jsing@openbsd.org> | 4 | * Copyright (c) 2021 Joel Sing <jsing@openbsd.org> |
| @@ -177,8 +177,10 @@ test_random_points_on_curve(EC_builtin_curve *curve) | |||
| 177 | for (i = 0; i < N_RANDOM_POINTS; i++) { | 177 | for (i = 0; i < N_RANDOM_POINTS; i++) { |
| 178 | EC_POINT *random_point; | 178 | EC_POINT *random_point; |
| 179 | 179 | ||
| 180 | if (!bn_rand_interval(random, BN_value_one(), order)) | 180 | do { |
| 181 | errx(1, "bn_rand_interval"); | 181 | if (!BN_rand_range(random, order)) |
| 182 | errx(1, "BN_rand_range"); | ||
| 183 | } while (BN_is_zero(random)); | ||
| 182 | 184 | ||
| 183 | if ((random_point = EC_POINT_new(group)) == NULL) | 185 | if ((random_point = EC_POINT_new(group)) == NULL) |
| 184 | errx(1, "EC_POINT_new"); | 186 | errx(1, "EC_POINT_new"); |
diff --git a/src/regress/lib/libcrypto/ec/ectest.c b/src/regress/lib/libcrypto/ec/ectest.c index 2b9c6a99f3..d2253609cd 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.13 2023/04/13 05:25:30 tb Exp $ */ | 1 | /* $OpenBSD: ectest.c,v 1.14 2023/04/17 20:41:02 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. |
| @@ -96,6 +96,9 @@ | |||
| 96 | #define TIMING_RAND_PT 1 | 96 | #define TIMING_RAND_PT 1 |
| 97 | #define TIMING_SIMUL 2 | 97 | #define TIMING_SIMUL 2 |
| 98 | 98 | ||
| 99 | int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, | ||
| 100 | const EC_POINT *point, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx); | ||
| 101 | |||
| 99 | /* test multiplication with group order, long and negative scalars */ | 102 | /* test multiplication with group order, long and negative scalars */ |
| 100 | static void | 103 | static void |
| 101 | group_order_tests(EC_GROUP *group) | 104 | group_order_tests(EC_GROUP *group) |
| @@ -132,7 +135,8 @@ group_order_tests(EC_GROUP *group) | |||
| 132 | ABORT; | 135 | ABORT; |
| 133 | fprintf(stdout, " ok\n"); | 136 | fprintf(stdout, " ok\n"); |
| 134 | fprintf(stdout, "long/negative scalar tests ... "); | 137 | fprintf(stdout, "long/negative scalar tests ... "); |
| 135 | if (!BN_one(n1)) | 138 | /* XXX - switch back to BN_one() after next bump. */ |
| 139 | if (!BN_set_word(n1, 1)) | ||
| 136 | ABORT; | 140 | ABORT; |
| 137 | /* n1 = 1 - order */ | 141 | /* n1 = 1 - order */ |
| 138 | if (!BN_sub(n1, n1, order)) | 142 | if (!BN_sub(n1, n1, order)) |
| @@ -342,7 +346,7 @@ prime_field_tests(void) | |||
| 342 | fprintf(stdout, "\nGenerator as octet string, hybrid form:\n "); | 346 | fprintf(stdout, "\nGenerator as octet string, hybrid form:\n "); |
| 343 | for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]); | 347 | for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]); |
| 344 | 348 | ||
| 345 | if (!EC_POINT_get_Jprojective_coordinates(group, R, x, y, z, ctx)) | 349 | if (!EC_POINT_get_Jprojective_coordinates_GFp(group, R, x, y, z, ctx)) |
| 346 | ABORT; | 350 | ABORT; |
| 347 | fprintf(stdout, "\nA representation of the inverse of that generator in\nJacobian projective coordinates:\n X = 0x"); | 351 | fprintf(stdout, "\nA representation of the inverse of that generator in\nJacobian projective coordinates:\n X = 0x"); |
| 348 | BN_print_fp(stdout, x); | 352 | BN_print_fp(stdout, x); |
