Lines Matching refs:ctx

179 	BIO_OK_CTX *ctx;
181 ctx=(BIO_OK_CTX *)OPENSSL_malloc(sizeof(BIO_OK_CTX));
182 if (ctx == NULL) return(0);
184 ctx->buf_len=0;
185 ctx->buf_off=0;
186 ctx->buf_len_save=0;
187 ctx->buf_off_save=0;
188 ctx->cont=1;
189 ctx->finished=0;
190 ctx->blockout= 0;
191 ctx->sigio=1;
193 EVP_MD_CTX_init(&ctx->md);
196 bi->ptr=(char *)ctx;
216 BIO_OK_CTX *ctx;
219 ctx=(BIO_OK_CTX *)b->ptr;
221 if ((ctx == NULL) || (b->next_bio == NULL) || (b->init == 0)) return(0);
227 if (ctx->blockout)
229 i=ctx->buf_len-ctx->buf_off;
231 memcpy(out,&(ctx->buf[ctx->buf_off]),i);
235 ctx->buf_off+=i;
238 if (ctx->buf_len == ctx->buf_off)
240 ctx->buf_off=0;
243 if(ctx->buf_len_save- ctx->buf_off_save > 0)
245 ctx->buf_len= ctx->buf_len_save- ctx->buf_off_save;
246 memmove(ctx->buf, &(ctx->buf[ctx->buf_off_save]),
247 ctx->buf_len);
251 ctx->buf_len=0;
253 ctx->blockout= 0;
261 n=IOBS- ctx->buf_len;
262 i=BIO_read(b->next_bio,&(ctx->buf[ctx->buf_len]),n);
266 ctx->buf_len+= i;
269 if (ctx->sigio == 1)
279 if (ctx->sigio == 0)
289 if (ctx->cont <= 0) break;
301 BIO_OK_CTX *ctx;
305 ctx=(BIO_OK_CTX *)b->ptr;
308 if ((ctx == NULL) || (b->next_bio == NULL) || (b->init == 0)) return(0);
310 if(ctx->sigio && !sig_out(b))
315 n=ctx->buf_len-ctx->buf_off;
316 while (ctx->blockout && n > 0)
318 i=BIO_write(b->next_bio,&(ctx->buf[ctx->buf_off]),n);
323 ctx->cont= 0;
326 ctx->buf_off+=i;
331 ctx->blockout= 0;
332 if (ctx->buf_len == ctx->buf_off)
334 ctx->buf_len=OK_BLOCK_BLOCK;
335 ctx->buf_off=0;
340 n= (inl+ ctx->buf_len > OK_BLOCK_SIZE+ OK_BLOCK_BLOCK) ?
341 (int)(OK_BLOCK_SIZE+OK_BLOCK_BLOCK-ctx->buf_len) : inl;
343 memcpy((unsigned char *)(&(ctx->buf[ctx->buf_len])),(unsigned char *)in,n);
344 ctx->buf_len+= n;
348 if(ctx->buf_len >= OK_BLOCK_SIZE+ OK_BLOCK_BLOCK)
365 BIO_OK_CTX *ctx;
371 ctx=b->ptr;
376 ctx->buf_len=0;
377 ctx->buf_off=0;
378 ctx->buf_len_save=0;
379 ctx->buf_off_save=0;
380 ctx->cont=1;
381 ctx->finished=0;
382 ctx->blockout= 0;
383 ctx->sigio=1;
387 if (ctx->cont <= 0)
394 ret=ctx->blockout ? ctx->buf_len-ctx->buf_off : 0;
400 if(ctx->blockout == 0)
404 while (ctx->blockout)
414 ctx->finished=1;
415 ctx->buf_off=ctx->buf_len=0;
416 ctx->cont=(int)ret;
427 ret=(long)ctx->cont;
431 if (!EVP_DigestInit_ex(&ctx->md, md, NULL))
439 *ppmd=ctx->md.digest;
481 BIO_OK_CTX *ctx;
484 ctx=b->ptr;
485 md=&ctx->md;
487 if(ctx->buf_len+ 2* md->digest->md_size > OK_BLOCK_SIZE) return 1;
495 memcpy(&(ctx->buf[ctx->buf_len]), md->md_data, md->digest->md_size);
496 longswap(&(ctx->buf[ctx->buf_len]), md->digest->md_size);
497 ctx->buf_len+= md->digest->md_size;
501 if (!EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL))
503 ctx->buf_len+= md->digest->md_size;
504 ctx->blockout= 1;
505 ctx->sigio= 0;
514 BIO_OK_CTX *ctx;
519 ctx=b->ptr;
520 md=&ctx->md;
522 if((int)(ctx->buf_len-ctx->buf_off) < 2*md->digest->md_size) return 1;
526 memcpy(md->md_data, &(ctx->buf[ctx->buf_off]), md->digest->md_size);
528 ctx->buf_off+= md->digest->md_size;
534 ret= memcmp(&(ctx->buf[ctx->buf_off]), tmp, md->digest->md_size) == 0;
535 ctx->buf_off+= md->digest->md_size;
538 ctx->sigio= 0;
539 if(ctx->buf_len != ctx->buf_off)
541 memmove(ctx->buf, &(ctx->buf[ctx->buf_off]), ctx->buf_len- ctx->buf_off);
543 ctx->buf_len-= ctx->buf_off;
544 ctx->buf_off= 0;
548 ctx->cont= 0;
558 BIO_OK_CTX *ctx;
562 ctx=b->ptr;
563 md=&ctx->md;
565 tl= ctx->buf_len- OK_BLOCK_BLOCK;
566 ctx->buf[0]=(unsigned char)(tl>>24);
567 ctx->buf[1]=(unsigned char)(tl>>16);
568 ctx->buf[2]=(unsigned char)(tl>>8);
569 ctx->buf[3]=(unsigned char)(tl);
571 (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl))
573 if (!EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL))
575 ctx->buf_len+= md->digest->md_size;
576 ctx->blockout= 1;
585 BIO_OK_CTX *ctx;
590 ctx=b->ptr;
591 md=&ctx->md;
594 tl =ctx->buf[0]; tl<<=8;
595 tl|=ctx->buf[1]; tl<<=8;
596 tl|=ctx->buf[2]; tl<<=8;
597 tl|=ctx->buf[3];
599 if (ctx->buf_len < tl+ OK_BLOCK_BLOCK+ md->digest->md_size) return 1;
602 (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl))
606 if(memcmp(&(ctx->buf[tl+ OK_BLOCK_BLOCK]), tmp, md->digest->md_size) == 0)
609 ctx->buf_off_save= tl+ OK_BLOCK_BLOCK+ md->digest->md_size;
610 ctx->buf_len_save= ctx->buf_len;
611 ctx->buf_off= OK_BLOCK_BLOCK;
612 ctx->buf_len= tl+ OK_BLOCK_BLOCK;
613 ctx->blockout= 1;
617 ctx->cont= 0;