diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2023-06-24 16:10:24 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2023-06-24 16:10:24 +0000 |
commit | 53a1869cd163b1bfd7248c3b0ac866ce095a14e8 (patch) | |
tree | 5281f14b9218da6fec04ead6fcb3de2bc0070fec /lib/libcrypto | |
parent | 08d3660dd866a378060cf71fb787ce52556328e1 (diff) |
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 'lib/libcrypto')
-rw-r--r-- | lib/libcrypto/bn/bn_sqr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libcrypto/bn/bn_sqr.c b/lib/libcrypto/bn/bn_sqr.c index 4eab796c906..5f3be22304c 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.31 2023/06/24 16:01:43 jsing Exp $ */ +/* $OpenBSD: bn_sqr.c,v 1.32 2023/06/24 16:10:23 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -274,7 +274,7 @@ BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) BN_CTX_start(ctx); - if (BN_is_zero(a)) { + if (a->top < 1) { BN_zero(r); goto done; } |