diff options
Diffstat (limited to 'crypto/deflate.c')
-rw-r--r-- | crypto/deflate.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/crypto/deflate.c b/crypto/deflate.c index 9128da44e953..463dc859aa05 100644 --- a/crypto/deflate.c +++ b/crypto/deflate.c | |||
@@ -1,14 +1,14 @@ | |||
1 | /* | 1 | /* |
2 | * Cryptographic API. | 2 | * Cryptographic API. |
3 | * | 3 | * |
4 | * Deflate algorithm (RFC 1951), implemented here primarily for use | 4 | * Deflate algorithm (RFC 1951), implemented here primarily for use |
5 | * by IPCOMP (RFC 3173 & RFC 2394). | 5 | * by IPCOMP (RFC 3173 & RFC 2394). |
6 | * | 6 | * |
7 | * Copyright (c) 2003 James Morris <jmorris@intercode.com.au> | 7 | * Copyright (c) 2003 James Morris <jmorris@intercode.com.au> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify it | 9 | * This program is free software; you can redistribute it and/or modify it |
10 | * under the terms of the GNU General Public License as published by the Free | 10 | * under the terms of the GNU General Public License as published by the Free |
11 | * Software Foundation; either version 2 of the License, or (at your option) | 11 | * Software Foundation; either version 2 of the License, or (at your option) |
12 | * any later version. | 12 | * any later version. |
13 | * | 13 | * |
14 | * FIXME: deflate transforms will require up to a total of about 436k of kernel | 14 | * FIXME: deflate transforms will require up to a total of about 436k of kernel |
@@ -49,7 +49,7 @@ static int deflate_comp_init(struct deflate_ctx *ctx) | |||
49 | struct z_stream_s *stream = &ctx->comp_stream; | 49 | struct z_stream_s *stream = &ctx->comp_stream; |
50 | 50 | ||
51 | stream->workspace = vmalloc(zlib_deflate_workspacesize()); | 51 | stream->workspace = vmalloc(zlib_deflate_workspacesize()); |
52 | if (!stream->workspace ) { | 52 | if (!stream->workspace) { |
53 | ret = -ENOMEM; | 53 | ret = -ENOMEM; |
54 | goto out; | 54 | goto out; |
55 | } | 55 | } |
@@ -61,7 +61,7 @@ static int deflate_comp_init(struct deflate_ctx *ctx) | |||
61 | ret = -EINVAL; | 61 | ret = -EINVAL; |
62 | goto out_free; | 62 | goto out_free; |
63 | } | 63 | } |
64 | out: | 64 | out: |
65 | return ret; | 65 | return ret; |
66 | out_free: | 66 | out_free: |
67 | vfree(stream->workspace); | 67 | vfree(stream->workspace); |
@@ -74,7 +74,7 @@ static int deflate_decomp_init(struct deflate_ctx *ctx) | |||
74 | struct z_stream_s *stream = &ctx->decomp_stream; | 74 | struct z_stream_s *stream = &ctx->decomp_stream; |
75 | 75 | ||
76 | stream->workspace = kzalloc(zlib_inflate_workspacesize(), GFP_KERNEL); | 76 | stream->workspace = kzalloc(zlib_inflate_workspacesize(), GFP_KERNEL); |
77 | if (!stream->workspace ) { | 77 | if (!stream->workspace) { |
78 | ret = -ENOMEM; | 78 | ret = -ENOMEM; |
79 | goto out; | 79 | goto out; |
80 | } | 80 | } |
@@ -106,7 +106,7 @@ static int deflate_init(struct crypto_tfm *tfm) | |||
106 | { | 106 | { |
107 | struct deflate_ctx *ctx = crypto_tfm_ctx(tfm); | 107 | struct deflate_ctx *ctx = crypto_tfm_ctx(tfm); |
108 | int ret; | 108 | int ret; |
109 | 109 | ||
110 | ret = deflate_comp_init(ctx); | 110 | ret = deflate_comp_init(ctx); |
111 | if (ret) | 111 | if (ret) |
112 | goto out; | 112 | goto out; |
@@ -153,11 +153,11 @@ static int deflate_compress(struct crypto_tfm *tfm, const u8 *src, | |||
153 | out: | 153 | out: |
154 | return ret; | 154 | return ret; |
155 | } | 155 | } |
156 | 156 | ||
157 | static int deflate_decompress(struct crypto_tfm *tfm, const u8 *src, | 157 | static int deflate_decompress(struct crypto_tfm *tfm, const u8 *src, |
158 | unsigned int slen, u8 *dst, unsigned int *dlen) | 158 | unsigned int slen, u8 *dst, unsigned int *dlen) |
159 | { | 159 | { |
160 | 160 | ||
161 | int ret = 0; | 161 | int ret = 0; |
162 | struct deflate_ctx *dctx = crypto_tfm_ctx(tfm); | 162 | struct deflate_ctx *dctx = crypto_tfm_ctx(tfm); |
163 | struct z_stream_s *stream = &dctx->decomp_stream; | 163 | struct z_stream_s *stream = &dctx->decomp_stream; |
@@ -182,7 +182,7 @@ static int deflate_decompress(struct crypto_tfm *tfm, const u8 *src, | |||
182 | if (ret == Z_OK && !stream->avail_in && stream->avail_out) { | 182 | if (ret == Z_OK && !stream->avail_in && stream->avail_out) { |
183 | u8 zerostuff = 0; | 183 | u8 zerostuff = 0; |
184 | stream->next_in = &zerostuff; | 184 | stream->next_in = &zerostuff; |
185 | stream->avail_in = 1; | 185 | stream->avail_in = 1; |
186 | ret = zlib_inflate(stream, Z_FINISH); | 186 | ret = zlib_inflate(stream, Z_FINISH); |
187 | } | 187 | } |
188 | if (ret != Z_STREAM_END) { | 188 | if (ret != Z_STREAM_END) { |