summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-06-27 22:02:08 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-06-27 22:02:08 +0000
commit10d9270439e074858caa44b1410ac7381af54fb1 (patch)
tree5650d57fe04a9df0f86f66584e6c09a163adb017 /lib
parent241918b19e9aee3c992b0b605fc086f2535c5921 (diff)
When building a BN on the stack in BN_div(), make sure to initialize all its
fields (i.e. the flags field) before using it. This is currently harmless, but might not be if we end up invoking other BN functions checking for constant-time processing requirement in the future.
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/bn/bn_div.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libcrypto/bn/bn_div.c b/lib/libcrypto/bn/bn_div.c
index 3774a636118..2f45a412b46 100644
--- a/lib/libcrypto/bn/bn_div.c
+++ b/lib/libcrypto/bn/bn_div.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bn_div.c,v 1.19 2014/06/12 15:49:28 deraadt Exp $ */
+/* $OpenBSD: bn_div.c,v 1.20 2014/06/27 22:02:07 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -209,6 +209,7 @@ BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
wnum.top = div_n;
/* only needed when BN_ucmp messes up the values between top and max */
wnum.dmax = snum->dmax - loop; /* so we don't step out of bounds */
+ wnum.flags = snum->flags | BN_FLG_STATIC_DATA;
/* Get the top 2 words of sdiv */
/* div_n=sdiv->top; */