diff options
| author | tb <> | 2023-07-24 17:08:53 +0000 |
|---|---|---|
| committer | tb <> | 2023-07-24 17:08:53 +0000 |
| commit | c2fc234286c75d942a62891333f85e824d615444 (patch) | |
| tree | 7ef949af6dc29489e88241903a74fe50c6f195c1 /src | |
| parent | 4f6ff7284de44c23d500a00c75dbacdffeb73d57 (diff) | |
| download | openbsd-c2fc234286c75d942a62891333f85e824d615444.tar.gz openbsd-c2fc234286c75d942a62891333f85e824d615444.tar.bz2 openbsd-c2fc234286c75d942a62891333f85e824d615444.zip | |
Fix two EC_POINT_is_on_curve() checks
This API can fail for various reasons, in which case it returns -1, so
you need to check if (EC_POINT_is_on_curve_checks(...) <= 0).
ok miod
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/ecdh/ecdh.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/gost/gostr341001_key.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libcrypto/ecdh/ecdh.c b/src/lib/libcrypto/ecdh/ecdh.c index ecb849c135..6ab4ff8382 100644 --- a/src/lib/libcrypto/ecdh/ecdh.c +++ b/src/lib/libcrypto/ecdh/ecdh.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecdh.c,v 1.5 2023/07/12 08:54:18 tb Exp $ */ | 1 | /* $OpenBSD: ecdh.c,v 1.6 2023/07/24 17:08:53 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
| 4 | * | 4 | * |
| @@ -176,7 +176,7 @@ ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh | |||
| 176 | if ((group = EC_KEY_get0_group(ecdh)) == NULL) | 176 | if ((group = EC_KEY_get0_group(ecdh)) == NULL) |
| 177 | goto err; | 177 | goto err; |
| 178 | 178 | ||
| 179 | if (!EC_POINT_is_on_curve(group, pub_key, ctx)) | 179 | if (EC_POINT_is_on_curve(group, pub_key, ctx) <= 0) |
| 180 | goto err; | 180 | goto err; |
| 181 | 181 | ||
| 182 | if ((point = EC_POINT_new(group)) == NULL) { | 182 | if ((point = EC_POINT_new(group)) == NULL) { |
diff --git a/src/lib/libcrypto/gost/gostr341001_key.c b/src/lib/libcrypto/gost/gostr341001_key.c index efc9e57452..0170ab44ba 100644 --- a/src/lib/libcrypto/gost/gostr341001_key.c +++ b/src/lib/libcrypto/gost/gostr341001_key.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: gostr341001_key.c,v 1.13 2023/07/08 14:30:44 beck Exp $ */ | 1 | /* $OpenBSD: gostr341001_key.c,v 1.14 2023/07/24 17:08:53 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
| 4 | * Copyright (c) 2005-2006 Cryptocom LTD | 4 | * Copyright (c) 2005-2006 Cryptocom LTD |
| @@ -132,7 +132,7 @@ GOST_KEY_check_key(const GOST_KEY *key) | |||
| 132 | goto err; | 132 | goto err; |
| 133 | 133 | ||
| 134 | /* testing whether the pub_key is on the elliptic curve */ | 134 | /* testing whether the pub_key is on the elliptic curve */ |
| 135 | if (EC_POINT_is_on_curve(key->group, key->pub_key, ctx) == 0) { | 135 | if (EC_POINT_is_on_curve(key->group, key->pub_key, ctx) <= 0) { |
| 136 | GOSTerror(EC_R_POINT_IS_NOT_ON_CURVE); | 136 | GOSTerror(EC_R_POINT_IS_NOT_ON_CURVE); |
| 137 | goto err; | 137 | goto err; |
| 138 | } | 138 | } |
