linux/crypto/deflate.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Cryptographic API.
 *
 * Deflate algorithm (RFC 1951), implemented here primarily for use
 * by IPCOMP (RFC 3173 & RFC 2394).
 *
 * Copyright (c) 2003 James Morris <[email protected]>
 *
 * FIXME: deflate transforms will require up to a total of about 436k of kernel
 * memory on i386 (390k for compression, the rest for decompression), as the
 * current zlib kernel code uses a worst case pre-allocation system by default.
 * This needs to be fixed so that the amount of memory required is properly
 * related to the  winbits and memlevel parameters.
 *
 * The default winbits of 11 should suit most packets, and it may be something
 * to configure on a per-tfm basis in the future.
 *
 * Currently, compression history is not maintained between tfm calls, as
 * it is not needed for IPCOMP and keeps the code simpler.  It can be
 * implemented if someone wants it.
 */
#include <linux/init.h>
#include <linux/module.h>
#include <linux/crypto.h>
#include <linux/zlib.h>
#include <linux/vmalloc.h>
#include <linux/interrupt.h>
#include <linux/mm.h>
#include <linux/net.h>
#include <crypto/internal/scompress.h>

#define DEFLATE_DEF_LEVEL
#define DEFLATE_DEF_WINBITS
#define DEFLATE_DEF_MEMLEVEL

struct deflate_ctx {};

static int deflate_comp_init(struct deflate_ctx *ctx)
{}

static int deflate_decomp_init(struct deflate_ctx *ctx)
{}

static void deflate_comp_exit(struct deflate_ctx *ctx)
{}

static void deflate_decomp_exit(struct deflate_ctx *ctx)
{}

static int __deflate_init(void *ctx)
{}

static void *deflate_alloc_ctx(struct crypto_scomp *tfm)
{}

static int deflate_init(struct crypto_tfm *tfm)
{}

static void __deflate_exit(void *ctx)
{}

static void deflate_free_ctx(struct crypto_scomp *tfm, void *ctx)
{}

static void deflate_exit(struct crypto_tfm *tfm)
{}

static int __deflate_compress(const u8 *src, unsigned int slen,
			      u8 *dst, unsigned int *dlen, void *ctx)
{}

static int deflate_compress(struct crypto_tfm *tfm, const u8 *src,
			    unsigned int slen, u8 *dst, unsigned int *dlen)
{}

static int deflate_scompress(struct crypto_scomp *tfm, const u8 *src,
			     unsigned int slen, u8 *dst, unsigned int *dlen,
			     void *ctx)
{}

static int __deflate_decompress(const u8 *src, unsigned int slen,
				u8 *dst, unsigned int *dlen, void *ctx)
{}

static int deflate_decompress(struct crypto_tfm *tfm, const u8 *src,
			      unsigned int slen, u8 *dst, unsigned int *dlen)
{}

static int deflate_sdecompress(struct crypto_scomp *tfm, const u8 *src,
			       unsigned int slen, u8 *dst, unsigned int *dlen,
			       void *ctx)
{}

static struct crypto_alg alg =;

static struct scomp_alg scomp =;

static int __init deflate_mod_init(void)
{}

static void __exit deflate_mod_fini(void)
{}

subsys_initcall(deflate_mod_init);
module_exit(deflate_mod_fini);

MODULE_LICENSE();
MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_ALIAS_CRYPTO();
MODULE_ALIAS_CRYPTO();