git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
random: Add optional continuous repetition test to entropy store based rngs
[safe/jmp/linux-2.6]
/
crypto
/
deflate.c
diff --git
a/crypto/deflate.c
b/crypto/deflate.c
index
77d7655
..
9128da4
100644
(file)
--- a/
crypto/deflate.c
+++ b/
crypto/deflate.c
@@
-73,12
+73,11
@@
static int deflate_decomp_init(struct deflate_ctx *ctx)
int ret = 0;
struct z_stream_s *stream = &ctx->decomp_stream;
int ret = 0;
struct z_stream_s *stream = &ctx->decomp_stream;
- stream->workspace = k
m
alloc(zlib_inflate_workspacesize(), GFP_KERNEL);
+ stream->workspace = k
z
alloc(zlib_inflate_workspacesize(), GFP_KERNEL);
if (!stream->workspace ) {
ret = -ENOMEM;
goto out;
}
if (!stream->workspace ) {
ret = -ENOMEM;
goto out;
}
- memset(stream->workspace, 0, zlib_inflate_workspacesize());
ret = zlib_inflateInit2(stream, -DEFLATE_DEF_WINBITS);
if (ret != Z_OK) {
ret = -EINVAL;
ret = zlib_inflateInit2(stream, -DEFLATE_DEF_WINBITS);
if (ret != Z_OK) {
ret = -EINVAL;
@@
-93,16
+92,19
@@
out_free:
static void deflate_comp_exit(struct deflate_ctx *ctx)
{
static void deflate_comp_exit(struct deflate_ctx *ctx)
{
+ zlib_deflateEnd(&ctx->comp_stream);
vfree(ctx->comp_stream.workspace);
}
static void deflate_decomp_exit(struct deflate_ctx *ctx)
{
vfree(ctx->comp_stream.workspace);
}
static void deflate_decomp_exit(struct deflate_ctx *ctx)
{
+ zlib_inflateEnd(&ctx->decomp_stream);
kfree(ctx->decomp_stream.workspace);
}
kfree(ctx->decomp_stream.workspace);
}
-static int deflate_init(
void *ctx
)
+static int deflate_init(
struct crypto_tfm *tfm
)
{
{
+ struct deflate_ctx *ctx = crypto_tfm_ctx(tfm);
int ret;
ret = deflate_comp_init(ctx);
int ret;
ret = deflate_comp_init(ctx);
@@
-115,17
+117,19
@@
out:
return ret;
}
return ret;
}
-static void deflate_exit(
void *ctx
)
+static void deflate_exit(
struct crypto_tfm *tfm
)
{
{
+ struct deflate_ctx *ctx = crypto_tfm_ctx(tfm);
+
deflate_comp_exit(ctx);
deflate_decomp_exit(ctx);
}
deflate_comp_exit(ctx);
deflate_decomp_exit(ctx);
}
-static int deflate_compress(
void *ctx, const u8 *src, unsigned int slen
,
- u8 *dst, unsigned int *dlen)
+static int deflate_compress(
struct crypto_tfm *tfm, const u8 *src
,
+ u
nsigned int slen, u
8 *dst, unsigned int *dlen)
{
int ret = 0;
{
int ret = 0;
- struct deflate_ctx *dctx = c
tx
;
+ struct deflate_ctx *dctx = c
rypto_tfm_ctx(tfm)
;
struct z_stream_s *stream = &dctx->comp_stream;
ret = zlib_deflateReset(stream);
struct z_stream_s *stream = &dctx->comp_stream;
ret = zlib_deflateReset(stream);
@@
-150,12
+154,12
@@
out:
return ret;
}
return ret;
}
-static int deflate_decompress(
void *ctx, const u8 *src, unsigned int slen
,
- u8 *dst, unsigned int *dlen)
+static int deflate_decompress(
struct crypto_tfm *tfm, const u8 *src
,
+
unsigned int slen,
u8 *dst, unsigned int *dlen)
{
int ret = 0;
{
int ret = 0;
- struct deflate_ctx *dctx = c
tx
;
+ struct deflate_ctx *dctx = c
rypto_tfm_ctx(tfm)
;
struct z_stream_s *stream = &dctx->decomp_stream;
ret = zlib_inflateReset(stream);
struct z_stream_s *stream = &dctx->decomp_stream;
ret = zlib_inflateReset(stream);
@@
-197,25
+201,25
@@
static struct crypto_alg alg = {
.cra_ctxsize = sizeof(struct deflate_ctx),
.cra_module = THIS_MODULE,
.cra_list = LIST_HEAD_INIT(alg.cra_list),
.cra_ctxsize = sizeof(struct deflate_ctx),
.cra_module = THIS_MODULE,
.cra_list = LIST_HEAD_INIT(alg.cra_list),
+ .cra_init = deflate_init,
+ .cra_exit = deflate_exit,
.cra_u = { .compress = {
.cra_u = { .compress = {
- .coa_init = deflate_init,
- .coa_exit = deflate_exit,
.coa_compress = deflate_compress,
.coa_decompress = deflate_decompress } }
};
.coa_compress = deflate_compress,
.coa_decompress = deflate_decompress } }
};
-static int __init init(void)
+static int __init
deflate_mod_
init(void)
{
return crypto_register_alg(&alg);
}
{
return crypto_register_alg(&alg);
}
-static void __exit fini(void)
+static void __exit
deflate_mod_
fini(void)
{
crypto_unregister_alg(&alg);
}
{
crypto_unregister_alg(&alg);
}
-module_init(init);
-module_exit(fini);
+module_init(
deflate_mod_
init);
+module_exit(
deflate_mod_
fini);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Deflate Compression Algorithm for IPCOMP");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Deflate Compression Algorithm for IPCOMP");