diff options
author | miod <> | 2015-02-08 22:25:03 +0000 |
---|---|---|
committer | miod <> | 2015-02-08 22:25:03 +0000 |
commit | dd6276f01b34c3a6f2592c0bd72685bbba93fb31 (patch) | |
tree | 39229584702a732ee11613b8adc170ac872553d0 | |
parent | 7d41edeab1a29aba3d0cd0334b1edefd62baa889 (diff) | |
download | openbsd-dd6276f01b34c3a6f2592c0bd72685bbba93fb31.tar.gz openbsd-dd6276f01b34c3a6f2592c0bd72685bbba93fb31.tar.bz2 openbsd-dd6276f01b34c3a6f2592c0bd72685bbba93fb31.zip |
Use `> 0' instead of `!= 0' as a successful condition for
EC_POINT_is_at_infinity() and EC_POINT_is_on_curve(), for they may return -1
should an error arise.
ok doug@ jsing@
-rw-r--r-- | src/lib/libcrypto/ec/ec2_mult.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec2_oct.c | 8 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec2_smpl.c | 20 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec_check.c | 6 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec_key.c | 8 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ecp_nistp224.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ecp_nistp256.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ecp_nistp521.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ecp_oct.c | 8 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ecp_smpl.c | 22 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/ec/ec2_mult.c | 4 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/ec/ec2_oct.c | 8 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/ec/ec2_smpl.c | 20 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/ec/ec_check.c | 6 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/ec/ec_key.c | 8 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/ec/ecp_nistp224.c | 4 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/ec/ecp_nistp256.c | 4 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/ec/ecp_nistp521.c | 4 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/ec/ecp_oct.c | 8 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/ec/ecp_smpl.c | 22 |
20 files changed, 88 insertions, 88 deletions
diff --git a/src/lib/libcrypto/ec/ec2_mult.c b/src/lib/libcrypto/ec/ec2_mult.c index c74571f88c..dd113907be 100644 --- a/src/lib/libcrypto/ec/ec2_mult.c +++ b/src/lib/libcrypto/ec/ec2_mult.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec2_mult.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ec2_mult.c,v 1.6 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
4 | * | 4 | * |
@@ -272,7 +272,7 @@ ec_GF2m_montgomery_point_multiply(const EC_GROUP *group, EC_POINT *r, | |||
272 | } | 272 | } |
273 | /* if result should be point at infinity */ | 273 | /* if result should be point at infinity */ |
274 | if ((scalar == NULL) || BN_is_zero(scalar) || (point == NULL) || | 274 | if ((scalar == NULL) || BN_is_zero(scalar) || (point == NULL) || |
275 | EC_POINT_is_at_infinity(group, point)) { | 275 | EC_POINT_is_at_infinity(group, point) > 0) { |
276 | return EC_POINT_set_to_infinity(group, r); | 276 | return EC_POINT_set_to_infinity(group, r); |
277 | } | 277 | } |
278 | /* only support affine coordinates */ | 278 | /* only support affine coordinates */ |
diff --git a/src/lib/libcrypto/ec/ec2_oct.c b/src/lib/libcrypto/ec/ec2_oct.c index 3b8039af6e..c45d9c2219 100644 --- a/src/lib/libcrypto/ec/ec2_oct.c +++ b/src/lib/libcrypto/ec/ec2_oct.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec2_oct.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ec2_oct.c,v 1.6 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
4 | * | 4 | * |
@@ -183,7 +183,7 @@ ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, | |||
183 | ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_INVALID_FORM); | 183 | ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_INVALID_FORM); |
184 | goto err; | 184 | goto err; |
185 | } | 185 | } |
186 | if (EC_POINT_is_at_infinity(group, point)) { | 186 | if (EC_POINT_is_at_infinity(group, point) > 0) { |
187 | /* encodes to a single 0 octet */ | 187 | /* encodes to a single 0 octet */ |
188 | if (buf != NULL) { | 188 | if (buf != NULL) { |
189 | if (len < 1) { | 189 | if (len < 1) { |
@@ -363,8 +363,8 @@ ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point, | |||
363 | goto err; | 363 | goto err; |
364 | } | 364 | } |
365 | 365 | ||
366 | if (!EC_POINT_is_on_curve(group, point, ctx)) { | 366 | /* test required by X9.62 */ |
367 | /* test required by X9.62 */ | 367 | if (EC_POINT_is_on_curve(group, point, ctx) <= 0) { |
368 | ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_POINT_IS_NOT_ON_CURVE); | 368 | ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_POINT_IS_NOT_ON_CURVE); |
369 | goto err; | 369 | goto err; |
370 | } | 370 | } |
diff --git a/src/lib/libcrypto/ec/ec2_smpl.c b/src/lib/libcrypto/ec/ec2_smpl.c index 0031a161c7..b9c066c5c1 100644 --- a/src/lib/libcrypto/ec/ec2_smpl.c +++ b/src/lib/libcrypto/ec/ec2_smpl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec2_smpl.c,v 1.12 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ec2_smpl.c,v 1.13 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
4 | * | 4 | * |
@@ -413,7 +413,7 @@ ec_GF2m_simple_point_get_affine_coordinates(const EC_GROUP *group, | |||
413 | { | 413 | { |
414 | int ret = 0; | 414 | int ret = 0; |
415 | 415 | ||
416 | if (EC_POINT_is_at_infinity(group, point)) { | 416 | if (EC_POINT_is_at_infinity(group, point) > 0) { |
417 | ECerr(EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES, EC_R_POINT_AT_INFINITY); | 417 | ECerr(EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES, EC_R_POINT_AT_INFINITY); |
418 | return 0; | 418 | return 0; |
419 | } | 419 | } |
@@ -448,12 +448,12 @@ ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | |||
448 | BIGNUM *x0, *y0, *x1, *y1, *x2, *y2, *s, *t; | 448 | BIGNUM *x0, *y0, *x1, *y1, *x2, *y2, *s, *t; |
449 | int ret = 0; | 449 | int ret = 0; |
450 | 450 | ||
451 | if (EC_POINT_is_at_infinity(group, a)) { | 451 | if (EC_POINT_is_at_infinity(group, a) > 0) { |
452 | if (!EC_POINT_copy(r, b)) | 452 | if (!EC_POINT_copy(r, b)) |
453 | return 0; | 453 | return 0; |
454 | return 1; | 454 | return 1; |
455 | } | 455 | } |
456 | if (EC_POINT_is_at_infinity(group, b)) { | 456 | if (EC_POINT_is_at_infinity(group, b) > 0) { |
457 | if (!EC_POINT_copy(r, a)) | 457 | if (!EC_POINT_copy(r, a)) |
458 | return 0; | 458 | return 0; |
459 | return 1; | 459 | return 1; |
@@ -564,7 +564,7 @@ ec_GF2m_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | |||
564 | int | 564 | int |
565 | ec_GF2m_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) | 565 | ec_GF2m_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) |
566 | { | 566 | { |
567 | if (EC_POINT_is_at_infinity(group, point) || BN_is_zero(&point->Y)) | 567 | if (EC_POINT_is_at_infinity(group, point) > 0 || BN_is_zero(&point->Y)) |
568 | /* point is its own inverse */ | 568 | /* point is its own inverse */ |
569 | return 1; | 569 | return 1; |
570 | 570 | ||
@@ -595,7 +595,7 @@ ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX | |||
595 | int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); | 595 | int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); |
596 | int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *); | 596 | int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *); |
597 | 597 | ||
598 | if (EC_POINT_is_at_infinity(group, point)) | 598 | if (EC_POINT_is_at_infinity(group, point) > 0) |
599 | return 1; | 599 | return 1; |
600 | 600 | ||
601 | field_mul = group->meth->field_mul; | 601 | field_mul = group->meth->field_mul; |
@@ -657,10 +657,10 @@ ec_GF2m_simple_cmp(const EC_GROUP * group, const EC_POINT * a, const EC_POINT * | |||
657 | BN_CTX *new_ctx = NULL; | 657 | BN_CTX *new_ctx = NULL; |
658 | int ret = -1; | 658 | int ret = -1; |
659 | 659 | ||
660 | if (EC_POINT_is_at_infinity(group, a)) { | 660 | if (EC_POINT_is_at_infinity(group, a) > 0) { |
661 | return EC_POINT_is_at_infinity(group, b) ? 0 : 1; | 661 | return EC_POINT_is_at_infinity(group, b) > 0 ? 0 : 1; |
662 | } | 662 | } |
663 | if (EC_POINT_is_at_infinity(group, b)) | 663 | if (EC_POINT_is_at_infinity(group, b) > 0) |
664 | return 1; | 664 | return 1; |
665 | 665 | ||
666 | if (a->Z_is_one && b->Z_is_one) { | 666 | if (a->Z_is_one && b->Z_is_one) { |
@@ -701,7 +701,7 @@ ec_GF2m_simple_make_affine(const EC_GROUP * group, EC_POINT * point, BN_CTX * ct | |||
701 | BIGNUM *x, *y; | 701 | BIGNUM *x, *y; |
702 | int ret = 0; | 702 | int ret = 0; |
703 | 703 | ||
704 | if (point->Z_is_one || EC_POINT_is_at_infinity(group, point)) | 704 | if (point->Z_is_one || EC_POINT_is_at_infinity(group, point) > 0) |
705 | return 1; | 705 | return 1; |
706 | 706 | ||
707 | if (ctx == NULL) { | 707 | if (ctx == NULL) { |
diff --git a/src/lib/libcrypto/ec/ec_check.c b/src/lib/libcrypto/ec/ec_check.c index 779e03cc2b..21072305d5 100644 --- a/src/lib/libcrypto/ec/ec_check.c +++ b/src/lib/libcrypto/ec/ec_check.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_check.c,v 1.4 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ec_check.c,v 1.5 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -85,7 +85,7 @@ EC_GROUP_check(const EC_GROUP * group, BN_CTX * ctx) | |||
85 | ECerr(EC_F_EC_GROUP_CHECK, EC_R_UNDEFINED_GENERATOR); | 85 | ECerr(EC_F_EC_GROUP_CHECK, EC_R_UNDEFINED_GENERATOR); |
86 | goto err; | 86 | goto err; |
87 | } | 87 | } |
88 | if (!EC_POINT_is_on_curve(group, group->generator, ctx)) { | 88 | if (EC_POINT_is_on_curve(group, group->generator, ctx) <= 0) { |
89 | ECerr(EC_F_EC_GROUP_CHECK, EC_R_POINT_IS_NOT_ON_CURVE); | 89 | ECerr(EC_F_EC_GROUP_CHECK, EC_R_POINT_IS_NOT_ON_CURVE); |
90 | goto err; | 90 | goto err; |
91 | } | 91 | } |
@@ -100,7 +100,7 @@ EC_GROUP_check(const EC_GROUP * group, BN_CTX * ctx) | |||
100 | } | 100 | } |
101 | if (!EC_POINT_mul(group, point, order, NULL, NULL, ctx)) | 101 | if (!EC_POINT_mul(group, point, order, NULL, NULL, ctx)) |
102 | goto err; | 102 | goto err; |
103 | if (!EC_POINT_is_at_infinity(group, point)) { | 103 | if (EC_POINT_is_at_infinity(group, point) <= 0) { |
104 | ECerr(EC_F_EC_GROUP_CHECK, EC_R_INVALID_GROUP_ORDER); | 104 | ECerr(EC_F_EC_GROUP_CHECK, EC_R_INVALID_GROUP_ORDER); |
105 | goto err; | 105 | goto err; |
106 | } | 106 | } |
diff --git a/src/lib/libcrypto/ec/ec_key.c b/src/lib/libcrypto/ec/ec_key.c index 1154c4dbf5..f9904b4ee9 100644 --- a/src/lib/libcrypto/ec/ec_key.c +++ b/src/lib/libcrypto/ec/ec_key.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_key.c,v 1.9 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ec_key.c,v 1.10 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -277,7 +277,7 @@ EC_KEY_check_key(const EC_KEY * eckey) | |||
277 | ECerr(EC_F_EC_KEY_CHECK_KEY, ERR_R_PASSED_NULL_PARAMETER); | 277 | ECerr(EC_F_EC_KEY_CHECK_KEY, ERR_R_PASSED_NULL_PARAMETER); |
278 | return 0; | 278 | return 0; |
279 | } | 279 | } |
280 | if (EC_POINT_is_at_infinity(eckey->group, eckey->pub_key)) { | 280 | if (EC_POINT_is_at_infinity(eckey->group, eckey->pub_key) > 0) { |
281 | ECerr(EC_F_EC_KEY_CHECK_KEY, EC_R_POINT_AT_INFINITY); | 281 | ECerr(EC_F_EC_KEY_CHECK_KEY, EC_R_POINT_AT_INFINITY); |
282 | goto err; | 282 | goto err; |
283 | } | 283 | } |
@@ -287,7 +287,7 @@ EC_KEY_check_key(const EC_KEY * eckey) | |||
287 | goto err; | 287 | goto err; |
288 | 288 | ||
289 | /* testing whether the pub_key is on the elliptic curve */ | 289 | /* testing whether the pub_key is on the elliptic curve */ |
290 | if (!EC_POINT_is_on_curve(eckey->group, eckey->pub_key, ctx)) { | 290 | if (EC_POINT_is_on_curve(eckey->group, eckey->pub_key, ctx) <= 0) { |
291 | ECerr(EC_F_EC_KEY_CHECK_KEY, EC_R_POINT_IS_NOT_ON_CURVE); | 291 | ECerr(EC_F_EC_KEY_CHECK_KEY, EC_R_POINT_IS_NOT_ON_CURVE); |
292 | goto err; | 292 | goto err; |
293 | } | 293 | } |
@@ -301,7 +301,7 @@ EC_KEY_check_key(const EC_KEY * eckey) | |||
301 | ECerr(EC_F_EC_KEY_CHECK_KEY, ERR_R_EC_LIB); | 301 | ECerr(EC_F_EC_KEY_CHECK_KEY, ERR_R_EC_LIB); |
302 | goto err; | 302 | goto err; |
303 | } | 303 | } |
304 | if (!EC_POINT_is_at_infinity(eckey->group, point)) { | 304 | if (EC_POINT_is_at_infinity(eckey->group, point) <= 0) { |
305 | ECerr(EC_F_EC_KEY_CHECK_KEY, EC_R_WRONG_ORDER); | 305 | ECerr(EC_F_EC_KEY_CHECK_KEY, EC_R_WRONG_ORDER); |
306 | goto err; | 306 | goto err; |
307 | } | 307 | } |
diff --git a/src/lib/libcrypto/ec/ecp_nistp224.c b/src/lib/libcrypto/ec/ecp_nistp224.c index ed0bad2a72..d29113045a 100644 --- a/src/lib/libcrypto/ec/ecp_nistp224.c +++ b/src/lib/libcrypto/ec/ecp_nistp224.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_nistp224.c,v 1.15 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ecp_nistp224.c,v 1.16 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Emilia Kasper (Google) for the OpenSSL project. | 3 | * Written by Emilia Kasper (Google) for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -1298,7 +1298,7 @@ ec_GFp_nistp224_point_get_affine_coordinates(const EC_GROUP * group, | |||
1298 | felem z1, z2, x_in, y_in, x_out, y_out; | 1298 | felem z1, z2, x_in, y_in, x_out, y_out; |
1299 | widefelem tmp; | 1299 | widefelem tmp; |
1300 | 1300 | ||
1301 | if (EC_POINT_is_at_infinity(group, point)) { | 1301 | if (EC_POINT_is_at_infinity(group, point) > 0) { |
1302 | ECerr(EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES, | 1302 | ECerr(EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES, |
1303 | EC_R_POINT_AT_INFINITY); | 1303 | EC_R_POINT_AT_INFINITY); |
1304 | return 0; | 1304 | return 0; |
diff --git a/src/lib/libcrypto/ec/ecp_nistp256.c b/src/lib/libcrypto/ec/ecp_nistp256.c index 6905b614bc..23a2131980 100644 --- a/src/lib/libcrypto/ec/ecp_nistp256.c +++ b/src/lib/libcrypto/ec/ecp_nistp256.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_nistp256.c,v 1.14 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ecp_nistp256.c,v 1.15 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Adam Langley (Google) for the OpenSSL project | 3 | * Written by Adam Langley (Google) for the OpenSSL project |
4 | */ | 4 | */ |
@@ -1848,7 +1848,7 @@ ec_GFp_nistp256_point_get_affine_coordinates(const EC_GROUP * group, | |||
1848 | smallfelem x_out, y_out; | 1848 | smallfelem x_out, y_out; |
1849 | longfelem tmp; | 1849 | longfelem tmp; |
1850 | 1850 | ||
1851 | if (EC_POINT_is_at_infinity(group, point)) { | 1851 | if (EC_POINT_is_at_infinity(group, point) > 0) { |
1852 | ECerr(EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES, | 1852 | ECerr(EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES, |
1853 | EC_R_POINT_AT_INFINITY); | 1853 | EC_R_POINT_AT_INFINITY); |
1854 | return 0; | 1854 | return 0; |
diff --git a/src/lib/libcrypto/ec/ecp_nistp521.c b/src/lib/libcrypto/ec/ecp_nistp521.c index c9313ada8e..6382091cf9 100644 --- a/src/lib/libcrypto/ec/ecp_nistp521.c +++ b/src/lib/libcrypto/ec/ecp_nistp521.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_nistp521.c,v 1.15 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ecp_nistp521.c,v 1.16 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Adam Langley (Google) for the OpenSSL project | 3 | * Written by Adam Langley (Google) for the OpenSSL project |
4 | */ | 4 | */ |
@@ -1738,7 +1738,7 @@ ec_GFp_nistp521_point_get_affine_coordinates(const EC_GROUP * group, | |||
1738 | felem z1, z2, x_in, y_in, x_out, y_out; | 1738 | felem z1, z2, x_in, y_in, x_out, y_out; |
1739 | largefelem tmp; | 1739 | largefelem tmp; |
1740 | 1740 | ||
1741 | if (EC_POINT_is_at_infinity(group, point)) { | 1741 | if (EC_POINT_is_at_infinity(group, point) > 0) { |
1742 | ECerr(EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES, | 1742 | ECerr(EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES, |
1743 | EC_R_POINT_AT_INFINITY); | 1743 | EC_R_POINT_AT_INFINITY); |
1744 | return 0; | 1744 | return 0; |
diff --git a/src/lib/libcrypto/ec/ecp_oct.c b/src/lib/libcrypto/ec/ecp_oct.c index d2402ee0d8..abc31e6382 100644 --- a/src/lib/libcrypto/ec/ecp_oct.c +++ b/src/lib/libcrypto/ec/ecp_oct.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_oct.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ecp_oct.c,v 1.6 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> | 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> |
3 | * for the OpenSSL project. | 3 | * for the OpenSSL project. |
4 | * Includes code written by Bodo Moeller for the OpenSSL project. | 4 | * Includes code written by Bodo Moeller for the OpenSSL project. |
@@ -211,7 +211,7 @@ ec_GFp_simple_point2oct(const EC_GROUP * group, const EC_POINT * point, point_co | |||
211 | ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_INVALID_FORM); | 211 | ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_INVALID_FORM); |
212 | goto err; | 212 | goto err; |
213 | } | 213 | } |
214 | if (EC_POINT_is_at_infinity(group, point)) { | 214 | if (EC_POINT_is_at_infinity(group, point) > 0) { |
215 | /* encodes to a single 0 octet */ | 215 | /* encodes to a single 0 octet */ |
216 | if (buf != NULL) { | 216 | if (buf != NULL) { |
217 | if (len < 1) { | 217 | if (len < 1) { |
@@ -379,8 +379,8 @@ ec_GFp_simple_oct2point(const EC_GROUP * group, EC_POINT * point, | |||
379 | goto err; | 379 | goto err; |
380 | } | 380 | } |
381 | 381 | ||
382 | if (!EC_POINT_is_on_curve(group, point, ctx)) { /* test required by | 382 | /* test required by X9.62 */ |
383 | * X9.62 */ | 383 | if (EC_POINT_is_on_curve(group, point, ctx) <= 0) { |
384 | ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_POINT_IS_NOT_ON_CURVE); | 384 | ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_POINT_IS_NOT_ON_CURVE); |
385 | goto err; | 385 | goto err; |
386 | } | 386 | } |
diff --git a/src/lib/libcrypto/ec/ecp_smpl.c b/src/lib/libcrypto/ec/ecp_smpl.c index dabc5af899..7b3bb2364d 100644 --- a/src/lib/libcrypto/ec/ecp_smpl.c +++ b/src/lib/libcrypto/ec/ecp_smpl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_smpl.c,v 1.13 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ecp_smpl.c,v 1.14 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> | 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> |
3 | * for the OpenSSL project. | 3 | * for the OpenSSL project. |
4 | * Includes code written by Bodo Moeller for the OpenSSL project. | 4 | * Includes code written by Bodo Moeller for the OpenSSL project. |
@@ -529,7 +529,7 @@ ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP * group, const EC_POIN | |||
529 | const BIGNUM *Z_; | 529 | const BIGNUM *Z_; |
530 | int ret = 0; | 530 | int ret = 0; |
531 | 531 | ||
532 | if (EC_POINT_is_at_infinity(group, point)) { | 532 | if (EC_POINT_is_at_infinity(group, point) > 0) { |
533 | ECerr(EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES, EC_R_POINT_AT_INFINITY); | 533 | ECerr(EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES, EC_R_POINT_AT_INFINITY); |
534 | return 0; | 534 | return 0; |
535 | } | 535 | } |
@@ -637,9 +637,9 @@ ec_GFp_simple_add(const EC_GROUP * group, EC_POINT * r, const EC_POINT * a, cons | |||
637 | 637 | ||
638 | if (a == b) | 638 | if (a == b) |
639 | return EC_POINT_dbl(group, r, a, ctx); | 639 | return EC_POINT_dbl(group, r, a, ctx); |
640 | if (EC_POINT_is_at_infinity(group, a)) | 640 | if (EC_POINT_is_at_infinity(group, a) > 0) |
641 | return EC_POINT_copy(r, b); | 641 | return EC_POINT_copy(r, b); |
642 | if (EC_POINT_is_at_infinity(group, b)) | 642 | if (EC_POINT_is_at_infinity(group, b) > 0) |
643 | return EC_POINT_copy(r, a); | 643 | return EC_POINT_copy(r, a); |
644 | 644 | ||
645 | field_mul = group->meth->field_mul; | 645 | field_mul = group->meth->field_mul; |
@@ -819,7 +819,7 @@ ec_GFp_simple_dbl(const EC_GROUP * group, EC_POINT * r, const EC_POINT * a, BN_C | |||
819 | BIGNUM *n0, *n1, *n2, *n3; | 819 | BIGNUM *n0, *n1, *n2, *n3; |
820 | int ret = 0; | 820 | int ret = 0; |
821 | 821 | ||
822 | if (EC_POINT_is_at_infinity(group, a)) { | 822 | if (EC_POINT_is_at_infinity(group, a) > 0) { |
823 | BN_zero(&r->Z); | 823 | BN_zero(&r->Z); |
824 | r->Z_is_one = 0; | 824 | r->Z_is_one = 0; |
825 | return 1; | 825 | return 1; |
@@ -952,7 +952,7 @@ err: | |||
952 | int | 952 | int |
953 | ec_GFp_simple_invert(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx) | 953 | ec_GFp_simple_invert(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx) |
954 | { | 954 | { |
955 | if (EC_POINT_is_at_infinity(group, point) || BN_is_zero(&point->Y)) | 955 | if (EC_POINT_is_at_infinity(group, point) > 0 || BN_is_zero(&point->Y)) |
956 | /* point is its own inverse */ | 956 | /* point is its own inverse */ |
957 | return 1; | 957 | return 1; |
958 | 958 | ||
@@ -977,7 +977,7 @@ ec_GFp_simple_is_on_curve(const EC_GROUP * group, const EC_POINT * point, BN_CTX | |||
977 | BIGNUM *rh, *tmp, *Z4, *Z6; | 977 | BIGNUM *rh, *tmp, *Z4, *Z6; |
978 | int ret = -1; | 978 | int ret = -1; |
979 | 979 | ||
980 | if (EC_POINT_is_at_infinity(group, point)) | 980 | if (EC_POINT_is_at_infinity(group, point) > 0) |
981 | return 1; | 981 | return 1; |
982 | 982 | ||
983 | field_mul = group->meth->field_mul; | 983 | field_mul = group->meth->field_mul; |
@@ -1083,10 +1083,10 @@ ec_GFp_simple_cmp(const EC_GROUP * group, const EC_POINT * a, const EC_POINT * b | |||
1083 | const BIGNUM *tmp1_, *tmp2_; | 1083 | const BIGNUM *tmp1_, *tmp2_; |
1084 | int ret = -1; | 1084 | int ret = -1; |
1085 | 1085 | ||
1086 | if (EC_POINT_is_at_infinity(group, a)) { | 1086 | if (EC_POINT_is_at_infinity(group, a) > 0) { |
1087 | return EC_POINT_is_at_infinity(group, b) ? 0 : 1; | 1087 | return EC_POINT_is_at_infinity(group, b) > 0 ? 0 : 1; |
1088 | } | 1088 | } |
1089 | if (EC_POINT_is_at_infinity(group, b)) | 1089 | if (EC_POINT_is_at_infinity(group, b) > 0) |
1090 | return 1; | 1090 | return 1; |
1091 | 1091 | ||
1092 | if (a->Z_is_one && b->Z_is_one) { | 1092 | if (a->Z_is_one && b->Z_is_one) { |
@@ -1175,7 +1175,7 @@ ec_GFp_simple_make_affine(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx | |||
1175 | BIGNUM *x, *y; | 1175 | BIGNUM *x, *y; |
1176 | int ret = 0; | 1176 | int ret = 0; |
1177 | 1177 | ||
1178 | if (point->Z_is_one || EC_POINT_is_at_infinity(group, point)) | 1178 | if (point->Z_is_one || EC_POINT_is_at_infinity(group, point) > 0) |
1179 | return 1; | 1179 | return 1; |
1180 | 1180 | ||
1181 | if (ctx == NULL) { | 1181 | if (ctx == NULL) { |
diff --git a/src/lib/libssl/src/crypto/ec/ec2_mult.c b/src/lib/libssl/src/crypto/ec/ec2_mult.c index c74571f88c..dd113907be 100644 --- a/src/lib/libssl/src/crypto/ec/ec2_mult.c +++ b/src/lib/libssl/src/crypto/ec/ec2_mult.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec2_mult.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ec2_mult.c,v 1.6 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
4 | * | 4 | * |
@@ -272,7 +272,7 @@ ec_GF2m_montgomery_point_multiply(const EC_GROUP *group, EC_POINT *r, | |||
272 | } | 272 | } |
273 | /* if result should be point at infinity */ | 273 | /* if result should be point at infinity */ |
274 | if ((scalar == NULL) || BN_is_zero(scalar) || (point == NULL) || | 274 | if ((scalar == NULL) || BN_is_zero(scalar) || (point == NULL) || |
275 | EC_POINT_is_at_infinity(group, point)) { | 275 | EC_POINT_is_at_infinity(group, point) > 0) { |
276 | return EC_POINT_set_to_infinity(group, r); | 276 | return EC_POINT_set_to_infinity(group, r); |
277 | } | 277 | } |
278 | /* only support affine coordinates */ | 278 | /* only support affine coordinates */ |
diff --git a/src/lib/libssl/src/crypto/ec/ec2_oct.c b/src/lib/libssl/src/crypto/ec/ec2_oct.c index 3b8039af6e..c45d9c2219 100644 --- a/src/lib/libssl/src/crypto/ec/ec2_oct.c +++ b/src/lib/libssl/src/crypto/ec/ec2_oct.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec2_oct.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ec2_oct.c,v 1.6 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
4 | * | 4 | * |
@@ -183,7 +183,7 @@ ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, | |||
183 | ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_INVALID_FORM); | 183 | ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_INVALID_FORM); |
184 | goto err; | 184 | goto err; |
185 | } | 185 | } |
186 | if (EC_POINT_is_at_infinity(group, point)) { | 186 | if (EC_POINT_is_at_infinity(group, point) > 0) { |
187 | /* encodes to a single 0 octet */ | 187 | /* encodes to a single 0 octet */ |
188 | if (buf != NULL) { | 188 | if (buf != NULL) { |
189 | if (len < 1) { | 189 | if (len < 1) { |
@@ -363,8 +363,8 @@ ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point, | |||
363 | goto err; | 363 | goto err; |
364 | } | 364 | } |
365 | 365 | ||
366 | if (!EC_POINT_is_on_curve(group, point, ctx)) { | 366 | /* test required by X9.62 */ |
367 | /* test required by X9.62 */ | 367 | if (EC_POINT_is_on_curve(group, point, ctx) <= 0) { |
368 | ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_POINT_IS_NOT_ON_CURVE); | 368 | ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_POINT_IS_NOT_ON_CURVE); |
369 | goto err; | 369 | goto err; |
370 | } | 370 | } |
diff --git a/src/lib/libssl/src/crypto/ec/ec2_smpl.c b/src/lib/libssl/src/crypto/ec/ec2_smpl.c index 0031a161c7..b9c066c5c1 100644 --- a/src/lib/libssl/src/crypto/ec/ec2_smpl.c +++ b/src/lib/libssl/src/crypto/ec/ec2_smpl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec2_smpl.c,v 1.12 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ec2_smpl.c,v 1.13 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
4 | * | 4 | * |
@@ -413,7 +413,7 @@ ec_GF2m_simple_point_get_affine_coordinates(const EC_GROUP *group, | |||
413 | { | 413 | { |
414 | int ret = 0; | 414 | int ret = 0; |
415 | 415 | ||
416 | if (EC_POINT_is_at_infinity(group, point)) { | 416 | if (EC_POINT_is_at_infinity(group, point) > 0) { |
417 | ECerr(EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES, EC_R_POINT_AT_INFINITY); | 417 | ECerr(EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES, EC_R_POINT_AT_INFINITY); |
418 | return 0; | 418 | return 0; |
419 | } | 419 | } |
@@ -448,12 +448,12 @@ ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | |||
448 | BIGNUM *x0, *y0, *x1, *y1, *x2, *y2, *s, *t; | 448 | BIGNUM *x0, *y0, *x1, *y1, *x2, *y2, *s, *t; |
449 | int ret = 0; | 449 | int ret = 0; |
450 | 450 | ||
451 | if (EC_POINT_is_at_infinity(group, a)) { | 451 | if (EC_POINT_is_at_infinity(group, a) > 0) { |
452 | if (!EC_POINT_copy(r, b)) | 452 | if (!EC_POINT_copy(r, b)) |
453 | return 0; | 453 | return 0; |
454 | return 1; | 454 | return 1; |
455 | } | 455 | } |
456 | if (EC_POINT_is_at_infinity(group, b)) { | 456 | if (EC_POINT_is_at_infinity(group, b) > 0) { |
457 | if (!EC_POINT_copy(r, a)) | 457 | if (!EC_POINT_copy(r, a)) |
458 | return 0; | 458 | return 0; |
459 | return 1; | 459 | return 1; |
@@ -564,7 +564,7 @@ ec_GF2m_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | |||
564 | int | 564 | int |
565 | ec_GF2m_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) | 565 | ec_GF2m_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) |
566 | { | 566 | { |
567 | if (EC_POINT_is_at_infinity(group, point) || BN_is_zero(&point->Y)) | 567 | if (EC_POINT_is_at_infinity(group, point) > 0 || BN_is_zero(&point->Y)) |
568 | /* point is its own inverse */ | 568 | /* point is its own inverse */ |
569 | return 1; | 569 | return 1; |
570 | 570 | ||
@@ -595,7 +595,7 @@ ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX | |||
595 | int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); | 595 | int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); |
596 | int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *); | 596 | int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *); |
597 | 597 | ||
598 | if (EC_POINT_is_at_infinity(group, point)) | 598 | if (EC_POINT_is_at_infinity(group, point) > 0) |
599 | return 1; | 599 | return 1; |
600 | 600 | ||
601 | field_mul = group->meth->field_mul; | 601 | field_mul = group->meth->field_mul; |
@@ -657,10 +657,10 @@ ec_GF2m_simple_cmp(const EC_GROUP * group, const EC_POINT * a, const EC_POINT * | |||
657 | BN_CTX *new_ctx = NULL; | 657 | BN_CTX *new_ctx = NULL; |
658 | int ret = -1; | 658 | int ret = -1; |
659 | 659 | ||
660 | if (EC_POINT_is_at_infinity(group, a)) { | 660 | if (EC_POINT_is_at_infinity(group, a) > 0) { |
661 | return EC_POINT_is_at_infinity(group, b) ? 0 : 1; | 661 | return EC_POINT_is_at_infinity(group, b) > 0 ? 0 : 1; |
662 | } | 662 | } |
663 | if (EC_POINT_is_at_infinity(group, b)) | 663 | if (EC_POINT_is_at_infinity(group, b) > 0) |
664 | return 1; | 664 | return 1; |
665 | 665 | ||
666 | if (a->Z_is_one && b->Z_is_one) { | 666 | if (a->Z_is_one && b->Z_is_one) { |
@@ -701,7 +701,7 @@ ec_GF2m_simple_make_affine(const EC_GROUP * group, EC_POINT * point, BN_CTX * ct | |||
701 | BIGNUM *x, *y; | 701 | BIGNUM *x, *y; |
702 | int ret = 0; | 702 | int ret = 0; |
703 | 703 | ||
704 | if (point->Z_is_one || EC_POINT_is_at_infinity(group, point)) | 704 | if (point->Z_is_one || EC_POINT_is_at_infinity(group, point) > 0) |
705 | return 1; | 705 | return 1; |
706 | 706 | ||
707 | if (ctx == NULL) { | 707 | if (ctx == NULL) { |
diff --git a/src/lib/libssl/src/crypto/ec/ec_check.c b/src/lib/libssl/src/crypto/ec/ec_check.c index 779e03cc2b..21072305d5 100644 --- a/src/lib/libssl/src/crypto/ec/ec_check.c +++ b/src/lib/libssl/src/crypto/ec/ec_check.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_check.c,v 1.4 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ec_check.c,v 1.5 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -85,7 +85,7 @@ EC_GROUP_check(const EC_GROUP * group, BN_CTX * ctx) | |||
85 | ECerr(EC_F_EC_GROUP_CHECK, EC_R_UNDEFINED_GENERATOR); | 85 | ECerr(EC_F_EC_GROUP_CHECK, EC_R_UNDEFINED_GENERATOR); |
86 | goto err; | 86 | goto err; |
87 | } | 87 | } |
88 | if (!EC_POINT_is_on_curve(group, group->generator, ctx)) { | 88 | if (EC_POINT_is_on_curve(group, group->generator, ctx) <= 0) { |
89 | ECerr(EC_F_EC_GROUP_CHECK, EC_R_POINT_IS_NOT_ON_CURVE); | 89 | ECerr(EC_F_EC_GROUP_CHECK, EC_R_POINT_IS_NOT_ON_CURVE); |
90 | goto err; | 90 | goto err; |
91 | } | 91 | } |
@@ -100,7 +100,7 @@ EC_GROUP_check(const EC_GROUP * group, BN_CTX * ctx) | |||
100 | } | 100 | } |
101 | if (!EC_POINT_mul(group, point, order, NULL, NULL, ctx)) | 101 | if (!EC_POINT_mul(group, point, order, NULL, NULL, ctx)) |
102 | goto err; | 102 | goto err; |
103 | if (!EC_POINT_is_at_infinity(group, point)) { | 103 | if (EC_POINT_is_at_infinity(group, point) <= 0) { |
104 | ECerr(EC_F_EC_GROUP_CHECK, EC_R_INVALID_GROUP_ORDER); | 104 | ECerr(EC_F_EC_GROUP_CHECK, EC_R_INVALID_GROUP_ORDER); |
105 | goto err; | 105 | goto err; |
106 | } | 106 | } |
diff --git a/src/lib/libssl/src/crypto/ec/ec_key.c b/src/lib/libssl/src/crypto/ec/ec_key.c index 1154c4dbf5..f9904b4ee9 100644 --- a/src/lib/libssl/src/crypto/ec/ec_key.c +++ b/src/lib/libssl/src/crypto/ec/ec_key.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_key.c,v 1.9 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ec_key.c,v 1.10 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -277,7 +277,7 @@ EC_KEY_check_key(const EC_KEY * eckey) | |||
277 | ECerr(EC_F_EC_KEY_CHECK_KEY, ERR_R_PASSED_NULL_PARAMETER); | 277 | ECerr(EC_F_EC_KEY_CHECK_KEY, ERR_R_PASSED_NULL_PARAMETER); |
278 | return 0; | 278 | return 0; |
279 | } | 279 | } |
280 | if (EC_POINT_is_at_infinity(eckey->group, eckey->pub_key)) { | 280 | if (EC_POINT_is_at_infinity(eckey->group, eckey->pub_key) > 0) { |
281 | ECerr(EC_F_EC_KEY_CHECK_KEY, EC_R_POINT_AT_INFINITY); | 281 | ECerr(EC_F_EC_KEY_CHECK_KEY, EC_R_POINT_AT_INFINITY); |
282 | goto err; | 282 | goto err; |
283 | } | 283 | } |
@@ -287,7 +287,7 @@ EC_KEY_check_key(const EC_KEY * eckey) | |||
287 | goto err; | 287 | goto err; |
288 | 288 | ||
289 | /* testing whether the pub_key is on the elliptic curve */ | 289 | /* testing whether the pub_key is on the elliptic curve */ |
290 | if (!EC_POINT_is_on_curve(eckey->group, eckey->pub_key, ctx)) { | 290 | if (EC_POINT_is_on_curve(eckey->group, eckey->pub_key, ctx) <= 0) { |
291 | ECerr(EC_F_EC_KEY_CHECK_KEY, EC_R_POINT_IS_NOT_ON_CURVE); | 291 | ECerr(EC_F_EC_KEY_CHECK_KEY, EC_R_POINT_IS_NOT_ON_CURVE); |
292 | goto err; | 292 | goto err; |
293 | } | 293 | } |
@@ -301,7 +301,7 @@ EC_KEY_check_key(const EC_KEY * eckey) | |||
301 | ECerr(EC_F_EC_KEY_CHECK_KEY, ERR_R_EC_LIB); | 301 | ECerr(EC_F_EC_KEY_CHECK_KEY, ERR_R_EC_LIB); |
302 | goto err; | 302 | goto err; |
303 | } | 303 | } |
304 | if (!EC_POINT_is_at_infinity(eckey->group, point)) { | 304 | if (EC_POINT_is_at_infinity(eckey->group, point) <= 0) { |
305 | ECerr(EC_F_EC_KEY_CHECK_KEY, EC_R_WRONG_ORDER); | 305 | ECerr(EC_F_EC_KEY_CHECK_KEY, EC_R_WRONG_ORDER); |
306 | goto err; | 306 | goto err; |
307 | } | 307 | } |
diff --git a/src/lib/libssl/src/crypto/ec/ecp_nistp224.c b/src/lib/libssl/src/crypto/ec/ecp_nistp224.c index ed0bad2a72..d29113045a 100644 --- a/src/lib/libssl/src/crypto/ec/ecp_nistp224.c +++ b/src/lib/libssl/src/crypto/ec/ecp_nistp224.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_nistp224.c,v 1.15 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ecp_nistp224.c,v 1.16 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Emilia Kasper (Google) for the OpenSSL project. | 3 | * Written by Emilia Kasper (Google) for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -1298,7 +1298,7 @@ ec_GFp_nistp224_point_get_affine_coordinates(const EC_GROUP * group, | |||
1298 | felem z1, z2, x_in, y_in, x_out, y_out; | 1298 | felem z1, z2, x_in, y_in, x_out, y_out; |
1299 | widefelem tmp; | 1299 | widefelem tmp; |
1300 | 1300 | ||
1301 | if (EC_POINT_is_at_infinity(group, point)) { | 1301 | if (EC_POINT_is_at_infinity(group, point) > 0) { |
1302 | ECerr(EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES, | 1302 | ECerr(EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES, |
1303 | EC_R_POINT_AT_INFINITY); | 1303 | EC_R_POINT_AT_INFINITY); |
1304 | return 0; | 1304 | return 0; |
diff --git a/src/lib/libssl/src/crypto/ec/ecp_nistp256.c b/src/lib/libssl/src/crypto/ec/ecp_nistp256.c index 6905b614bc..23a2131980 100644 --- a/src/lib/libssl/src/crypto/ec/ecp_nistp256.c +++ b/src/lib/libssl/src/crypto/ec/ecp_nistp256.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_nistp256.c,v 1.14 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ecp_nistp256.c,v 1.15 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Adam Langley (Google) for the OpenSSL project | 3 | * Written by Adam Langley (Google) for the OpenSSL project |
4 | */ | 4 | */ |
@@ -1848,7 +1848,7 @@ ec_GFp_nistp256_point_get_affine_coordinates(const EC_GROUP * group, | |||
1848 | smallfelem x_out, y_out; | 1848 | smallfelem x_out, y_out; |
1849 | longfelem tmp; | 1849 | longfelem tmp; |
1850 | 1850 | ||
1851 | if (EC_POINT_is_at_infinity(group, point)) { | 1851 | if (EC_POINT_is_at_infinity(group, point) > 0) { |
1852 | ECerr(EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES, | 1852 | ECerr(EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES, |
1853 | EC_R_POINT_AT_INFINITY); | 1853 | EC_R_POINT_AT_INFINITY); |
1854 | return 0; | 1854 | return 0; |
diff --git a/src/lib/libssl/src/crypto/ec/ecp_nistp521.c b/src/lib/libssl/src/crypto/ec/ecp_nistp521.c index c9313ada8e..6382091cf9 100644 --- a/src/lib/libssl/src/crypto/ec/ecp_nistp521.c +++ b/src/lib/libssl/src/crypto/ec/ecp_nistp521.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_nistp521.c,v 1.15 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ecp_nistp521.c,v 1.16 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Adam Langley (Google) for the OpenSSL project | 3 | * Written by Adam Langley (Google) for the OpenSSL project |
4 | */ | 4 | */ |
@@ -1738,7 +1738,7 @@ ec_GFp_nistp521_point_get_affine_coordinates(const EC_GROUP * group, | |||
1738 | felem z1, z2, x_in, y_in, x_out, y_out; | 1738 | felem z1, z2, x_in, y_in, x_out, y_out; |
1739 | largefelem tmp; | 1739 | largefelem tmp; |
1740 | 1740 | ||
1741 | if (EC_POINT_is_at_infinity(group, point)) { | 1741 | if (EC_POINT_is_at_infinity(group, point) > 0) { |
1742 | ECerr(EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES, | 1742 | ECerr(EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES, |
1743 | EC_R_POINT_AT_INFINITY); | 1743 | EC_R_POINT_AT_INFINITY); |
1744 | return 0; | 1744 | return 0; |
diff --git a/src/lib/libssl/src/crypto/ec/ecp_oct.c b/src/lib/libssl/src/crypto/ec/ecp_oct.c index d2402ee0d8..abc31e6382 100644 --- a/src/lib/libssl/src/crypto/ec/ecp_oct.c +++ b/src/lib/libssl/src/crypto/ec/ecp_oct.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_oct.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ecp_oct.c,v 1.6 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> | 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> |
3 | * for the OpenSSL project. | 3 | * for the OpenSSL project. |
4 | * Includes code written by Bodo Moeller for the OpenSSL project. | 4 | * Includes code written by Bodo Moeller for the OpenSSL project. |
@@ -211,7 +211,7 @@ ec_GFp_simple_point2oct(const EC_GROUP * group, const EC_POINT * point, point_co | |||
211 | ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_INVALID_FORM); | 211 | ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_INVALID_FORM); |
212 | goto err; | 212 | goto err; |
213 | } | 213 | } |
214 | if (EC_POINT_is_at_infinity(group, point)) { | 214 | if (EC_POINT_is_at_infinity(group, point) > 0) { |
215 | /* encodes to a single 0 octet */ | 215 | /* encodes to a single 0 octet */ |
216 | if (buf != NULL) { | 216 | if (buf != NULL) { |
217 | if (len < 1) { | 217 | if (len < 1) { |
@@ -379,8 +379,8 @@ ec_GFp_simple_oct2point(const EC_GROUP * group, EC_POINT * point, | |||
379 | goto err; | 379 | goto err; |
380 | } | 380 | } |
381 | 381 | ||
382 | if (!EC_POINT_is_on_curve(group, point, ctx)) { /* test required by | 382 | /* test required by X9.62 */ |
383 | * X9.62 */ | 383 | if (EC_POINT_is_on_curve(group, point, ctx) <= 0) { |
384 | ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_POINT_IS_NOT_ON_CURVE); | 384 | ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_POINT_IS_NOT_ON_CURVE); |
385 | goto err; | 385 | goto err; |
386 | } | 386 | } |
diff --git a/src/lib/libssl/src/crypto/ec/ecp_smpl.c b/src/lib/libssl/src/crypto/ec/ecp_smpl.c index dabc5af899..7b3bb2364d 100644 --- a/src/lib/libssl/src/crypto/ec/ecp_smpl.c +++ b/src/lib/libssl/src/crypto/ec/ecp_smpl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_smpl.c,v 1.13 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ecp_smpl.c,v 1.14 2015/02/08 22:25:03 miod Exp $ */ |
2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> | 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> |
3 | * for the OpenSSL project. | 3 | * for the OpenSSL project. |
4 | * Includes code written by Bodo Moeller for the OpenSSL project. | 4 | * Includes code written by Bodo Moeller for the OpenSSL project. |
@@ -529,7 +529,7 @@ ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP * group, const EC_POIN | |||
529 | const BIGNUM *Z_; | 529 | const BIGNUM *Z_; |
530 | int ret = 0; | 530 | int ret = 0; |
531 | 531 | ||
532 | if (EC_POINT_is_at_infinity(group, point)) { | 532 | if (EC_POINT_is_at_infinity(group, point) > 0) { |
533 | ECerr(EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES, EC_R_POINT_AT_INFINITY); | 533 | ECerr(EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES, EC_R_POINT_AT_INFINITY); |
534 | return 0; | 534 | return 0; |
535 | } | 535 | } |
@@ -637,9 +637,9 @@ ec_GFp_simple_add(const EC_GROUP * group, EC_POINT * r, const EC_POINT * a, cons | |||
637 | 637 | ||
638 | if (a == b) | 638 | if (a == b) |
639 | return EC_POINT_dbl(group, r, a, ctx); | 639 | return EC_POINT_dbl(group, r, a, ctx); |
640 | if (EC_POINT_is_at_infinity(group, a)) | 640 | if (EC_POINT_is_at_infinity(group, a) > 0) |
641 | return EC_POINT_copy(r, b); | 641 | return EC_POINT_copy(r, b); |
642 | if (EC_POINT_is_at_infinity(group, b)) | 642 | if (EC_POINT_is_at_infinity(group, b) > 0) |
643 | return EC_POINT_copy(r, a); | 643 | return EC_POINT_copy(r, a); |
644 | 644 | ||
645 | field_mul = group->meth->field_mul; | 645 | field_mul = group->meth->field_mul; |
@@ -819,7 +819,7 @@ ec_GFp_simple_dbl(const EC_GROUP * group, EC_POINT * r, const EC_POINT * a, BN_C | |||
819 | BIGNUM *n0, *n1, *n2, *n3; | 819 | BIGNUM *n0, *n1, *n2, *n3; |
820 | int ret = 0; | 820 | int ret = 0; |
821 | 821 | ||
822 | if (EC_POINT_is_at_infinity(group, a)) { | 822 | if (EC_POINT_is_at_infinity(group, a) > 0) { |
823 | BN_zero(&r->Z); | 823 | BN_zero(&r->Z); |
824 | r->Z_is_one = 0; | 824 | r->Z_is_one = 0; |
825 | return 1; | 825 | return 1; |
@@ -952,7 +952,7 @@ err: | |||
952 | int | 952 | int |
953 | ec_GFp_simple_invert(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx) | 953 | ec_GFp_simple_invert(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx) |
954 | { | 954 | { |
955 | if (EC_POINT_is_at_infinity(group, point) || BN_is_zero(&point->Y)) | 955 | if (EC_POINT_is_at_infinity(group, point) > 0 || BN_is_zero(&point->Y)) |
956 | /* point is its own inverse */ | 956 | /* point is its own inverse */ |
957 | return 1; | 957 | return 1; |
958 | 958 | ||
@@ -977,7 +977,7 @@ ec_GFp_simple_is_on_curve(const EC_GROUP * group, const EC_POINT * point, BN_CTX | |||
977 | BIGNUM *rh, *tmp, *Z4, *Z6; | 977 | BIGNUM *rh, *tmp, *Z4, *Z6; |
978 | int ret = -1; | 978 | int ret = -1; |
979 | 979 | ||
980 | if (EC_POINT_is_at_infinity(group, point)) | 980 | if (EC_POINT_is_at_infinity(group, point) > 0) |
981 | return 1; | 981 | return 1; |
982 | 982 | ||
983 | field_mul = group->meth->field_mul; | 983 | field_mul = group->meth->field_mul; |
@@ -1083,10 +1083,10 @@ ec_GFp_simple_cmp(const EC_GROUP * group, const EC_POINT * a, const EC_POINT * b | |||
1083 | const BIGNUM *tmp1_, *tmp2_; | 1083 | const BIGNUM *tmp1_, *tmp2_; |
1084 | int ret = -1; | 1084 | int ret = -1; |
1085 | 1085 | ||
1086 | if (EC_POINT_is_at_infinity(group, a)) { | 1086 | if (EC_POINT_is_at_infinity(group, a) > 0) { |
1087 | return EC_POINT_is_at_infinity(group, b) ? 0 : 1; | 1087 | return EC_POINT_is_at_infinity(group, b) > 0 ? 0 : 1; |
1088 | } | 1088 | } |
1089 | if (EC_POINT_is_at_infinity(group, b)) | 1089 | if (EC_POINT_is_at_infinity(group, b) > 0) |
1090 | return 1; | 1090 | return 1; |
1091 | 1091 | ||
1092 | if (a->Z_is_one && b->Z_is_one) { | 1092 | if (a->Z_is_one && b->Z_is_one) { |
@@ -1175,7 +1175,7 @@ ec_GFp_simple_make_affine(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx | |||
1175 | BIGNUM *x, *y; | 1175 | BIGNUM *x, *y; |
1176 | int ret = 0; | 1176 | int ret = 0; |
1177 | 1177 | ||
1178 | if (point->Z_is_one || EC_POINT_is_at_infinity(group, point)) | 1178 | if (point->Z_is_one || EC_POINT_is_at_infinity(group, point) > 0) |
1179 | return 1; | 1179 | return 1; |
1180 | 1180 | ||
1181 | if (ctx == NULL) { | 1181 | if (ctx == NULL) { |