Re: [RFC PATCH 01/21] crypto: scomp - Revert "add support for deflate rfc1950 (zlib)"

Simon Horman
2023-07-21T09:11:54Z

On Tue, Jul 18, 2023 at 02:58:27PM +0200, Ard Biesheuvel wrote:
> This reverts commit a368f43d6e3a001e684e9191a27df384fbff12f5.
>
> "zlib-deflate" was introduced 6 years ago, but it does not have any
> users. So let's remove the generic implementation and the test vectors,
> but retain the "zlib-deflate" entry in the testmgr code to avoid
> introducing warning messages on systems that implement zlib-deflate in
> hardware.
>
> Note that RFC 1950 which forms the basis of this algorithm dates back to
> 1996, and predates RFC 1951, on which the existing IPcomp is based and
> which we have supported in the kernel since 2003. So it seems rather
> unlikely that we will ever grow the need to support zlib-deflate.
>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> crypto/deflate.c | 61 +++++-----------
> crypto/testmgr.c | 8 +--
> crypto/testmgr.h | 75 --------------------
> 3 files changed, 18 insertions(+), 126 deletions(-)
>
> diff --git a/crypto/deflate.c b/crypto/deflate.c
> index b2a46f6dc961e71d..f4f127078fe2a5aa 100644
> --- a/crypto/deflate.c
> +++ b/crypto/deflate.c
> @@ -39,24 +39,20 @@ struct deflate_ctx {
> struct z_stream_s decomp_stream;
> };
>
> -static int deflate_comp_init(struct deflate_ctx *ctx, int format)
> +static int deflate_comp_init(struct deflate_ctx *ctx)
> {
> int ret = 0;
> struct z_stream_s *stream = &ctx->comp_stream;
>
> stream->workspace = vzalloc(zlib_deflate_workspacesize(
> - MAX_WBITS, MAX_MEM_LEVEL));
> + -DEFLATE_DEF_WINBITS, DEFLATE_DEF_MEMLEVEL));
> if (!stream->workspace) {
> ret = -ENOMEM;
> goto out;
> }
> - if (format)
> - ret = zlib_deflateInit(stream, 3);
> - else
> - ret = zlib_deflateInit2(stream, DEFLATE_DEF_LEVEL, Z_DEFLATED,
> - -DEFLATE_DEF_WINBITS,
> - DEFLATE_DEF_MEMLEVEL,
> - Z_DEFAULT_STRATEGY);
> + ret = zlib_deflateInit2(stream, DEFLATE_DEF_LEVEL, Z_DEFLATED,
> + -DEFLATE_DEF_WINBITS, DEFLATE_DEF_MEMLEVEL,
> + Z_DEFAULT_STRATEGY);

nit: The two lines above partially use spaces instead of tabs for
indentation.

...