diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/ecdsa/ecs_ossl.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/lib/libcrypto/ecdsa/ecs_ossl.c b/src/lib/libcrypto/ecdsa/ecs_ossl.c index e6d6b0cd71..78e2b4a997 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.31 2023/03/27 10:25:02 tb Exp $ */ | 1 | /* $OpenBSD: ecs_ossl.c,v 1.32 2023/03/30 15:51:09 bluhm Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Nils Larsch for the OpenSSL project | 3 | * Written by Nils Larsch for the OpenSSL project |
| 4 | */ | 4 | */ |
| @@ -118,14 +118,23 @@ ossl_ecdsa_sign(int type, const unsigned char *dgst, int dlen, unsigned char *si | |||
| 118 | unsigned int *siglen, const BIGNUM *kinv, const BIGNUM *r, EC_KEY *eckey) | 118 | unsigned int *siglen, const BIGNUM *kinv, const BIGNUM *r, EC_KEY *eckey) |
| 119 | { | 119 | { |
| 120 | ECDSA_SIG *s; | 120 | ECDSA_SIG *s; |
| 121 | int outlen = 0; | ||
| 122 | int ret = 0; | ||
| 121 | 123 | ||
| 122 | if ((s = ECDSA_do_sign_ex(dgst, dlen, kinv, r, eckey)) == NULL) { | 124 | if ((s = ECDSA_do_sign_ex(dgst, dlen, kinv, r, eckey)) == NULL) { |
| 123 | *siglen = 0; | 125 | goto err; |
| 124 | return 0; | ||
| 125 | } | 126 | } |
| 126 | *siglen = i2d_ECDSA_SIG(s, &sig); | 127 | if ((outlen = i2d_ECDSA_SIG(s, &sig)) < 0) { |
| 128 | outlen = 0; | ||
| 129 | goto err; | ||
| 130 | } | ||
| 131 | |||
| 132 | ret = 1; | ||
| 133 | |||
| 134 | err: | ||
| 135 | *siglen = outlen; | ||
| 127 | ECDSA_SIG_free(s); | 136 | ECDSA_SIG_free(s); |
| 128 | return 1; | 137 | return ret; |
| 129 | } | 138 | } |
| 130 | 139 | ||
| 131 | static int | 140 | static int |
