diff options
-rw-r--r-- | src/lib/libcrypto/ecdsa/ecs_ossl.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/lib/libcrypto/ecdsa/ecs_ossl.c b/src/lib/libcrypto/ecdsa/ecs_ossl.c index d7bd75b878..17d39cf36d 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.41 2023/07/02 12:48:59 tb Exp $ */ | 1 | /* $OpenBSD: ecs_ossl.c,v 1.42 2023/07/02 13:05:29 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project | 3 | * Written by Nils Larsch for the OpenSSL project |
4 | */ | 4 | */ |
@@ -121,9 +121,10 @@ ossl_ecdsa_sign(int type, const unsigned char *dgst, int dlen, unsigned char *si | |||
121 | } | 121 | } |
122 | 122 | ||
123 | int | 123 | int |
124 | ossl_ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | 124 | ossl_ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *in_ctx, BIGNUM **out_kinv, |
125 | BIGNUM **out_r) | ||
125 | { | 126 | { |
126 | BN_CTX *ctx = ctx_in; | 127 | BN_CTX *ctx = in_ctx; |
127 | BIGNUM *k = NULL, *r = NULL, *order = NULL, *x = NULL; | 128 | BIGNUM *k = NULL, *r = NULL, *order = NULL, *x = NULL; |
128 | EC_POINT *point = NULL; | 129 | EC_POINT *point = NULL; |
129 | const EC_GROUP *group; | 130 | const EC_GROUP *group; |
@@ -219,10 +220,10 @@ ossl_ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp | |||
219 | ECDSAerror(ERR_R_BN_LIB); | 220 | ECDSAerror(ERR_R_BN_LIB); |
220 | goto err; | 221 | goto err; |
221 | } | 222 | } |
222 | BN_free(*rp); | 223 | BN_free(*out_r); |
223 | BN_free(*kinvp); | 224 | BN_free(*out_kinv); |
224 | *rp = r; | 225 | *out_r = r; |
225 | *kinvp = k; | 226 | *out_kinv = k; |
226 | ret = 1; | 227 | ret = 1; |
227 | 228 | ||
228 | err: | 229 | err: |
@@ -230,7 +231,7 @@ ossl_ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp | |||
230 | BN_free(k); | 231 | BN_free(k); |
231 | BN_free(r); | 232 | BN_free(r); |
232 | } | 233 | } |
233 | if (ctx_in == NULL) | 234 | if (in_ctx == NULL) |
234 | BN_CTX_free(ctx); | 235 | BN_CTX_free(ctx); |
235 | BN_free(order); | 236 | BN_free(order); |
236 | EC_POINT_free(point); | 237 | EC_POINT_free(point); |
@@ -523,13 +524,13 @@ ECDSA_do_sign(const unsigned char *dgst, int dlen, EC_KEY *eckey) | |||
523 | 524 | ||
524 | ECDSA_SIG * | 525 | ECDSA_SIG * |
525 | ECDSA_do_sign_ex(const unsigned char *dgst, int dlen, const BIGNUM *kinv, | 526 | ECDSA_do_sign_ex(const unsigned char *dgst, int dlen, const BIGNUM *kinv, |
526 | const BIGNUM *rp, EC_KEY *eckey) | 527 | const BIGNUM *out_r, EC_KEY *eckey) |
527 | { | 528 | { |
528 | if (eckey->meth->sign_sig == NULL) { | 529 | if (eckey->meth->sign_sig == NULL) { |
529 | ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); | 530 | ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); |
530 | return 0; | 531 | return 0; |
531 | } | 532 | } |
532 | return eckey->meth->sign_sig(dgst, dlen, kinv, rp, eckey); | 533 | return eckey->meth->sign_sig(dgst, dlen, kinv, out_r, eckey); |
533 | } | 534 | } |
534 | 535 | ||
535 | int | 536 | int |
@@ -551,13 +552,13 @@ ECDSA_sign_ex(int type, const unsigned char *dgst, int dlen, unsigned char *sig, | |||
551 | } | 552 | } |
552 | 553 | ||
553 | int | 554 | int |
554 | ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | 555 | ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *in_ctx, BIGNUM **out_kinv, BIGNUM **out_r) |
555 | { | 556 | { |
556 | if (eckey->meth->sign_setup == NULL) { | 557 | if (eckey->meth->sign_setup == NULL) { |
557 | ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); | 558 | ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); |
558 | return 0; | 559 | return 0; |
559 | } | 560 | } |
560 | return eckey->meth->sign_setup(eckey, ctx_in, kinvp, rp); | 561 | return eckey->meth->sign_setup(eckey, in_ctx, out_kinv, out_r); |
561 | } | 562 | } |
562 | 563 | ||
563 | int | 564 | int |