Date: Wed, 2 Jan 2013 20:56:54 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r244973 - vendor-crypto/openssl/dist/crypto/bn Message-ID: <201301022056.r02KusED061672@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Wed Jan 2 20:56:53 2013 New Revision: 244973 URL: http://svnweb.freebsd.org/changeset/base/244973 Log: Integrate OpenSSL changeset 22950 (appro): bn_word.c: fix overflow bug in BN_add_word. Modified: vendor-crypto/openssl/dist/crypto/bn/bn_word.c Modified: vendor-crypto/openssl/dist/crypto/bn/bn_word.c ============================================================================== --- vendor-crypto/openssl/dist/crypto/bn/bn_word.c Wed Jan 2 19:02:16 2013 (r244972) +++ vendor-crypto/openssl/dist/crypto/bn/bn_word.c Wed Jan 2 20:56:53 2013 (r244973) @@ -144,26 +144,17 @@ int BN_add_word(BIGNUM *a, BN_ULONG w) a->neg=!(a->neg); return(i); } - /* Only expand (and risk failing) if it's possibly necessary */ - if (((BN_ULONG)(a->d[a->top - 1] + 1) == 0) && - (bn_wexpand(a,a->top+1) == NULL)) - return(0); - i=0; - for (;;) + for (i=0;w!=0 && i<a->top;i++) { - if (i >= a->top) - l=w; - else - l=(a->d[i]+w)&BN_MASK2; - a->d[i]=l; - if (w > l) - w=1; - else - break; - i++; + a->d[i] = l = (a->d[i]+w)&BN_MASK2; + w = (w>l)?1:0; } - if (i >= a->top) + if (w && i==a->top) + { + if (bn_wexpand(a,a->top+1) == NULL) return 0; a->top++; + a->d[i]=w; + } bn_check_top(a); return(1); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301022056.r02KusED061672>