Lines Matching full:ctx
27 static int zlib_stateful_init(COMP_CTX *ctx);
28 static void zlib_stateful_finish(COMP_CTX *ctx);
29 static int zlib_stateful_compress_block(COMP_CTX *ctx, unsigned char *out,
31 static int zlib_stateful_expand_block(COMP_CTX *ctx, unsigned char *out,
53 static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out,
55 static int zlib_expand_block(COMP_CTX *ctx, unsigned char *out,
139 static int zlib_stateful_init(COMP_CTX *ctx)
172 CRYPTO_new_ex_data(CRYPTO_EX_INDEX_COMP,ctx,&ctx->ex_data);
173 CRYPTO_set_ex_data(&ctx->ex_data,zlib_stateful_ex_idx,state);
180 static void zlib_stateful_finish(COMP_CTX *ctx)
183 (struct zlib_state *)CRYPTO_get_ex_data(&ctx->ex_data,
188 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_COMP,ctx,&ctx->ex_data);
191 static int zlib_stateful_compress_block(COMP_CTX *ctx, unsigned char *out,
196 (struct zlib_state *)CRYPTO_get_ex_data(&ctx->ex_data,
218 static int zlib_stateful_expand_block(COMP_CTX *ctx, unsigned char *out,
224 (struct zlib_state *)CRYPTO_get_ex_data(&ctx->ex_data,
247 static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out,
280 static int zlib_expand_block(COMP_CTX *ctx, unsigned char *out,
473 BIO_ZLIB_CTX *ctx;
482 ctx = OPENSSL_malloc(sizeof(BIO_ZLIB_CTX));
483 if(!ctx)
488 ctx->ibuf = NULL;
489 ctx->obuf = NULL;
490 ctx->ibufsize = ZLIB_DEFAULT_BUFSIZE;
491 ctx->obufsize = ZLIB_DEFAULT_BUFSIZE;
492 ctx->zin.zalloc = Z_NULL;
493 ctx->zin.zfree = Z_NULL;
494 ctx->zin.next_in = NULL;
495 ctx->zin.avail_in = 0;
496 ctx->zin.next_out = NULL;
497 ctx->zin.avail_out = 0;
498 ctx->zout.zalloc = Z_NULL;
499 ctx->zout.zfree = Z_NULL;
500 ctx->zout.next_in = NULL;
501 ctx->zout.avail_in = 0;
502 ctx->zout.next_out = NULL;
503 ctx->zout.avail_out = 0;
504 ctx->odone = 0;
505 ctx->comp_level = Z_DEFAULT_COMPRESSION;
507 bi->ptr = (char *)ctx;
514 BIO_ZLIB_CTX *ctx;
516 ctx = (BIO_ZLIB_CTX *)bi->ptr;
517 if(ctx->ibuf)
520 inflateEnd(&ctx->zin);
521 OPENSSL_free(ctx->ibuf);
523 if(ctx->obuf)
526 deflateEnd(&ctx->zout);
527 OPENSSL_free(ctx->obuf);
529 OPENSSL_free(ctx);
538 BIO_ZLIB_CTX *ctx;
542 ctx = (BIO_ZLIB_CTX *)b->ptr;
543 zin = &ctx->zin;
545 if(!ctx->ibuf)
547 ctx->ibuf = OPENSSL_malloc(ctx->ibufsize);
548 if(!ctx->ibuf)
554 zin->next_in = ctx->ibuf;
583 ret = BIO_read(b->next_bio, ctx->ibuf, ctx->ibufsize);
593 zin->next_in = ctx->ibuf;
599 BIO_ZLIB_CTX *ctx;
603 ctx = (BIO_ZLIB_CTX *)b->ptr;
604 if(ctx->odone) return 0;
605 zout = &ctx->zout;
607 if(!ctx->obuf)
609 ctx->obuf = OPENSSL_malloc(ctx->obufsize);
611 if(!ctx->obuf)
616 ctx->optr = ctx->obuf;
617 ctx->ocount = 0;
618 deflateInit(zout, ctx->comp_level);
619 zout->next_out = ctx->obuf;
620 zout->avail_out = ctx->obufsize;
628 while(ctx->ocount) {
629 ret = BIO_write(b->next_bio, ctx->optr, ctx->ocount);
638 ctx->optr += ret;
639 ctx->ocount -= ret;
649 ctx->optr = ctx->obuf;
650 zout->next_out = ctx->obuf;
651 zout->avail_out = ctx->obufsize;
661 ctx->ocount = ctx->obufsize - zout->avail_out;
667 BIO_ZLIB_CTX *ctx;
670 ctx = (BIO_ZLIB_CTX *)b->ptr;
672 if(!ctx->obuf || (ctx->odone && !ctx->ocount)) return 1;
673 zout = &ctx->zout;
681 while(ctx->ocount)
683 ret = BIO_write(b->next_bio, ctx->optr, ctx->ocount);
689 ctx->optr += ret;
690 ctx->ocount -= ret;
692 if(ctx->odone) return 1;
697 ctx->optr = ctx->obuf;
698 zout->next_out = ctx->obuf;
699 ctx->obufsize;
702 if(ret == Z_STREAM_END) ctx->odone = 1;
710 ctx->ocount = ctx->obufsize - zout->avail_out;
716 BIO_ZLIB_CTX *ctx;
720 ctx = (BIO_ZLIB_CTX *)b->ptr;
725 ctx->ocount = 0;
726 ctx->odone = 0;
755 if (ctx->ibuf)
757 OPENSSL_free(ctx->ibuf);
758 ctx->ibuf = NULL;
760 ctx->ibufsize = ibs;
765 if (ctx->obuf)
767 OPENSSL_free(ctx->obuf);
768 ctx->obuf = NULL;
770 ctx->obufsize = obs;