diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2023-07-03 10:09:13 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2023-07-03 10:09:13 +0000 |
commit | 9e7af41aac0f43b4c8c6cd90aff7b5efd86b7a56 (patch) | |
tree | 97b7efe774e6bf0cfaab1c9e7d9a2e80e1f8b560 /lib/libcrypto | |
parent | d20061e3afd8d6abba415027532955fbe8d2e67d (diff) |
In ossl_ecdsa_verify_sig() use BN_CTX more idiomatically
ok beck jsing
Diffstat (limited to 'lib/libcrypto')
-rw-r--r-- | lib/libcrypto/ecdsa/ecs_ossl.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/libcrypto/ecdsa/ecs_ossl.c b/lib/libcrypto/ecdsa/ecs_ossl.c index f587028262e..33e41b4c0f8 100644 --- a/lib/libcrypto/ecdsa/ecs_ossl.c +++ b/lib/libcrypto/ecdsa/ecs_ossl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecs_ossl.c,v 1.52 2023/07/03 10:06:00 tb Exp $ */ +/* $OpenBSD: ecs_ossl.c,v 1.53 2023/07/03 10:09:12 tb Exp $ */ /* * Written by Nils Larsch for the OpenSSL project */ @@ -481,15 +481,17 @@ ossl_ecdsa_verify_sig(const unsigned char *dgst, int dgst_len, const ECDSA_SIG * ECDSAerror(ERR_R_MALLOC_FAILURE); goto err; } + BN_CTX_start(ctx); - u1 = BN_CTX_get(ctx); - u2 = BN_CTX_get(ctx); - m = BN_CTX_get(ctx); - x = BN_CTX_get(ctx); - if (x == NULL) { - ECDSAerror(ERR_R_BN_LIB); + + if ((u1 = BN_CTX_get(ctx)) == NULL) + goto err; + if ((u2 = BN_CTX_get(ctx)) == NULL) + goto err; + if ((m = BN_CTX_get(ctx)) == NULL) + goto err; + if ((x = BN_CTX_get(ctx)) == NULL) goto err; - } if ((order = EC_GROUP_get0_order(group)) == NULL) { ECDSAerror(ERR_R_EC_LIB); |