diff options
author | miod <> | 2014-06-27 22:02:07 +0000 |
---|---|---|
committer | miod <> | 2014-06-27 22:02:07 +0000 |
commit | 0fdd71f98152d655a9c157458a202cbb03b019c9 (patch) | |
tree | bbb3083c8cd7603e27eaf5a8e205675714acd9c4 /src | |
parent | 9cae0e2516ac9a43fe6b1723d99d460c7621b989 (diff) | |
download | openbsd-0fdd71f98152d655a9c157458a202cbb03b019c9.tar.gz openbsd-0fdd71f98152d655a9c157458a202cbb03b019c9.tar.bz2 openbsd-0fdd71f98152d655a9c157458a202cbb03b019c9.zip |
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 'src')
-rw-r--r-- | src/lib/libcrypto/bn/bn_div.c | 3 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/bn/bn_div.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/libcrypto/bn/bn_div.c b/src/lib/libcrypto/bn/bn_div.c index 3774a63611..2f45a412b4 100644 --- a/src/lib/libcrypto/bn/bn_div.c +++ b/src/lib/libcrypto/bn/bn_div.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bn_div.c,v 1.19 2014/06/12 15:49:28 deraadt Exp $ */ | 1 | /* $OpenBSD: bn_div.c,v 1.20 2014/06/27 22:02:07 miod 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 | * |
@@ -209,6 +209,7 @@ BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, | |||
209 | wnum.top = div_n; | 209 | wnum.top = div_n; |
210 | /* only needed when BN_ucmp messes up the values between top and max */ | 210 | /* only needed when BN_ucmp messes up the values between top and max */ |
211 | wnum.dmax = snum->dmax - loop; /* so we don't step out of bounds */ | 211 | wnum.dmax = snum->dmax - loop; /* so we don't step out of bounds */ |
212 | wnum.flags = snum->flags | BN_FLG_STATIC_DATA; | ||
212 | 213 | ||
213 | /* Get the top 2 words of sdiv */ | 214 | /* Get the top 2 words of sdiv */ |
214 | /* div_n=sdiv->top; */ | 215 | /* div_n=sdiv->top; */ |
diff --git a/src/lib/libssl/src/crypto/bn/bn_div.c b/src/lib/libssl/src/crypto/bn/bn_div.c index 3774a63611..2f45a412b4 100644 --- a/src/lib/libssl/src/crypto/bn/bn_div.c +++ b/src/lib/libssl/src/crypto/bn/bn_div.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bn_div.c,v 1.19 2014/06/12 15:49:28 deraadt Exp $ */ | 1 | /* $OpenBSD: bn_div.c,v 1.20 2014/06/27 22:02:07 miod 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 | * |
@@ -209,6 +209,7 @@ BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, | |||
209 | wnum.top = div_n; | 209 | wnum.top = div_n; |
210 | /* only needed when BN_ucmp messes up the values between top and max */ | 210 | /* only needed when BN_ucmp messes up the values between top and max */ |
211 | wnum.dmax = snum->dmax - loop; /* so we don't step out of bounds */ | 211 | wnum.dmax = snum->dmax - loop; /* so we don't step out of bounds */ |
212 | wnum.flags = snum->flags | BN_FLG_STATIC_DATA; | ||
212 | 213 | ||
213 | /* Get the top 2 words of sdiv */ | 214 | /* Get the top 2 words of sdiv */ |
214 | /* div_n=sdiv->top; */ | 215 | /* div_n=sdiv->top; */ |