summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ecdsa/ecs_ossl.c
diff options
context:
space:
mode:
authorinoguchi <>2022-01-20 11:12:14 +0000
committerinoguchi <>2022-01-20 11:12:14 +0000
commit16d4a60b8641ac0612a3e7f2bbbaad39ab88c974 (patch)
tree738ba0a6b501fd8e94d479e5af4cf39d1de4479c /src/lib/libcrypto/ecdsa/ecs_ossl.c
parent58a48f1e9c4f1c9c42f60ac854e4870e9d623585 (diff)
downloadopenbsd-16d4a60b8641ac0612a3e7f2bbbaad39ab88c974.tar.gz
openbsd-16d4a60b8641ac0612a3e7f2bbbaad39ab88c974.tar.bz2
openbsd-16d4a60b8641ac0612a3e7f2bbbaad39ab88c974.zip
Fix check for BN_mod_inverse_ct return value
ok jsing@ millert@ tb@
Diffstat (limited to 'src/lib/libcrypto/ecdsa/ecs_ossl.c')
-rw-r--r--src/lib/libcrypto/ecdsa/ecs_ossl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/libcrypto/ecdsa/ecs_ossl.c b/src/lib/libcrypto/ecdsa/ecs_ossl.c
index e7e7a52665..2429e36b59 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.22 2021/04/20 17:23:37 tb Exp $ */ 1/* $OpenBSD: ecs_ossl.c,v 1.23 2022/01/20 11:03:48 inoguchi Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project 3 * Written by Nils Larsch for the OpenSSL project
4 */ 4 */
@@ -216,7 +216,7 @@ ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
216 } 216 }
217 } while (BN_is_zero(r)); 217 } while (BN_is_zero(r));
218 218
219 if (!BN_mod_inverse_ct(k, k, order, ctx)) { 219 if (BN_mod_inverse_ct(k, k, order, ctx) == NULL) {
220 ECDSAerror(ERR_R_BN_LIB); 220 ECDSAerror(ERR_R_BN_LIB);
221 goto err; 221 goto err;
222 } 222 }
@@ -487,7 +487,7 @@ ecdsa_do_verify(const unsigned char *dgst, int dgst_len, const ECDSA_SIG *sig,
487 if (!ecdsa_prepare_digest(dgst, dgst_len, order, m)) 487 if (!ecdsa_prepare_digest(dgst, dgst_len, order, m))
488 goto err; 488 goto err;
489 489
490 if (!BN_mod_inverse_ct(u2, sig->s, order, ctx)) { /* w = inv(s) */ 490 if (BN_mod_inverse_ct(u2, sig->s, order, ctx) == NULL) { /* w = inv(s) */
491 ECDSAerror(ERR_R_BN_LIB); 491 ECDSAerror(ERR_R_BN_LIB);
492 goto err; 492 goto err;
493 } 493 }