lkml.org 
[lkml]   [2018]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/9] crypto: add zbufsize() interface
On Thu, Aug 02, 2018 at 02:51:10PM -0700, Kees Cook wrote:
> When pstore was refactored to use the crypto compress API in:
>
> commit cb3bee0369bc ("pstore: Use crypto compress API")
>
> nearly all the pstore-specific compression routines were replaced with
> the existing crypto compression API. One case remained: calculating the
> "worst case" compression sizes ahead of time so it could have a buffer
> preallocated for doing compression (which was called "zbufsize").
>
> To make pstore fully algorithm-agnostic, the compression API needs to
> grow this functionality. This adds the interface to support querying the
> "worst case" estimate, with a new "zbufsize" routine that each compressor
> can implement. The per-compressor implementations come in later commits.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> crypto/compress.c | 9 +++++++++
> include/crypto/internal/scompress.h | 11 +++++++++++
> include/linux/crypto.h | 12 ++++++++++++
> 3 files changed, 32 insertions(+)
>
> diff --git a/crypto/compress.c b/crypto/compress.c
> index f2d522924a07..29a80bb3b9d3 100644
> --- a/crypto/compress.c
> +++ b/crypto/compress.c
> @@ -33,12 +33,21 @@ static int crypto_decompress(struct crypto_tfm *tfm,
> dlen);
> }
>
> +static int crypto_zbufsize(struct crypto_tfm *tfm,
> + unsigned int slen, unsigned int *dlen)
> +{
> + if (!tfm->__crt_alg->cra_compress.coa_zbufsize)
> + return -ENOTSUPP;
> + return tfm->__crt_alg->cra_compress.coa_zbufsize(tfm, slen, dlen);
> +}

Please don't add new features to the old compress interface. Any
new improvements should be added to scomp/acomp only. Users who
need new features should be converted.

Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

\
 
 \ /
  Last update: 2018-08-07 11:46    [W:0.063 / U:1.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site