diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2023-03-27 10:22:48 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2023-03-27 10:22:48 +0000 |
commit | 8a4ffc3861929171c8aabe0ef1839e49b166cd02 (patch) | |
tree | a58fec1691d8cb3870a8a188aec24df5c41170c1 /lib/libcrypto/bn | |
parent | 202eed5ee6d7fc7037116bd00ca328efbb388abf (diff) |
Convert BN_copy() with missing error checks to bn_copy()
ok jsing
Diffstat (limited to 'lib/libcrypto/bn')
-rw-r--r-- | lib/libcrypto/bn/bn_exp.c | 8 | ||||
-rw-r--r-- | lib/libcrypto/bn/bn_mul.c | 8 | ||||
-rw-r--r-- | lib/libcrypto/bn/bn_sqr.c | 8 |
3 files changed, 15 insertions, 9 deletions
diff --git a/lib/libcrypto/bn/bn_exp.c b/lib/libcrypto/bn/bn_exp.c index 4944daa48c0..b756d2b3056 100644 --- a/lib/libcrypto/bn/bn_exp.c +++ b/lib/libcrypto/bn/bn_exp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_exp.c,v 1.42 2023/03/27 10:21:23 tb Exp $ */ +/* $OpenBSD: bn_exp.c,v 1.43 2023/03/27 10:22:47 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -165,8 +165,10 @@ BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) ret = 1; err: - if (r != rr && rr != NULL) - BN_copy(r, rr); + if (r != rr && rr != NULL) { + if (!bn_copy(r, rr)) + ret = 0; + } BN_CTX_end(ctx); return (ret); } diff --git a/lib/libcrypto/bn/bn_mul.c b/lib/libcrypto/bn/bn_mul.c index 5e270b988f3..3a33767a935 100644 --- a/lib/libcrypto/bn/bn_mul.c +++ b/lib/libcrypto/bn/bn_mul.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_mul.c,v 1.34 2023/02/22 05:57:19 jsing Exp $ */ +/* $OpenBSD: bn_mul.c,v 1.35 2023/03/27 10:22:47 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -786,8 +786,10 @@ BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) BN_set_negative(rr, a->neg ^ b->neg); - if (r != rr) - BN_copy(r, rr); + if (r != rr) { + if (!bn_copy(r, rr)) + goto err; + } done: ret = 1; err: diff --git a/lib/libcrypto/bn/bn_sqr.c b/lib/libcrypto/bn/bn_sqr.c index 6e784541bde..6641b77592d 100644 --- a/lib/libcrypto/bn/bn_sqr.c +++ b/lib/libcrypto/bn/bn_sqr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_sqr.c,v 1.27 2023/02/17 05:13:34 jsing Exp $ */ +/* $OpenBSD: bn_sqr.c,v 1.28 2023/03/27 10:22:47 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -404,8 +404,10 @@ BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) rr->neg = 0; - if (rr != r) - BN_copy(r, rr); + if (rr != r) { + if (!bn_copy(r, rr)) + goto err; + } done: ret = 1; |