diff options
| author | jsing <> | 2023-06-24 17:06:54 +0000 |
|---|---|---|
| committer | jsing <> | 2023-06-24 17:06:54 +0000 |
| commit | cdc3daac6d11e320c5fd96848485dfc9be6ede91 (patch) | |
| tree | 2ff172c30d92e33b53f4881509f918ed7bbe3107 /src | |
| parent | 5e376e32f0dbc7c5b612fa955c9eafde7f2c0bf2 (diff) | |
| download | openbsd-cdc3daac6d11e320c5fd96848485dfc9be6ede91.tar.gz openbsd-cdc3daac6d11e320c5fd96848485dfc9be6ede91.tar.bz2 openbsd-cdc3daac6d11e320c5fd96848485dfc9be6ede91.zip | |
Add conditional around bn_mul_words() call.
At least one of our bn_mul_words() assembly implementation fails to handle
n = 0 correctly... *sigh*
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_sqr.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/libcrypto/bn/bn_sqr.c b/src/lib/libcrypto/bn/bn_sqr.c index 56664e2e36..5ea1bd45b9 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.33 2023/06/24 16:19:52 jsing Exp $ */ | 1 | /* $OpenBSD: bn_sqr.c,v 1.34 2023/06/24 17:06:54 jsing 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 | * |
| @@ -214,7 +214,9 @@ bn_sqr_normal(BN_ULONG *r, int r_len, const BN_ULONG *a, int a_len, | |||
| 214 | 214 | ||
| 215 | /* Compute initial product - r[n:1] = a[n:1] * a[0] */ | 215 | /* Compute initial product - r[n:1] = a[n:1] * a[0] */ |
| 216 | n = a_len - 1; | 216 | n = a_len - 1; |
| 217 | rp[n] = bn_mul_words(rp, ap, n, w); | 217 | if (n > 0) { |
| 218 | rp[n] = bn_mul_words(rp, ap, n, w); | ||
| 219 | } | ||
| 218 | rp += 2; | 220 | rp += 2; |
| 219 | n--; | 221 | n--; |
| 220 | 222 | ||
