diff options
Diffstat (limited to 'src/lib/libcrypto/evp')
-rw-r--r-- | src/lib/libcrypto/evp/Makefile.ssl | 15 | ||||
-rw-r--r-- | src/lib/libcrypto/evp/bio_b64.c | 38 | ||||
-rw-r--r-- | src/lib/libcrypto/evp/c_all.c | 3 |
3 files changed, 39 insertions, 17 deletions
diff --git a/src/lib/libcrypto/evp/Makefile.ssl b/src/lib/libcrypto/evp/Makefile.ssl index b4172406ae..f33aebd33a 100644 --- a/src/lib/libcrypto/evp/Makefile.ssl +++ b/src/lib/libcrypto/evp/Makefile.ssl | |||
@@ -185,13 +185,14 @@ c_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | |||
185 | c_all.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | 185 | c_all.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h |
186 | c_all.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | 186 | c_all.o: ../../include/openssl/des.h ../../include/openssl/des_old.h |
187 | c_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | 187 | c_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h |
188 | c_all.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 188 | c_all.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h |
189 | c_all.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | 189 | c_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
190 | c_all.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | 190 | c_all.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h |
191 | c_all.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | 191 | c_all.o: ../../include/openssl/md2.h ../../include/openssl/md4.h |
192 | c_all.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | 192 | c_all.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h |
193 | c_all.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 193 | c_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
194 | c_all.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 194 | c_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
195 | c_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
195 | c_all.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | 196 | c_all.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h |
196 | c_all.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | 197 | c_all.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h |
197 | c_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | 198 | c_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
diff --git a/src/lib/libcrypto/evp/bio_b64.c b/src/lib/libcrypto/evp/bio_b64.c index 6e550f6a43..33349c2f98 100644 --- a/src/lib/libcrypto/evp/bio_b64.c +++ b/src/lib/libcrypto/evp/bio_b64.c | |||
@@ -184,7 +184,9 @@ static int b64_read(BIO *b, char *out, int outl) | |||
184 | ret_code=0; | 184 | ret_code=0; |
185 | while (outl > 0) | 185 | while (outl > 0) |
186 | { | 186 | { |
187 | if (ctx->cont <= 0) break; | 187 | |
188 | if (ctx->cont <= 0) | ||
189 | break; | ||
188 | 190 | ||
189 | i=BIO_read(b->next_bio,&(ctx->tmp[ctx->tmp_len]), | 191 | i=BIO_read(b->next_bio,&(ctx->tmp[ctx->tmp_len]), |
190 | B64_BLOCK_SIZE-ctx->tmp_len); | 192 | B64_BLOCK_SIZE-ctx->tmp_len); |
@@ -195,11 +197,21 @@ static int b64_read(BIO *b, char *out, int outl) | |||
195 | 197 | ||
196 | /* Should be continue next time we are called? */ | 198 | /* Should be continue next time we are called? */ |
197 | if (!BIO_should_retry(b->next_bio)) | 199 | if (!BIO_should_retry(b->next_bio)) |
200 | { | ||
198 | ctx->cont=i; | 201 | ctx->cont=i; |
199 | /* else we should continue when called again */ | 202 | /* If buffer empty break */ |
200 | break; | 203 | if(ctx->tmp_len == 0) |
204 | break; | ||
205 | /* Fall through and process what we have */ | ||
206 | else | ||
207 | i = 0; | ||
208 | } | ||
209 | /* else we retry and add more data to buffer */ | ||
210 | else | ||
211 | break; | ||
201 | } | 212 | } |
202 | i+=ctx->tmp_len; | 213 | i+=ctx->tmp_len; |
214 | ctx->tmp_len = i; | ||
203 | 215 | ||
204 | /* We need to scan, a line at a time until we | 216 | /* We need to scan, a line at a time until we |
205 | * have a valid line if we are starting. */ | 217 | * have a valid line if we are starting. */ |
@@ -255,8 +267,12 @@ static int b64_read(BIO *b, char *out, int outl) | |||
255 | * reading until a new line. */ | 267 | * reading until a new line. */ |
256 | if (p == (unsigned char *)&(ctx->tmp[0])) | 268 | if (p == (unsigned char *)&(ctx->tmp[0])) |
257 | { | 269 | { |
258 | ctx->tmp_nl=1; | 270 | /* Check buffer full */ |
259 | ctx->tmp_len=0; | 271 | if (i == B64_BLOCK_SIZE) |
272 | { | ||
273 | ctx->tmp_nl=1; | ||
274 | ctx->tmp_len=0; | ||
275 | } | ||
260 | } | 276 | } |
261 | else if (p != q) /* finished on a '\n' */ | 277 | else if (p != q) /* finished on a '\n' */ |
262 | { | 278 | { |
@@ -271,6 +287,11 @@ static int b64_read(BIO *b, char *out, int outl) | |||
271 | else | 287 | else |
272 | ctx->tmp_len=0; | 288 | ctx->tmp_len=0; |
273 | } | 289 | } |
290 | /* If buffer isn't full and we can retry then | ||
291 | * restart to read in more data. | ||
292 | */ | ||
293 | else if ((i < B64_BLOCK_SIZE) && (ctx->cont > 0)) | ||
294 | continue; | ||
274 | 295 | ||
275 | if (BIO_get_flags(b) & BIO_FLAGS_BASE64_NO_NL) | 296 | if (BIO_get_flags(b) & BIO_FLAGS_BASE64_NO_NL) |
276 | { | 297 | { |
@@ -310,8 +331,8 @@ static int b64_read(BIO *b, char *out, int outl) | |||
310 | i=EVP_DecodeUpdate(&(ctx->base64), | 331 | i=EVP_DecodeUpdate(&(ctx->base64), |
311 | (unsigned char *)ctx->buf,&ctx->buf_len, | 332 | (unsigned char *)ctx->buf,&ctx->buf_len, |
312 | (unsigned char *)ctx->tmp,i); | 333 | (unsigned char *)ctx->tmp,i); |
334 | ctx->tmp_len = 0; | ||
313 | } | 335 | } |
314 | ctx->cont=i; | ||
315 | ctx->buf_off=0; | 336 | ctx->buf_off=0; |
316 | if (i < 0) | 337 | if (i < 0) |
317 | { | 338 | { |
@@ -484,10 +505,7 @@ again: | |||
484 | { | 505 | { |
485 | i=b64_write(b,NULL,0); | 506 | i=b64_write(b,NULL,0); |
486 | if (i < 0) | 507 | if (i < 0) |
487 | { | 508 | return i; |
488 | ret=i; | ||
489 | break; | ||
490 | } | ||
491 | } | 509 | } |
492 | if (BIO_get_flags(b) & BIO_FLAGS_BASE64_NO_NL) | 510 | if (BIO_get_flags(b) & BIO_FLAGS_BASE64_NO_NL) |
493 | { | 511 | { |
diff --git a/src/lib/libcrypto/evp/c_all.c b/src/lib/libcrypto/evp/c_all.c index 1b31a14e37..fa60a73ead 100644 --- a/src/lib/libcrypto/evp/c_all.c +++ b/src/lib/libcrypto/evp/c_all.c | |||
@@ -59,6 +59,9 @@ | |||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
61 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
62 | #ifndef OPENSSL_NO_ENGINE | ||
63 | #include <openssl/engine.h> | ||
64 | #endif | ||
62 | 65 | ||
63 | #if 0 | 66 | #if 0 |
64 | #undef OpenSSL_add_all_algorithms | 67 | #undef OpenSSL_add_all_algorithms |