Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1232566 > unrolled thread

Re: [PATCH v3 1/9] crypto: introduce decompression API that can be called via sharable tfm object

Started byJoonsoo Kim <iamjoonsoo.kim@lge.com>
First post2015-09-25 07:30 +0200
Last post2015-09-25 07:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v3 1/9] crypto: introduce decompression API that can be  called via sharable tfm object Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2015-09-25 07:30 +0200

#1232566 — Re: [PATCH v3 1/9] crypto: introduce decompression API that can be called via sharable tfm object

FromJoonsoo Kim <iamjoonsoo.kim@lge.com>
Date2015-09-25 07:30 +0200
SubjectRe: [PATCH v3 1/9] crypto: introduce decompression API that can be called via sharable tfm object
Message-ID<qctK2-qx-5@gated-at.bofh.it>
On Mon, Sep 21, 2015 at 02:38:59PM +0900, Sergey Senozhatsky wrote:
> On (09/18/15 14:19), Joonsoo Kim wrote:
> [..]
> > @@ -61,7 +61,8 @@ static struct crypto_alg alg = {
> >  	.cra_module		= THIS_MODULE,
> >  	.cra_u			= { .compress = {
> >  	.coa_compress		= crypto842_compress,
> > -	.coa_decompress		= crypto842_decompress } }
> > +	.coa_decompress		= crypto842_decompress,
> > +	.coa_decompress_noctx	= NULL } }
> >  };
> >  
> >  static int __init crypto842_mod_init(void)
> > diff --git a/crypto/compress.c b/crypto/compress.c
> > index c33f076..abb36a8 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_decompress_noctx(struct crypto_tfm *tfm,
> > +				const u8 *src, unsigned int slen,
> > +				u8 *dst, unsigned int *dlen)
> > +{
> > +	return tfm->__crt_alg->cra_compress.coa_decompress_noctx(src, slen,
> > +								dst, dlen);
> > +}
> 
> 
> hm... well... sorry, if irrelevant.
> if the algorithm can have a _noctx() decompression function, does it
> automatically guarantee that this algorithm never dereferences a passed
> `struct crypto_tfm *tfm' pointer in its decompress function? in other words,
> can we simply pass that `shared tfm pointer' to the existing decompress
> function instead of defining new symbols, new callbacks, etc.?
> 
> 	cot_decompress_noctx()  ==  cot_decompress(shared_ftm) ?
> 
> just a thought.

Will think it if I implement next version in this way. Due to Herbert
comment, interface will be changed so much in next version.

> 
> [..]
> > +struct crypto_comp *crypto_alloc_comp_noctx(const char *alg_name,
> > +					u32 type, u32 mask)
> > +{
> > +	struct crypto_comp *comp;
> > +	struct crypto_tfm *tfm;
> > +	struct compress_tfm *ops;
> > +
> > +	comp = crypto_alloc_comp(alg_name, type, mask);
> > +	if (IS_ERR(comp))
> > +		return comp;
> > +
> > +	tfm = crypto_comp_tfm(comp);
> > +	if (!tfm->__crt_alg->cra_compress.coa_decompress_noctx) {
> > +		crypto_free_comp(comp);
> > +		return ERR_PTR(-EINVAL);
> 
> 	-ENOMEM?

No, it's failure isn't related to NOMEM. Just not support it.

Thanks.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web