diff options
author | bcook <> | 2016-03-12 21:44:11 +0000 |
---|---|---|
committer | bcook <> | 2016-03-12 21:44:11 +0000 |
commit | 84ad4abc945651758ccaec50eaeafff9ffe582ee (patch) | |
tree | c202c7ef43ff015fb66c468e4c977405d5d0cc88 /src/lib/libcrypto/bn | |
parent | d692c27f466b0683d4f7dd5f72058e64e04f0cd4 (diff) | |
download | openbsd-84ad4abc945651758ccaec50eaeafff9ffe582ee.tar.gz openbsd-84ad4abc945651758ccaec50eaeafff9ffe582ee.tar.bz2 openbsd-84ad4abc945651758ccaec50eaeafff9ffe582ee.zip |
Add error handling to the remaining calls to bn_wexpand().
Noticed by pascal-cuoq from Github:
https://github.com/libressl-portable/openbsd/issues/56
ok beck@
Diffstat (limited to 'src/lib/libcrypto/bn')
-rw-r--r-- | src/lib/libcrypto/bn/bn_gf2m.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/libcrypto/bn/bn_gf2m.c b/src/lib/libcrypto/bn/bn_gf2m.c index 40c1a94220..d83ae291ec 100644 --- a/src/lib/libcrypto/bn/bn_gf2m.c +++ b/src/lib/libcrypto/bn/bn_gf2m.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bn_gf2m.c,v 1.20 2015/06/11 15:55:28 jsing Exp $ */ | 1 | /* $OpenBSD: bn_gf2m.c,v 1.21 2016/03/12 21:44:11 bcook Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
4 | * | 4 | * |
@@ -702,18 +702,21 @@ BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
702 | top = p->top; | 702 | top = p->top; |
703 | BN_ULONG *udp, *bdp, *vdp, *cdp; | 703 | BN_ULONG *udp, *bdp, *vdp, *cdp; |
704 | 704 | ||
705 | bn_wexpand(u, top); | 705 | if (!bn_wexpand(u, top)) |
706 | goto err; | ||
706 | udp = u->d; | 707 | udp = u->d; |
707 | for (i = u->top; i < top; i++) | 708 | for (i = u->top; i < top; i++) |
708 | udp[i] = 0; | 709 | udp[i] = 0; |
709 | u->top = top; | 710 | u->top = top; |
710 | bn_wexpand(b, top); | 711 | if (!bn_wexpand(b, top)) |
712 | goto err; | ||
711 | bdp = b->d; | 713 | bdp = b->d; |
712 | bdp[0] = 1; | 714 | bdp[0] = 1; |
713 | for (i = 1; i < top; i++) | 715 | for (i = 1; i < top; i++) |
714 | bdp[i] = 0; | 716 | bdp[i] = 0; |
715 | b->top = top; | 717 | b->top = top; |
716 | bn_wexpand(c, top); | 718 | if (!bn_wexpand(c, top)) |
719 | goto err; | ||
717 | cdp = c->d; | 720 | cdp = c->d; |
718 | for (i = 0; i < top; i++) | 721 | for (i = 0; i < top; i++) |
719 | cdp[i] = 0; | 722 | cdp[i] = 0; |