diff options
| author | tb <> | 2021-04-20 17:23:37 +0000 | 
|---|---|---|
| committer | tb <> | 2021-04-20 17:23:37 +0000 | 
| commit | 51b396b145b6146bbdaac4d315068130e31179df (patch) | |
| tree | 2d01b94789dd9feb10bf48a12e3b8d831acb2076 /src/lib/libcrypto/ecdsa/ecs_ossl.c | |
| parent | 5f2ad2960e319e05435e4f8879af926660a5079f (diff) | |
| download | openbsd-51b396b145b6146bbdaac4d315068130e31179df.tar.gz openbsd-51b396b145b6146bbdaac4d315068130e31179df.tar.bz2 openbsd-51b396b145b6146bbdaac4d315068130e31179df.zip | |
Simplify code after adding EC_POINT_{s,g}et_affine_coordinates()
ok jsing
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/ecdsa/ecs_ossl.c | 41 | 
1 files changed, 8 insertions, 33 deletions
| diff --git a/src/lib/libcrypto/ecdsa/ecs_ossl.c b/src/lib/libcrypto/ecdsa/ecs_ossl.c index aa97a3ad73..e7e7a52665 100644 --- a/src/lib/libcrypto/ecdsa/ecs_ossl.c +++ b/src/lib/libcrypto/ecdsa/ecs_ossl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecs_ossl.c,v 1.21 2021/04/20 17:16:38 tb Exp $ */ | 1 | /* $OpenBSD: ecs_ossl.c,v 1.22 2021/04/20 17:23:37 tb Exp $ */ | 
| 2 | /* | 2 | /* | 
| 3 | * Written by Nils Larsch for the OpenSSL project | 3 | * Written by Nils Larsch for the OpenSSL project | 
| 4 | */ | 4 | */ | 
| @@ -205,23 +205,11 @@ ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | |||
| 205 | ECDSAerror(ERR_R_EC_LIB); | 205 | ECDSAerror(ERR_R_EC_LIB); | 
| 206 | goto err; | 206 | goto err; | 
| 207 | } | 207 | } | 
| 208 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) == | 208 | if (!EC_POINT_get_affine_coordinates(group, point, X, NULL, | 
| 209 | NID_X9_62_prime_field) { | 209 | ctx)) { | 
| 210 | if (!EC_POINT_get_affine_coordinates(group, point, | 210 | ECDSAerror(ERR_R_EC_LIB); | 
| 211 | X, NULL, ctx)) { | 211 | goto err; | 
| 212 | ECDSAerror(ERR_R_EC_LIB); | ||
| 213 | goto err; | ||
| 214 | } | ||
| 215 | } | ||
| 216 | #ifndef OPENSSL_NO_EC2M | ||
| 217 | else { /* NID_X9_62_characteristic_two_field */ | ||
| 218 | if (!EC_POINT_get_affine_coordinates(group, point, | ||
| 219 | X, NULL, ctx)) { | ||
| 220 | ECDSAerror(ERR_R_EC_LIB); | ||
| 221 | goto err; | ||
| 222 | } | ||
| 223 | } | 212 | } | 
| 224 | #endif | ||
| 225 | if (!BN_nnmod(r, X, order, ctx)) { | 213 | if (!BN_nnmod(r, X, order, ctx)) { | 
| 226 | ECDSAerror(ERR_R_BN_LIB); | 214 | ECDSAerror(ERR_R_BN_LIB); | 
| 227 | goto err; | 215 | goto err; | 
| @@ -521,23 +509,10 @@ ecdsa_do_verify(const unsigned char *dgst, int dgst_len, const ECDSA_SIG *sig, | |||
| 521 | ECDSAerror(ERR_R_EC_LIB); | 509 | ECDSAerror(ERR_R_EC_LIB); | 
| 522 | goto err; | 510 | goto err; | 
| 523 | } | 511 | } | 
| 524 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) == | 512 | if (!EC_POINT_get_affine_coordinates(group, point, X, NULL, ctx)) { | 
| 525 | NID_X9_62_prime_field) { | 513 | ECDSAerror(ERR_R_EC_LIB); | 
| 526 | if (!EC_POINT_get_affine_coordinates(group, point, X, NULL, | 514 | goto err; | 
| 527 | ctx)) { | ||
| 528 | ECDSAerror(ERR_R_EC_LIB); | ||
| 529 | goto err; | ||
| 530 | } | ||
| 531 | } | ||
| 532 | #ifndef OPENSSL_NO_EC2M | ||
| 533 | else { /* NID_X9_62_characteristic_two_field */ | ||
| 534 | if (!EC_POINT_get_affine_coordinates(group, point, X, NULL, | ||
| 535 | ctx)) { | ||
| 536 | ECDSAerror(ERR_R_EC_LIB); | ||
| 537 | goto err; | ||
| 538 | } | ||
| 539 | } | 515 | } | 
| 540 | #endif | ||
| 541 | if (!BN_nnmod(u1, X, order, ctx)) { | 516 | if (!BN_nnmod(u1, X, order, ctx)) { | 
| 542 | ECDSAerror(ERR_R_BN_LIB); | 517 | ECDSAerror(ERR_R_BN_LIB); | 
| 543 | goto err; | 518 | goto err; | 
