diff options
author | Kinichiro Inoguchi <inoguchi@cvs.openbsd.org> | 2022-01-20 11:12:15 +0000 |
---|---|---|
committer | Kinichiro Inoguchi <inoguchi@cvs.openbsd.org> | 2022-01-20 11:12:15 +0000 |
commit | 4cf01169d390ce735fcabbc70100a61801846328 (patch) | |
tree | 5caa06b10b5b8144f6e301be9c50b3f4aaa84fb2 /lib/libcrypto | |
parent | 0f371a0aae3806457a8a861dcedb1587c5e22890 (diff) |
Fix check for BN_mod_inverse_ct return value
ok jsing@ millert@ tb@
Diffstat (limited to 'lib/libcrypto')
-rw-r--r-- | lib/libcrypto/rsa/rsa_gen.c | 6 | ||||
-rw-r--r-- | lib/libcrypto/sm2/sm2_sign.c | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/libcrypto/rsa/rsa_gen.c b/lib/libcrypto/rsa/rsa_gen.c index 3a0d8837b4b..5f062a7a24f 100644 --- a/lib/libcrypto/rsa/rsa_gen.c +++ b/lib/libcrypto/rsa/rsa_gen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_gen.c,v 1.24 2022/01/07 09:55:32 tb Exp $ */ +/* $OpenBSD: rsa_gen.c,v 1.25 2022/01/20 11:11:17 inoguchi Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -198,7 +198,7 @@ rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb) BN_init(&pr0); BN_with_flags(&pr0, r0, BN_FLG_CONSTTIME); - if (!BN_mod_inverse_ct(rsa->d, rsa->e, &pr0, ctx)) /* d */ + if (BN_mod_inverse_ct(rsa->d, rsa->e, &pr0, ctx) == NULL) /* d */ goto err; /* set up d for correct BN_FLG_CONSTTIME flag */ @@ -216,7 +216,7 @@ rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb) /* calculate inverse of q mod p */ BN_init(&p); BN_with_flags(&p, rsa->p, BN_FLG_CONSTTIME); - if (!BN_mod_inverse_ct(rsa->iqmp, rsa->q, &p, ctx)) + if (BN_mod_inverse_ct(rsa->iqmp, rsa->q, &p, ctx) == NULL) goto err; ok = 1; diff --git a/lib/libcrypto/sm2/sm2_sign.c b/lib/libcrypto/sm2/sm2_sign.c index 67385013817..b35de841b10 100644 --- a/lib/libcrypto/sm2/sm2_sign.c +++ b/lib/libcrypto/sm2/sm2_sign.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sm2_sign.c,v 1.1 2021/08/18 16:04:32 tb Exp $ */ +/* $OpenBSD: sm2_sign.c,v 1.2 2022/01/20 11:12:14 inoguchi Exp $ */ /* * Copyright (c) 2017, 2019 Ribose Inc * @@ -194,7 +194,7 @@ sm2_sig_gen(const EC_KEY *key, const BIGNUM *e) goto err; } - if (!BN_mod_inverse_ct(s, s, order, ctx)) { + if (BN_mod_inverse_ct(s, s, order, ctx) == NULL) { SM2error(ERR_R_BN_LIB); goto err; } |