Lines Matching refs:ctx
38 static int zlib_stateful_init(COMP_CTX *ctx);
39 static void zlib_stateful_finish(COMP_CTX *ctx);
40 static int zlib_stateful_compress_block(COMP_CTX *ctx, unsigned char *out,
43 static int zlib_stateful_expand_block(COMP_CTX *ctx, unsigned char *out,
123 static int zlib_stateful_init(COMP_CTX *ctx)
150 ctx->data = state;
157 static void zlib_stateful_finish(COMP_CTX *ctx)
159 struct zlib_state *state = ctx->data;
165 static int zlib_stateful_compress_block(COMP_CTX *ctx, unsigned char *out,
170 struct zlib_state *state = ctx->data;
186 static int zlib_stateful_expand_block(COMP_CTX *ctx, unsigned char *out,
191 struct zlib_state *state = ctx->data;
315 BIO_ZLIB_CTX *ctx;
323 ctx = OPENSSL_zalloc(sizeof(*ctx));
324 if (ctx == NULL) {
328 ctx->ibufsize = ZLIB_DEFAULT_BUFSIZE;
329 ctx->obufsize = ZLIB_DEFAULT_BUFSIZE;
330 ctx->zin.zalloc = Z_NULL;
331 ctx->zin.zfree = Z_NULL;
332 ctx->zout.zalloc = Z_NULL;
333 ctx->zout.zfree = Z_NULL;
334 ctx->comp_level = Z_DEFAULT_COMPRESSION;
336 BIO_set_data(bi, ctx);
343 BIO_ZLIB_CTX *ctx;
347 ctx = BIO_get_data(bi);
348 if (ctx->ibuf) {
350 inflateEnd(&ctx->zin);
351 OPENSSL_free(ctx->ibuf);
353 if (ctx->obuf) {
355 deflateEnd(&ctx->zout);
356 OPENSSL_free(ctx->obuf);
358 OPENSSL_free(ctx);
367 BIO_ZLIB_CTX *ctx;
374 ctx = BIO_get_data(b);
375 zin = &ctx->zin;
377 if (!ctx->ibuf) {
378 ctx->ibuf = OPENSSL_malloc(ctx->ibufsize);
379 if (ctx->ibuf == NULL) {
388 zin->next_in = ctx->ibuf;
413 ret = BIO_read(next, ctx->ibuf, ctx->ibufsize);
423 zin->next_in = ctx->ibuf;
429 BIO_ZLIB_CTX *ctx;
436 ctx = BIO_get_data(b);
437 if (ctx->odone)
439 zout = &ctx->zout;
441 if (!ctx->obuf) {
442 ctx->obuf = OPENSSL_malloc(ctx->obufsize);
444 if (ctx->obuf == NULL) {
448 ctx->optr = ctx->obuf;
449 ctx->ocount = 0;
450 if ((ret = deflateInit(zout, ctx->comp_level)) != Z_OK) {
455 zout->next_out = ctx->obuf;
456 zout->avail_out = ctx->obufsize;
463 while (ctx->ocount) {
464 ret = BIO_write(next, ctx->optr, ctx->ocount);
473 ctx->optr += ret;
474 ctx->ocount -= ret;
484 ctx->optr = ctx->obuf;
485 zout->next_out = ctx->obuf;
486 zout->avail_out = ctx->obufsize;
494 ctx->ocount = ctx->obufsize - zout->avail_out;
500 BIO_ZLIB_CTX *ctx;
505 ctx = BIO_get_data(b);
507 if (!ctx->obuf || (ctx->odone && !ctx->ocount))
509 zout = &ctx->zout;
516 while (ctx->ocount) {
517 ret = BIO_write(next, ctx->optr, ctx->ocount);
522 ctx->optr += ret;
523 ctx->ocount -= ret;
525 if (ctx->odone)
531 ctx->optr = ctx->obuf;
532 zout->next_out = ctx->obuf;
533 zout->avail_out = ctx->obufsize;
537 ctx->odone = 1;
543 ctx->ocount = ctx->obufsize - zout->avail_out;
549 BIO_ZLIB_CTX *ctx;
556 ctx = BIO_get_data(b);
560 ctx->ocount = 0;
561 ctx->odone = 0;
586 OPENSSL_free(ctx->ibuf);
587 ctx->ibuf = NULL;
588 ctx->ibufsize = ibs;
592 OPENSSL_free(ctx->obuf);
593 ctx->obuf = NULL;
594 ctx->obufsize = obs;
606 if (ctx->obuf == NULL)
609 if (ctx->odone) {
610 ret = ctx->ocount;
612 ret = ctx->ocount;
622 ret = ctx->zin.avail_in;