diff options
| author | tb <> | 2023-03-30 14:28:56 +0000 |
|---|---|---|
| committer | tb <> | 2023-03-30 14:28:56 +0000 |
| commit | 06862089af5015b4fc2ccad700b7c740d03e99f6 (patch) | |
| tree | b879a4c37e10600b4b811c539fac9b57401c2ed1 /src | |
| parent | 90f0c10580275e9efd1db4c1dc4944fcbf777a9b (diff) | |
| download | openbsd-06862089af5015b4fc2ccad700b7c740d03e99f6.tar.gz openbsd-06862089af5015b4fc2ccad700b7c740d03e99f6.tar.bz2 openbsd-06862089af5015b4fc2ccad700b7c740d03e99f6.zip | |
Call bn_copy() unconditionally in BN_mul() and BN_sqr()
bn_copy() does the right thing if source and target are the same, so
there is no need for an additional check.
Requested by jsing
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_mul.c | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_sqr.c | 9 |
2 files changed, 6 insertions, 11 deletions
diff --git a/src/lib/libcrypto/bn/bn_mul.c b/src/lib/libcrypto/bn/bn_mul.c index 3a33767a93..fe3f29617f 100644 --- a/src/lib/libcrypto/bn/bn_mul.c +++ b/src/lib/libcrypto/bn/bn_mul.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_mul.c,v 1.35 2023/03/27 10:22:47 tb Exp $ */ | 1 | /* $OpenBSD: bn_mul.c,v 1.36 2023/03/30 14:28:56 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -786,10 +786,8 @@ BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) | |||
| 786 | 786 | ||
| 787 | BN_set_negative(rr, a->neg ^ b->neg); | 787 | BN_set_negative(rr, a->neg ^ b->neg); |
| 788 | 788 | ||
| 789 | if (r != rr) { | 789 | if (!bn_copy(r, rr)) |
| 790 | if (!bn_copy(r, rr)) | 790 | goto err; |
| 791 | goto err; | ||
| 792 | } | ||
| 793 | done: | 791 | done: |
| 794 | ret = 1; | 792 | ret = 1; |
| 795 | err: | 793 | err: |
diff --git a/src/lib/libcrypto/bn/bn_sqr.c b/src/lib/libcrypto/bn/bn_sqr.c index 6641b77592..d5da775200 100644 --- a/src/lib/libcrypto/bn/bn_sqr.c +++ b/src/lib/libcrypto/bn/bn_sqr.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_sqr.c,v 1.28 2023/03/27 10:22:47 tb Exp $ */ | 1 | /* $OpenBSD: bn_sqr.c,v 1.29 2023/03/30 14:28:56 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -404,11 +404,8 @@ BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) | |||
| 404 | 404 | ||
| 405 | rr->neg = 0; | 405 | rr->neg = 0; |
| 406 | 406 | ||
| 407 | if (rr != r) { | 407 | if (!bn_copy(r, rr)) |
| 408 | if (!bn_copy(r, rr)) | 408 | goto err; |
| 409 | goto err; | ||
| 410 | } | ||
| 411 | |||
| 412 | done: | 409 | done: |
| 413 | ret = 1; | 410 | ret = 1; |
| 414 | err: | 411 | err: |
