4 #include <openssl/objects.h>
5 #include <openssl/comp.h>
7 COMP_CTX
*COMP_CTX_new(COMP_METHOD
*meth
)
11 if ((ret
=(COMP_CTX
*)OPENSSL_malloc(sizeof(COMP_CTX
))) == NULL
)
13 /* ZZZZZZZZZZZZZZZZ */
16 memset(ret
,0,sizeof(COMP_CTX
));
18 if ((ret
->meth
->init
!= NULL
) && !ret
->meth
->init(ret
))
26 void COMP_CTX_free(COMP_CTX
*ctx
)
31 if (ctx
->meth
->finish
!= NULL
)
32 ctx
->meth
->finish(ctx
);
37 int COMP_compress_block(COMP_CTX
*ctx
, unsigned char *out
, int olen
,
38 unsigned char *in
, int ilen
)
41 if (ctx
->meth
->compress
== NULL
)
43 /* ZZZZZZZZZZZZZZZZZ */
46 ret
=ctx
->meth
->compress(ctx
,out
,olen
,in
,ilen
);
49 ctx
->compress_in
+=ilen
;
50 ctx
->compress_out
+=ret
;
55 int COMP_expand_block(COMP_CTX
*ctx
, unsigned char *out
, int olen
,
56 unsigned char *in
, int ilen
)
60 if (ctx
->meth
->expand
== NULL
)
62 /* ZZZZZZZZZZZZZZZZZ */
65 ret
=ctx
->meth
->expand(ctx
,out
,olen
,in
,ilen
);