diff options
author | beck <> | 1999-09-29 05:53:45 +0000 |
---|---|---|
committer | beck <> | 1999-09-29 05:53:45 +0000 |
commit | 648e4f0876a3773381cbfff3192dd84dd1c8c925 (patch) | |
tree | bd9d01e3969ffa5aac92128af3e515520c88fc0e /src/lib/libcrypto/comp | |
parent | 756086c41b0487beefc3d5b3400f80095d0e4157 (diff) | |
download | openbsd-648e4f0876a3773381cbfff3192dd84dd1c8c925.tar.gz openbsd-648e4f0876a3773381cbfff3192dd84dd1c8c925.tar.bz2 openbsd-648e4f0876a3773381cbfff3192dd84dd1c8c925.zip |
new files for OpenSSL 0.9.4
Diffstat (limited to 'src/lib/libcrypto/comp')
-rw-r--r-- | src/lib/libcrypto/comp/Makefile.ssl | 99 | ||||
-rw-r--r-- | src/lib/libcrypto/comp/c_rle.c | 61 | ||||
-rw-r--r-- | src/lib/libcrypto/comp/c_zlib.c | 133 | ||||
-rw-r--r-- | src/lib/libcrypto/comp/comp.h | 60 | ||||
-rw-r--r-- | src/lib/libcrypto/comp/comp_err.c | 91 | ||||
-rw-r--r-- | src/lib/libcrypto/comp/comp_lib.c | 78 |
6 files changed, 522 insertions, 0 deletions
diff --git a/src/lib/libcrypto/comp/Makefile.ssl b/src/lib/libcrypto/comp/Makefile.ssl new file mode 100644 index 0000000000..d946bcbafa --- /dev/null +++ b/src/lib/libcrypto/comp/Makefile.ssl | |||
@@ -0,0 +1,99 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/comp/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= comp | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALL_PREFIX= | ||
11 | OPENSSLDIR= /usr/local/ssl | ||
12 | INSTALLTOP=/usr/local/ssl | ||
13 | MAKE= make -f Makefile.ssl | ||
14 | MAKEDEPEND= $(TOP)/util/domd $(TOP) | ||
15 | MAKEFILE= Makefile.ssl | ||
16 | AR= ar r | ||
17 | |||
18 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
19 | |||
20 | GENERAL=Makefile | ||
21 | TEST= | ||
22 | APPS= | ||
23 | |||
24 | LIB=$(TOP)/libcrypto.a | ||
25 | LIBSRC= comp_lib.c \ | ||
26 | c_rle.c c_zlib.c | ||
27 | |||
28 | LIBOBJ= comp_lib.o \ | ||
29 | c_rle.o c_zlib.o | ||
30 | |||
31 | SRC= $(LIBSRC) | ||
32 | |||
33 | EXHEADER= comp.h | ||
34 | HEADER= $(EXHEADER) | ||
35 | |||
36 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
37 | |||
38 | top: | ||
39 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
40 | |||
41 | all: lib | ||
42 | |||
43 | lib: $(LIBOBJ) | ||
44 | $(AR) $(LIB) $(LIBOBJ) | ||
45 | $(RANLIB) $(LIB) | ||
46 | @touch lib | ||
47 | |||
48 | files: | ||
49 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
50 | |||
51 | links: | ||
52 | @$(TOP)/util/point.sh Makefile.ssl Makefile | ||
53 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
54 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
55 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
56 | |||
57 | install: | ||
58 | @for i in $(EXHEADER) ; \ | ||
59 | do \ | ||
60 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
61 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
62 | done; | ||
63 | |||
64 | tags: | ||
65 | ctags $(SRC) | ||
66 | |||
67 | tests: | ||
68 | |||
69 | lint: | ||
70 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
71 | |||
72 | depend: | ||
73 | $(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(LIBSRC) | ||
74 | |||
75 | dclean: | ||
76 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
77 | mv -f Makefile.new $(MAKEFILE) | ||
78 | |||
79 | clean: | ||
80 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
81 | |||
82 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
83 | |||
84 | c_rle.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
85 | c_rle.o: ../../include/openssl/bn.h ../../include/openssl/comp.h | ||
86 | c_rle.o: ../../include/openssl/crypto.h ../../include/openssl/objects.h | ||
87 | c_rle.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
88 | c_rle.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
89 | c_zlib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
90 | c_zlib.o: ../../include/openssl/bn.h ../../include/openssl/comp.h | ||
91 | c_zlib.o: ../../include/openssl/crypto.h ../../include/openssl/objects.h | ||
92 | c_zlib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
93 | c_zlib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
94 | comp_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
95 | comp_lib.o: ../../include/openssl/bn.h ../../include/openssl/comp.h | ||
96 | comp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/objects.h | ||
97 | comp_lib.o: ../../include/openssl/opensslconf.h | ||
98 | comp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
99 | comp_lib.o: ../../include/openssl/stack.h | ||
diff --git a/src/lib/libcrypto/comp/c_rle.c b/src/lib/libcrypto/comp/c_rle.c new file mode 100644 index 0000000000..1a819e3737 --- /dev/null +++ b/src/lib/libcrypto/comp/c_rle.c | |||
@@ -0,0 +1,61 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | #include <string.h> | ||
4 | #include <openssl/objects.h> | ||
5 | #include <openssl/comp.h> | ||
6 | |||
7 | static int rle_compress_block(COMP_CTX *ctx, unsigned char *out, | ||
8 | unsigned int olen, unsigned char *in, unsigned int ilen); | ||
9 | static int rle_expand_block(COMP_CTX *ctx, unsigned char *out, | ||
10 | unsigned int olen, unsigned char *in, unsigned int ilen); | ||
11 | |||
12 | static COMP_METHOD rle_method={ | ||
13 | NID_rle_compression, | ||
14 | LN_rle_compression, | ||
15 | NULL, | ||
16 | NULL, | ||
17 | rle_compress_block, | ||
18 | rle_expand_block, | ||
19 | NULL, | ||
20 | }; | ||
21 | |||
22 | COMP_METHOD *COMP_rle(void) | ||
23 | { | ||
24 | return(&rle_method); | ||
25 | } | ||
26 | |||
27 | static int rle_compress_block(COMP_CTX *ctx, unsigned char *out, | ||
28 | unsigned int olen, unsigned char *in, unsigned int ilen) | ||
29 | { | ||
30 | /* int i; */ | ||
31 | |||
32 | if (olen < (ilen+1)) | ||
33 | { | ||
34 | /* ZZZZZZZZZZZZZZZZZZZZZZ */ | ||
35 | return(-1); | ||
36 | } | ||
37 | |||
38 | *(out++)=0; | ||
39 | memcpy(out,in,ilen); | ||
40 | return(ilen+1); | ||
41 | } | ||
42 | |||
43 | static int rle_expand_block(COMP_CTX *ctx, unsigned char *out, | ||
44 | unsigned int olen, unsigned char *in, unsigned int ilen) | ||
45 | { | ||
46 | int i; | ||
47 | |||
48 | if (olen < (ilen-1)) | ||
49 | { | ||
50 | /* ZZZZZZZZZZZZZZZZZZZZZZ */ | ||
51 | return(-1); | ||
52 | } | ||
53 | |||
54 | i= *(in++); | ||
55 | if (i == 0) | ||
56 | { | ||
57 | memcpy(out,in,ilen-1); | ||
58 | } | ||
59 | return(ilen-1); | ||
60 | } | ||
61 | |||
diff --git a/src/lib/libcrypto/comp/c_zlib.c b/src/lib/libcrypto/comp/c_zlib.c new file mode 100644 index 0000000000..6684ab4841 --- /dev/null +++ b/src/lib/libcrypto/comp/c_zlib.c | |||
@@ -0,0 +1,133 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | #include <string.h> | ||
4 | #include <openssl/objects.h> | ||
5 | #include <openssl/comp.h> | ||
6 | |||
7 | COMP_METHOD *COMP_zlib(void ); | ||
8 | |||
9 | #ifndef ZLIB | ||
10 | |||
11 | static COMP_METHOD zlib_method={ | ||
12 | NID_undef, | ||
13 | "(null)", | ||
14 | NULL, | ||
15 | NULL, | ||
16 | NULL, | ||
17 | NULL, | ||
18 | NULL, | ||
19 | }; | ||
20 | |||
21 | #else | ||
22 | |||
23 | #include <zlib.h> | ||
24 | |||
25 | static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out, | ||
26 | unsigned int olen, unsigned char *in, unsigned int ilen); | ||
27 | static int zlib_expand_block(COMP_CTX *ctx, unsigned char *out, | ||
28 | unsigned int olen, unsigned char *in, unsigned int ilen); | ||
29 | |||
30 | static int zz_uncompress(Bytef *dest, uLongf *destLen, const Bytef *source, | ||
31 | uLong sourceLen); | ||
32 | |||
33 | static COMP_METHOD zlib_method={ | ||
34 | NID_zlib_compression, | ||
35 | LN_zlib_compression, | ||
36 | NULL, | ||
37 | NULL, | ||
38 | zlib_compress_block, | ||
39 | zlib_expand_block, | ||
40 | NULL, | ||
41 | }; | ||
42 | |||
43 | static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out, | ||
44 | unsigned int olen, unsigned char *in, unsigned int ilen) | ||
45 | { | ||
46 | unsigned long l; | ||
47 | int i; | ||
48 | int clear=1; | ||
49 | |||
50 | if (ilen > 128) | ||
51 | { | ||
52 | out[0]=1; | ||
53 | l=olen-1; | ||
54 | i=compress(&(out[1]),&l,in,(unsigned long)ilen); | ||
55 | if (i != Z_OK) | ||
56 | return(-1); | ||
57 | if (ilen > l) | ||
58 | { | ||
59 | clear=0; | ||
60 | l++; | ||
61 | } | ||
62 | } | ||
63 | if (clear) | ||
64 | { | ||
65 | out[0]=0; | ||
66 | memcpy(&(out[1]),in,ilen); | ||
67 | l=ilen+1; | ||
68 | } | ||
69 | fprintf(stderr,"compress(%4d)->%4d %s\n",ilen,(int)l,(clear)?"clear":"zlib"); | ||
70 | return((int)l); | ||
71 | } | ||
72 | |||
73 | static int zlib_expand_block(COMP_CTX *ctx, unsigned char *out, | ||
74 | unsigned int olen, unsigned char *in, unsigned int ilen) | ||
75 | { | ||
76 | unsigned long l; | ||
77 | int i; | ||
78 | |||
79 | if (in[0]) | ||
80 | { | ||
81 | l=olen; | ||
82 | i=zz_uncompress(out,&l,&(in[1]),(unsigned long)ilen-1); | ||
83 | if (i != Z_OK) | ||
84 | return(-1); | ||
85 | } | ||
86 | else | ||
87 | { | ||
88 | memcpy(out,&(in[1]),ilen-1); | ||
89 | l=ilen-1; | ||
90 | } | ||
91 | fprintf(stderr,"expand (%4d)->%4d %s\n",ilen,(int)l,in[0]?"zlib":"clear"); | ||
92 | return((int)l); | ||
93 | } | ||
94 | |||
95 | static int zz_uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, | ||
96 | uLong sourceLen) | ||
97 | { | ||
98 | z_stream stream; | ||
99 | int err; | ||
100 | |||
101 | stream.next_in = (Bytef*)source; | ||
102 | stream.avail_in = (uInt)sourceLen; | ||
103 | /* Check for source > 64K on 16-bit machine: */ | ||
104 | if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; | ||
105 | |||
106 | stream.next_out = dest; | ||
107 | stream.avail_out = (uInt)*destLen; | ||
108 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; | ||
109 | |||
110 | stream.zalloc = (alloc_func)0; | ||
111 | stream.zfree = (free_func)0; | ||
112 | |||
113 | err = inflateInit(&stream); | ||
114 | if (err != Z_OK) return err; | ||
115 | |||
116 | err = inflate(&stream, Z_FINISH); | ||
117 | if (err != Z_STREAM_END) { | ||
118 | inflateEnd(&stream); | ||
119 | return err; | ||
120 | } | ||
121 | *destLen = stream.total_out; | ||
122 | |||
123 | err = inflateEnd(&stream); | ||
124 | return err; | ||
125 | } | ||
126 | |||
127 | #endif | ||
128 | |||
129 | COMP_METHOD *COMP_zlib(void) | ||
130 | { | ||
131 | return(&zlib_method); | ||
132 | } | ||
133 | |||
diff --git a/src/lib/libcrypto/comp/comp.h b/src/lib/libcrypto/comp/comp.h new file mode 100644 index 0000000000..93bd9c34c8 --- /dev/null +++ b/src/lib/libcrypto/comp/comp.h | |||
@@ -0,0 +1,60 @@ | |||
1 | |||
2 | #ifndef HEADER_COMP_H | ||
3 | #define HEADER_COMP_H | ||
4 | |||
5 | #ifdef __cplusplus | ||
6 | extern "C" { | ||
7 | #endif | ||
8 | |||
9 | #include <openssl/crypto.h> | ||
10 | |||
11 | typedef struct comp_method_st | ||
12 | { | ||
13 | int type; /* NID for compression library */ | ||
14 | const char *name; /* A text string to identify the library */ | ||
15 | int (*init)(); | ||
16 | void (*finish)(); | ||
17 | int (*compress)(); | ||
18 | int (*expand)(); | ||
19 | long (*ctrl)(); | ||
20 | } COMP_METHOD; | ||
21 | |||
22 | typedef struct comp_ctx_st | ||
23 | { | ||
24 | COMP_METHOD *meth; | ||
25 | unsigned long compress_in; | ||
26 | unsigned long compress_out; | ||
27 | unsigned long expand_in; | ||
28 | unsigned long expand_out; | ||
29 | |||
30 | CRYPTO_EX_DATA ex_data; | ||
31 | } COMP_CTX; | ||
32 | |||
33 | |||
34 | COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); | ||
35 | void COMP_CTX_free(COMP_CTX *ctx); | ||
36 | int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, | ||
37 | unsigned char *in, int ilen); | ||
38 | int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, | ||
39 | unsigned char *in, int ilen); | ||
40 | COMP_METHOD *COMP_rle(void ); | ||
41 | #ifdef ZLIB | ||
42 | COMP_METHOD *COMP_zlib(void ); | ||
43 | #endif | ||
44 | |||
45 | /* BEGIN ERROR CODES */ | ||
46 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
47 | * made after this point may be overwritten when the script is next run. | ||
48 | */ | ||
49 | |||
50 | /* Error codes for the COMP functions. */ | ||
51 | |||
52 | /* Function codes. */ | ||
53 | |||
54 | /* Reason codes. */ | ||
55 | |||
56 | #ifdef __cplusplus | ||
57 | } | ||
58 | #endif | ||
59 | #endif | ||
60 | |||
diff --git a/src/lib/libcrypto/comp/comp_err.c b/src/lib/libcrypto/comp/comp_err.c new file mode 100644 index 0000000000..77a3f7070c --- /dev/null +++ b/src/lib/libcrypto/comp/comp_err.c | |||
@@ -0,0 +1,91 @@ | |||
1 | /* crypto/comp/comp_err.c */ | ||
2 | /* ==================================================================== | ||
3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions | ||
7 | * are met: | ||
8 | * | ||
9 | * 1. Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * | ||
12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in | ||
14 | * the documentation and/or other materials provided with the | ||
15 | * distribution. | ||
16 | * | ||
17 | * 3. All advertising materials mentioning features or use of this | ||
18 | * software must display the following acknowledgment: | ||
19 | * "This product includes software developed by the OpenSSL Project | ||
20 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
21 | * | ||
22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
23 | * endorse or promote products derived from this software without | ||
24 | * prior written permission. For written permission, please contact | ||
25 | * openssl-core@OpenSSL.org. | ||
26 | * | ||
27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
28 | * nor may "OpenSSL" appear in their names without prior written | ||
29 | * permission of the OpenSSL Project. | ||
30 | * | ||
31 | * 6. Redistributions of any form whatsoever must retain the following | ||
32 | * acknowledgment: | ||
33 | * "This product includes software developed by the OpenSSL Project | ||
34 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
35 | * | ||
36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
48 | * ==================================================================== | ||
49 | * | ||
50 | * This product includes cryptographic software written by Eric Young | ||
51 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
52 | * Hudson (tjh@cryptsoft.com). | ||
53 | * | ||
54 | */ | ||
55 | |||
56 | /* NOTE: this file was auto generated by the mkerr.pl script: any changes | ||
57 | * made to it will be overwritten when the script next updates this file. | ||
58 | */ | ||
59 | |||
60 | #include <stdio.h> | ||
61 | #include <openssl/err.h> | ||
62 | #include <openssl/comp.h> | ||
63 | |||
64 | /* BEGIN ERROR CODES */ | ||
65 | #ifndef NO_ERR | ||
66 | static ERR_STRING_DATA COMP_str_functs[]= | ||
67 | { | ||
68 | {0,NULL} | ||
69 | }; | ||
70 | |||
71 | static ERR_STRING_DATA COMP_str_reasons[]= | ||
72 | { | ||
73 | {0,NULL} | ||
74 | }; | ||
75 | |||
76 | #endif | ||
77 | |||
78 | void ERR_load_COMP_strings(void) | ||
79 | { | ||
80 | static int init=1; | ||
81 | |||
82 | if (init) | ||
83 | { | ||
84 | init=0; | ||
85 | #ifndef NO_ERR | ||
86 | ERR_load_strings(ERR_LIB_COMP,COMP_str_functs); | ||
87 | ERR_load_strings(ERR_LIB_COMP,COMP_str_reasons); | ||
88 | #endif | ||
89 | |||
90 | } | ||
91 | } | ||
diff --git a/src/lib/libcrypto/comp/comp_lib.c b/src/lib/libcrypto/comp/comp_lib.c new file mode 100644 index 0000000000..a67ef23bc0 --- /dev/null +++ b/src/lib/libcrypto/comp/comp_lib.c | |||
@@ -0,0 +1,78 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | #include <string.h> | ||
4 | #include <openssl/objects.h> | ||
5 | #include <openssl/comp.h> | ||
6 | |||
7 | COMP_CTX *COMP_CTX_new(COMP_METHOD *meth) | ||
8 | { | ||
9 | COMP_CTX *ret; | ||
10 | |||
11 | if ((ret=(COMP_CTX *)Malloc(sizeof(COMP_CTX))) == NULL) | ||
12 | { | ||
13 | /* ZZZZZZZZZZZZZZZZ */ | ||
14 | return(NULL); | ||
15 | } | ||
16 | memset(ret,0,sizeof(COMP_CTX)); | ||
17 | ret->meth=meth; | ||
18 | if ((ret->meth->init != NULL) && !ret->meth->init(ret)) | ||
19 | { | ||
20 | Free(ret); | ||
21 | ret=NULL; | ||
22 | } | ||
23 | #if 0 | ||
24 | else | ||
25 | CRYPTO_new_ex_data(rsa_meth,(char *)ret,&ret->ex_data); | ||
26 | #endif | ||
27 | return(ret); | ||
28 | } | ||
29 | |||
30 | void COMP_CTX_free(COMP_CTX *ctx) | ||
31 | { | ||
32 | /* CRYPTO_free_ex_data(rsa_meth,(char *)ctx,&ctx->ex_data); */ | ||
33 | |||
34 | if(ctx == NULL) | ||
35 | return; | ||
36 | |||
37 | if (ctx->meth->finish != NULL) | ||
38 | ctx->meth->finish(ctx); | ||
39 | |||
40 | Free(ctx); | ||
41 | } | ||
42 | |||
43 | int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, | ||
44 | unsigned char *in, int ilen) | ||
45 | { | ||
46 | int ret; | ||
47 | if (ctx->meth->compress == NULL) | ||
48 | { | ||
49 | /* ZZZZZZZZZZZZZZZZZ */ | ||
50 | return(-1); | ||
51 | } | ||
52 | ret=ctx->meth->compress(ctx,out,olen,in,ilen); | ||
53 | if (ret > 0) | ||
54 | { | ||
55 | ctx->compress_in+=ilen; | ||
56 | ctx->compress_out+=ret; | ||
57 | } | ||
58 | return(ret); | ||
59 | } | ||
60 | |||
61 | int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, | ||
62 | unsigned char *in, int ilen) | ||
63 | { | ||
64 | int ret; | ||
65 | |||
66 | if (ctx->meth->expand == NULL) | ||
67 | { | ||
68 | /* ZZZZZZZZZZZZZZZZZ */ | ||
69 | return(-1); | ||
70 | } | ||
71 | ret=ctx->meth->expand(ctx,out,olen,in,ilen); | ||
72 | if (ret > 0) | ||
73 | { | ||
74 | ctx->expand_in+=ilen; | ||
75 | ctx->expand_out+=ret; | ||
76 | } | ||
77 | return(ret); | ||
78 | } | ||