deflate.c (5800571960234f9d1f1011bf135799b2014d4268) deflate.c (d6ebf5286f8f94a254a8c90d4b9f2a8b076a8634)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Cryptographic API.
4 *
5 * Deflate algorithm (RFC 1951), implemented here primarily for use
6 * by IPCOMP (RFC 3173 & RFC 2394).
7 *
8 * Copyright (c) 2003 James Morris <jmorris@intercode.com.au>
9 *
1/*
2 * Cryptographic API.
3 *
4 * Deflate algorithm (RFC 1951), implemented here primarily for use
5 * by IPCOMP (RFC 3173 & RFC 2394).
6 *
7 * Copyright (c) 2003 James Morris <jmorris@intercode.com.au>
8 *
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
11 * Software Foundation; either version 2 of the License, or (at your option)
12 * any later version.
13 *
10 * FIXME: deflate transforms will require up to a total of about 436k of kernel
11 * memory on i386 (390k for compression, the rest for decompression), as the
12 * current zlib kernel code uses a worst case pre-allocation system by default.
13 * This needs to be fixed so that the amount of memory required is properly
14 * related to the winbits and memlevel parameters.
15 *
16 * The default winbits of 11 should suit most packets, and it may be something
17 * to configure on a per-tfm basis in the future.

--- 252 unchanged lines hidden (view full) ---

270 unsigned int slen, u8 *dst, unsigned int *dlen,
271 void *ctx)
272{
273 return __deflate_decompress(src, slen, dst, dlen, ctx);
274}
275
276static struct crypto_alg alg = {
277 .cra_name = "deflate",
14 * FIXME: deflate transforms will require up to a total of about 436k of kernel
15 * memory on i386 (390k for compression, the rest for decompression), as the
16 * current zlib kernel code uses a worst case pre-allocation system by default.
17 * This needs to be fixed so that the amount of memory required is properly
18 * related to the winbits and memlevel parameters.
19 *
20 * The default winbits of 11 should suit most packets, and it may be something
21 * to configure on a per-tfm basis in the future.

--- 252 unchanged lines hidden (view full) ---

274 unsigned int slen, u8 *dst, unsigned int *dlen,
275 void *ctx)
276{
277 return __deflate_decompress(src, slen, dst, dlen, ctx);
278}
279
280static struct crypto_alg alg = {
281 .cra_name = "deflate",
282 .cra_driver_name = "deflate-generic",
278 .cra_flags = CRYPTO_ALG_TYPE_COMPRESS,
279 .cra_ctxsize = sizeof(struct deflate_ctx),
280 .cra_module = THIS_MODULE,
281 .cra_init = deflate_init,
282 .cra_exit = deflate_exit,
283 .cra_u = { .compress = {
284 .coa_compress = deflate_compress,
285 .coa_decompress = deflate_decompress } }

--- 54 unchanged lines hidden ---
283 .cra_flags = CRYPTO_ALG_TYPE_COMPRESS,
284 .cra_ctxsize = sizeof(struct deflate_ctx),
285 .cra_module = THIS_MODULE,
286 .cra_init = deflate_init,
287 .cra_exit = deflate_exit,
288 .cra_u = { .compress = {
289 .coa_compress = deflate_compress,
290 .coa_decompress = deflate_decompress } }

--- 54 unchanged lines hidden ---