From: Jan Glauber <jan.glauber@caviumnetworks.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S . Miller" <davem@davemloft.net>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
Mahipal Challa <mchalla@cavium.com>,
Balakrishna Bhamidipati <bbhamidipati@cavium.com>
Subject: Re: [PATCH] crypto: testmgr: Allow different compression results
Date: Thu, 19 Apr 2018 13:58:40 +0200 [thread overview]
Message-ID: <20180419115840.GA14706@hc> (raw)
In-Reply-To: <20180419034210.nsmzuf3f6lmn7suc@gondor.apana.org.au>
On Thu, Apr 19, 2018 at 11:42:11AM +0800, Herbert Xu wrote:
> On Wed, Apr 11, 2018 at 08:28:32PM +0200, Jan Glauber wrote:
> >
> > @@ -1362,7 +1373,17 @@ static int test_comp(struct crypto_comp *tfm,
> > goto out;
> > }
> >
> > - if (dlen != ctemplate[i].outlen) {
> > + ilen = dlen;
> > + dlen = COMP_BUF_SIZE;
> > + ret = crypto_comp_decompress(tfm, output,
> > + ilen, decomp_output, &dlen);
> > + if (ret) {
> > + pr_err("alg: comp: compression failed: decompress: on test %d for %s failed: ret=%d\n",
> > + i + 1, algo, -ret);
> > + goto out;
> > + }
> > +
> > + if (dlen != ctemplate[i].inlen) {
> > printk(KERN_ERR "alg: comp: Compression test %d "
> > "failed for %s: output len = %d\n", i + 1, algo,
> > dlen);
>
> Your patch is fine as it is.
>
> But I just thought I'd mention that if anyone wants to we should
> really change this to use a different tfm, e.g., always use the
> generic algorithm to perform the decompression. This way if there
> were multiple implementations we can at least test them against
> the generic one.
>
> Otherwise you could end up with a buggy implementation that works
> against itself but still generates incorrect output.
Nice idea. Would a crypto_alloc_cipher("deflate", ...) pick the generic
implementation or how can we select it?
--Jan
next prev parent reply other threads:[~2018-04-19 11:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-11 18:28 [PATCH] crypto: testmgr: Allow different compression results Jan Glauber
2018-04-19 3:42 ` Herbert Xu
2018-04-19 11:58 ` Jan Glauber [this message]
2018-04-20 16:54 ` Herbert Xu
2018-04-20 16:52 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180419115840.GA14706@hc \
--to=jan.glauber@caviumnetworks.com \
--cc=bbhamidipati@cavium.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchalla@cavium.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox