diff options
| author | jsing <> | 2023-06-24 16:10:23 +0000 |
|---|---|---|
| committer | jsing <> | 2023-06-24 16:10:23 +0000 |
| commit | 519c623f28f9d2dae3373308133f0766c330ba60 (patch) | |
| tree | c1885ab6f54f8998af91385a864e232bef49b830 /src | |
| parent | 3180c8185bba7d792127e1b9bc87f11e439ba0fb (diff) | |
| download | openbsd-519c623f28f9d2dae3373308133f0766c330ba60.tar.gz openbsd-519c623f28f9d2dae3373308133f0766c330ba60.tar.bz2 openbsd-519c623f28f9d2dae3373308133f0766c330ba60.zip | |
Check for non-zero length rather than a zero value.
This removes a data dependent timing path from BN_sqr().
ok tb@
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_sqr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/bn/bn_sqr.c b/src/lib/libcrypto/bn/bn_sqr.c index 4eab796c90..5f3be22304 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.31 2023/06/24 16:01:43 jsing Exp $ */ | 1 | /* $OpenBSD: bn_sqr.c,v 1.32 2023/06/24 16:10:23 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 | * |
| @@ -274,7 +274,7 @@ BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) | |||
| 274 | 274 | ||
| 275 | BN_CTX_start(ctx); | 275 | BN_CTX_start(ctx); |
| 276 | 276 | ||
| 277 | if (BN_is_zero(a)) { | 277 | if (a->top < 1) { |
| 278 | BN_zero(r); | 278 | BN_zero(r); |
| 279 | goto done; | 279 | goto done; |
| 280 | } | 280 | } |
