]>
git.ipfire.org Git - thirdparty/openssl.git/blob - crypto/comp/comp_lib.c
42d99364a9641436335c4454261bfed6844e63d3
4 #include <openssl/objects.h>
5 #include <openssl/comp.h>
7 COMP_CTX
*COMP_CTX_new(COMP_METHOD
*meth
)
11 if ((ret
= OPENSSL_malloc(sizeof(*ret
))) == NULL
) {
12 /* ZZZZZZZZZZZZZZZZ */
15 memset(ret
, 0, sizeof(*ret
));
17 if ((ret
->meth
->init
!= NULL
) && !ret
->meth
->init(ret
)) {
24 void COMP_CTX_free(COMP_CTX
*ctx
)
29 if (ctx
->meth
->finish
!= NULL
)
30 ctx
->meth
->finish(ctx
);
35 int COMP_compress_block(COMP_CTX
*ctx
, unsigned char *out
, int olen
,
36 unsigned char *in
, int ilen
)
39 if (ctx
->meth
->compress
== NULL
) {
40 /* ZZZZZZZZZZZZZZZZZ */
43 ret
= ctx
->meth
->compress(ctx
, out
, olen
, in
, ilen
);
45 ctx
->compress_in
+= ilen
;
46 ctx
->compress_out
+= ret
;
51 int COMP_expand_block(COMP_CTX
*ctx
, unsigned char *out
, int olen
,
52 unsigned char *in
, int ilen
)
56 if (ctx
->meth
->expand
== NULL
) {
57 /* ZZZZZZZZZZZZZZZZZ */
60 ret
= ctx
->meth
->expand(ctx
, out
, olen
, in
, ilen
);
62 ctx
->expand_in
+= ilen
;
63 ctx
->expand_out
+= ret
;