From: jsing Date: Sat, 24 Jun 2023 16:10:23 +0000 (+0000) Subject: Check for non-zero length rather than a zero value. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=bc591847e51645c65de8e7dd9927cade552c8ff6;p=openbsd Check for non-zero length rather than a zero value. This removes a data dependent timing path from BN_sqr(). ok tb@ --- 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; }