summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-07-11 13:26:32 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-07-11 13:26:32 +0000
commit91fa079e16e91f94e3700529fe1daaa9daa9b715 (patch)
treea11bce3653f2a5a9d9043bcb94075efaa3d670c2 /lib
parentd7d7fdac6854fab06ed075ceeccdbca57dbb331f (diff)
Make sure BN_sqr never returns negative numbers.
OpenSSL PR #3400 via OpenSSL trunk.
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/bn/bn_sqr.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libcrypto/bn/bn_sqr.c b/lib/libcrypto/bn/bn_sqr.c
index d4a9f460403..5ea9fb083d6 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.10 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: bn_sqr.c,v 1.11 2014/07/11 13:26:31 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -78,6 +78,7 @@ BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
al = a->top;
if (al <= 0) {
r->top = 0;
+ r->neg = 0;
return 1;
}