summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ecdsa/ecs_ossl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ecdsa/ecs_ossl.c')
-rw-r--r--src/lib/libcrypto/ecdsa/ecs_ossl.c41
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;