[PATCH crypto -v4 1/2] AES-NI: Add support to access underlying blkcipher under cryptd ablkcipher

2009-01-15 Thread Huang Ying
cryptd_alloc_ablkcipher() will allocate a cryptd-ed ablkcipher for specified algorithm name. The new allocated one is guaranteed to be cryptd-ed ablkcipher, so the blkcipher underlying can be gotten via cryptd_ablkcipher_child(). Signed-off-by: Huang Ying --- crypto/cryptd.c | 30

Re: [PATCH crypto -v4 1/2] AES-NI: Add support to access underlying blkcipher under cryptd ablkcipher

2009-01-15 Thread Herbert Xu
On Thu, Jan 15, 2009 at 04:28:33PM +0800, Huang Ying wrote: > > + tfm = crypto_alloc_ablkcipher(cryptd_alg_name, type, mask); > + BUG_ON(crypto_ablkcipher_tfm(tfm)->__crt_alg->cra_module != > +THIS_MODULE); You need to check whether tfm is an error before dereferencing it. Also

Re: [PATCH crypto -v4 1/2] AES-NI: Add support to access underlying blkcipher under cryptd ablkcipher

2009-01-15 Thread Huang Ying
On Thu, 2009-01-15 at 16:47 +0800, Herbert Xu wrote: > On Thu, Jan 15, 2009 at 04:28:33PM +0800, Huang Ying wrote: > > > > + tfm = crypto_alloc_ablkcipher(cryptd_alg_name, type, mask); > > + BUG_ON(crypto_ablkcipher_tfm(tfm)->__crt_alg->cra_module != > > + THIS_MODULE); > > You need t

Re: [PATCH crypto -v4 1/2] AES-NI: Add support to access underlying blkcipher under cryptd ablkcipher

2009-01-15 Thread Herbert Xu
On Thu, Jan 15, 2009 at 05:21:47PM +0800, Huang Ying wrote: > On Thu, 2009-01-15 at 16:47 +0800, Herbert Xu wrote: > > On Thu, Jan 15, 2009 at 04:28:33PM +0800, Huang Ying wrote: > > > > > > + tfm = crypto_alloc_ablkcipher(cryptd_alg_name, type, mask); > > > + BUG_ON(crypto_ablkcipher_tfm(tfm)->__c

Re: [PATCH crypto -v4 1/2] AES-NI: Add support to access underlying blkcipher under cryptd ablkcipher

2009-01-15 Thread Huang Ying
On Thu, 2009-01-15 at 17:23 +0800, Herbert Xu wrote: > On Thu, Jan 15, 2009 at 05:21:47PM +0800, Huang Ying wrote: > > On Thu, 2009-01-15 at 16:47 +0800, Herbert Xu wrote: > > > On Thu, Jan 15, 2009 at 04:28:33PM +0800, Huang Ying wrote: > > > > > > > > + tfm = crypto_alloc_ablkcipher(cryptd_

Re: [PATCH crypto -v4 1/2] AES-NI: Add support to access underlying blkcipher under cryptd ablkcipher

2009-01-15 Thread Herbert Xu
On Thu, Jan 15, 2009 at 05:30:51PM +0800, Huang Ying wrote: > > > > Why do we need this check? Someone else may register cryptd template? > > > Which error number should be return? -EINVAL? > > > > -ENOMEM for example. > > You mean something as follow: > > if (crypto_ablkcipher_tfm(tfm)->__crt_a