summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/comp/comp_lib.c
diff options
context:
space:
mode:
authorbeck <>1999-09-29 05:53:45 +0000
committerbeck <>1999-09-29 05:53:45 +0000
commit648e4f0876a3773381cbfff3192dd84dd1c8c925 (patch)
treebd9d01e3969ffa5aac92128af3e515520c88fc0e /src/lib/libcrypto/comp/comp_lib.c
parent756086c41b0487beefc3d5b3400f80095d0e4157 (diff)
downloadopenbsd-648e4f0876a3773381cbfff3192dd84dd1c8c925.tar.gz
openbsd-648e4f0876a3773381cbfff3192dd84dd1c8c925.tar.bz2
openbsd-648e4f0876a3773381cbfff3192dd84dd1c8c925.zip
new files for OpenSSL 0.9.4
Diffstat (limited to 'src/lib/libcrypto/comp/comp_lib.c')
-rw-r--r--src/lib/libcrypto/comp/comp_lib.c78
1 files changed, 78 insertions, 0 deletions
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
7COMP_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
30void 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
43int 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
61int 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 }