Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: openssl/crypto/bio/bf_buff.c

Issue 9254031: Upgrade chrome's OpenSSL to same version Android ships with. (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/openssl/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « openssl/crypto/bio/b_sock.c ('k') | openssl/crypto/bio/bf_nbio.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* crypto/bio/bf_buff.c */ 1 /* crypto/bio/bf_buff.c */
2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * This package is an SSL implementation written 5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com). 6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL. 7 * The implementation was written so as to conform with Netscapes SSL.
8 * 8 *
9 * This library is free for commercial and non-commercial use as long as 9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions 10 * the following conditions are aheared to. The following conditions
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 if ((in == NULL) || (inl <= 0)) return(0); 202 if ((in == NULL) || (inl <= 0)) return(0);
203 ctx=(BIO_F_BUFFER_CTX *)b->ptr; 203 ctx=(BIO_F_BUFFER_CTX *)b->ptr;
204 if ((ctx == NULL) || (b->next_bio == NULL)) return(0); 204 if ((ctx == NULL) || (b->next_bio == NULL)) return(0);
205 205
206 BIO_clear_retry_flags(b); 206 BIO_clear_retry_flags(b);
207 start: 207 start:
208 i=ctx->obuf_size-(ctx->obuf_len+ctx->obuf_off); 208 i=ctx->obuf_size-(ctx->obuf_len+ctx->obuf_off);
209 /* add to buffer and return */ 209 /* add to buffer and return */
210 if (i >= inl) 210 if (i >= inl)
211 { 211 {
212 » » memcpy(&(ctx->obuf[ctx->obuf_len]),in,inl); 212 » » memcpy(&(ctx->obuf[ctx->obuf_off+ctx->obuf_len]),in,inl);
213 ctx->obuf_len+=inl; 213 ctx->obuf_len+=inl;
214 return(num+inl); 214 return(num+inl);
215 } 215 }
216 /* else */ 216 /* else */
217 /* stuff already in buffer, so add to it first, then flush */ 217 /* stuff already in buffer, so add to it first, then flush */
218 if (ctx->obuf_len != 0) 218 if (ctx->obuf_len != 0)
219 { 219 {
220 if (i > 0) /* lets fill it up if we can */ 220 if (i > 0) /* lets fill it up if we can */
221 { 221 {
222 » » » memcpy(&(ctx->obuf[ctx->obuf_len]),in,i); 222 » » » memcpy(&(ctx->obuf[ctx->obuf_off+ctx->obuf_len]),in,i);
223 in+=i; 223 in+=i;
224 inl-=i; 224 inl-=i;
225 num+=i; 225 num+=i;
226 ctx->obuf_len+=i; 226 ctx->obuf_len+=i;
227 } 227 }
228 /* we now have a full buffer needing flushing */ 228 /* we now have a full buffer needing flushing */
229 for (;;) 229 for (;;)
230 { 230 {
231 i=BIO_write(b->next_bio,&(ctx->obuf[ctx->obuf_off]), 231 i=BIO_write(b->next_bio,&(ctx->obuf[ctx->obuf_off]),
232 ctx->obuf_len); 232 ctx->obuf_len);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 ctx->obuf_len=0; 287 ctx->obuf_len=0;
288 if (b->next_bio == NULL) return(0); 288 if (b->next_bio == NULL) return(0);
289 ret=BIO_ctrl(b->next_bio,cmd,num,ptr); 289 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
290 break; 290 break;
291 case BIO_CTRL_INFO: 291 case BIO_CTRL_INFO:
292 ret=(long)ctx->obuf_len; 292 ret=(long)ctx->obuf_len;
293 break; 293 break;
294 case BIO_C_GET_BUFF_NUM_LINES: 294 case BIO_C_GET_BUFF_NUM_LINES:
295 ret=0; 295 ret=0;
296 p1=ctx->ibuf; 296 p1=ctx->ibuf;
297 » » for (i=ctx->ibuf_off; i<ctx->ibuf_len; i++) 297 » » for (i=0; i<ctx->ibuf_len; i++)
298 { 298 {
299 » » » if (p1[i] == '\n') ret++; 299 » » » if (p1[ctx->ibuf_off + i] == '\n') ret++;
300 } 300 }
301 break; 301 break;
302 case BIO_CTRL_WPENDING: 302 case BIO_CTRL_WPENDING:
303 ret=(long)ctx->obuf_len; 303 ret=(long)ctx->obuf_len;
304 if (ret == 0) 304 if (ret == 0)
305 { 305 {
306 if (b->next_bio == NULL) return(0); 306 if (b->next_bio == NULL) return(0);
307 ret=BIO_ctrl(b->next_bio,cmd,num,ptr); 307 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
308 } 308 }
309 break; 309 break;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 if (b->next_bio == NULL) return(0); 392 if (b->next_bio == NULL) return(0);
393 if (ctx->obuf_len <= 0) 393 if (ctx->obuf_len <= 0)
394 { 394 {
395 ret=BIO_ctrl(b->next_bio,cmd,num,ptr); 395 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
396 break; 396 break;
397 } 397 }
398 398
399 for (;;) 399 for (;;)
400 { 400 {
401 BIO_clear_retry_flags(b); 401 BIO_clear_retry_flags(b);
402 » » » if (ctx->obuf_len > ctx->obuf_off) 402 » » » if (ctx->obuf_len > 0)
403 { 403 {
404 r=BIO_write(b->next_bio, 404 r=BIO_write(b->next_bio,
405 &(ctx->obuf[ctx->obuf_off]), 405 &(ctx->obuf[ctx->obuf_off]),
406 » » » » » ctx->obuf_len-ctx->obuf_off); 406 » » » » » ctx->obuf_len);
407 #if 0 407 #if 0
408 fprintf(stderr,"FLUSH [%3d] %3d -> %3d\n",ctx->obuf_off,ctx->obuf_len-ctx->obuf_ off,r); 408 fprintf(stderr,"FLUSH [%3d] %3d -> %3d\n",ctx->obuf_off,ctx->obuf_len,r);
409 #endif 409 #endif
410 BIO_copy_next_retry(b); 410 BIO_copy_next_retry(b);
411 if (r <= 0) return((long)r); 411 if (r <= 0) return((long)r);
412 ctx->obuf_off+=r; 412 ctx->obuf_off+=r;
413 ctx->obuf_len-=r;
413 } 414 }
414 else 415 else
415 { 416 {
416 ctx->obuf_len=0; 417 ctx->obuf_len=0;
417 ctx->obuf_off=0; 418 ctx->obuf_off=0;
418 ret=1; 419 ret=1;
419 break; 420 break;
420 } 421 }
421 } 422 }
422 ret=BIO_ctrl(b->next_bio,cmd,num,ptr); 423 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 ctx->ibuf_off=0; 503 ctx->ibuf_off=0;
503 } 504 }
504 } 505 }
505 } 506 }
506 507
507 static int buffer_puts(BIO *b, const char *str) 508 static int buffer_puts(BIO *b, const char *str)
508 { 509 {
509 return(buffer_write(b,str,strlen(str))); 510 return(buffer_write(b,str,strlen(str)));
510 } 511 }
511 512
OLDNEW
« no previous file with comments | « openssl/crypto/bio/b_sock.c ('k') | openssl/crypto/bio/bf_nbio.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698