summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2023-07-03 10:09:12 +0000
committertb <>2023-07-03 10:09:12 +0000
commit1bcd523281f80bada03f31e6dbf26d8076ce2297 (patch)
treec357fe10729897d7370727db8c4c0bae7ab5d202
parent480dd123899333e53ac9b7ec88f369a11cc609f9 (diff)
downloadopenbsd-1bcd523281f80bada03f31e6dbf26d8076ce2297.tar.gz
openbsd-1bcd523281f80bada03f31e6dbf26d8076ce2297.tar.bz2
openbsd-1bcd523281f80bada03f31e6dbf26d8076ce2297.zip
In ossl_ecdsa_verify_sig() use BN_CTX more idiomatically
ok beck jsing
-rw-r--r--src/lib/libcrypto/ecdsa/ecs_ossl.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/lib/libcrypto/ecdsa/ecs_ossl.c b/src/lib/libcrypto/ecdsa/ecs_ossl.c
index f587028262..33e41b4c0f 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.52 2023/07/03 10:06:00 tb Exp $ */ 1/* $OpenBSD: ecs_ossl.c,v 1.53 2023/07/03 10:09:12 tb Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project 3 * Written by Nils Larsch for the OpenSSL project
4 */ 4 */
@@ -481,15 +481,17 @@ ossl_ecdsa_verify_sig(const unsigned char *dgst, int dgst_len, const ECDSA_SIG *
481 ECDSAerror(ERR_R_MALLOC_FAILURE); 481 ECDSAerror(ERR_R_MALLOC_FAILURE);
482 goto err; 482 goto err;
483 } 483 }
484
484 BN_CTX_start(ctx); 485 BN_CTX_start(ctx);
485 u1 = BN_CTX_get(ctx); 486
486 u2 = BN_CTX_get(ctx); 487 if ((u1 = BN_CTX_get(ctx)) == NULL)
487 m = BN_CTX_get(ctx); 488 goto err;
488 x = BN_CTX_get(ctx); 489 if ((u2 = BN_CTX_get(ctx)) == NULL)
489 if (x == NULL) { 490 goto err;
490 ECDSAerror(ERR_R_BN_LIB); 491 if ((m = BN_CTX_get(ctx)) == NULL)
492 goto err;
493 if ((x = BN_CTX_get(ctx)) == NULL)
491 goto err; 494 goto err;
492 }
493 495
494 if ((order = EC_GROUP_get0_order(group)) == NULL) { 496 if ((order = EC_GROUP_get0_order(group)) == NULL) {
495 ECDSAerror(ERR_R_EC_LIB); 497 ECDSAerror(ERR_R_EC_LIB);