summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorPascal Cuoq <cuoq@trust-in-soft.com>2015-10-12 12:19:19 +0200
committerKurt Roeckx <kurt@roeckx.be>2015-10-29 20:36:34 +0100
commitdfb23a5ac80bb9a74bd1f44a90ccff54bc3a8c31 (patch)
treedb0684104ab05461a0c1f64fa4a11b31356c00ee /crypto
parentb62a2f8a373d1889672599834acf95161f2883ce (diff)
BN_GF2m_mod_inv(): check bn_wexpand return value
Signed-off-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Rich Salz <rsalz@akamai.com> MR #1276, RT #4107 (cherry picked from commit 94b3664a528258df5ebcaae213d19bf6568cc47d)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/bn/bn_gf2m.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/crypto/bn/bn_gf2m.c b/crypto/bn/bn_gf2m.c
index e48ca957ba..2c61da1109 100644
--- a/crypto/bn/bn_gf2m.c
+++ b/crypto/bn/bn_gf2m.c
@@ -699,18 +699,21 @@ int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
int top = p->top;
BN_ULONG *udp, *bdp, *vdp, *cdp;
- bn_wexpand(u, top);
+ if (!bn_wexpand(u, top))
+ goto err;
udp = u->d;
for (i = u->top; i < top; i++)
udp[i] = 0;
u->top = top;
- bn_wexpand(b, top);
+ if (!bn_wexpand(b, top))
+ goto err;
bdp = b->d;
bdp[0] = 1;
for (i = 1; i < top; i++)
bdp[i] = 0;
b->top = top;
- bn_wexpand(c, top);
+ if (!bn_wexpand(c, top))
+ goto err;
cdp = c->d;
for (i = 0; i < top; i++)
cdp[i] = 0;