diff options
author | markus <> | 2013-02-14 15:11:44 +0000 |
---|---|---|
committer | markus <> | 2013-02-14 15:11:44 +0000 |
commit | 9822d929c08eed1446dc09464293449326730af2 (patch) | |
tree | cd2035e8f8ac3d4ade1ee779dcaabbe671c2003a /src/lib/libcrypto/bn | |
parent | 692574e51be904b35cfcb2609fd641e93dc8cef7 (diff) | |
download | openbsd-9822d929c08eed1446dc09464293449326730af2.tar.gz openbsd-9822d929c08eed1446dc09464293449326730af2.tar.bz2 openbsd-9822d929c08eed1446dc09464293449326730af2.zip |
cherry pick bugfixes for http://www.openssl.org/news/secadv_20130205.txt
from the openssl git (changes between openssl 1.0.1c and 1.0.1d).
ok djm@
Diffstat (limited to 'src/lib/libcrypto/bn')
-rw-r--r-- | src/lib/libcrypto/bn/bn_word.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/lib/libcrypto/bn/bn_word.c b/src/lib/libcrypto/bn/bn_word.c index ee7b87c45c..de83a15b99 100644 --- a/src/lib/libcrypto/bn/bn_word.c +++ b/src/lib/libcrypto/bn/bn_word.c | |||
@@ -144,26 +144,17 @@ int BN_add_word(BIGNUM *a, BN_ULONG w) | |||
144 | a->neg=!(a->neg); | 144 | a->neg=!(a->neg); |
145 | return(i); | 145 | return(i); |
146 | } | 146 | } |
147 | /* Only expand (and risk failing) if it's possibly necessary */ | 147 | for (i=0;w!=0 && i<a->top;i++) |
148 | if (((BN_ULONG)(a->d[a->top - 1] + 1) == 0) && | ||
149 | (bn_wexpand(a,a->top+1) == NULL)) | ||
150 | return(0); | ||
151 | i=0; | ||
152 | for (;;) | ||
153 | { | 148 | { |
154 | if (i >= a->top) | 149 | a->d[i] = l = (a->d[i]+w)&BN_MASK2; |
155 | l=w; | 150 | w = (w>l)?1:0; |
156 | else | ||
157 | l=(a->d[i]+w)&BN_MASK2; | ||
158 | a->d[i]=l; | ||
159 | if (w > l) | ||
160 | w=1; | ||
161 | else | ||
162 | break; | ||
163 | i++; | ||
164 | } | 151 | } |
165 | if (i >= a->top) | 152 | if (w && i==a->top) |
153 | { | ||
154 | if (bn_wexpand(a,a->top+1) == NULL) return 0; | ||
166 | a->top++; | 155 | a->top++; |
156 | a->d[i]=w; | ||
157 | } | ||
167 | bn_check_top(a); | 158 | bn_check_top(a); |
168 | return(1); | 159 | return(1); |
169 | } | 160 | } |