lkml.org 
[lkml]   [2009]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH crypto -v3 1/2] AES-NI: Add support to access underlying blkcipher under cryptd ablkcipher
On Wed, Jan 14, 2009 at 03:44:06PM +0800, Huang Ying wrote:
> 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 <ying.huang@intel.com>

Thanks for the patch!

> +struct crypto_ablkcipher *cryptd_alloc_ablkcipher(const char *alg_name,
> + u32 type, u32 mask)

It should have its own type so that we get compiler type checking.
Something like,

struct cryptd_ablkcipher {
struct crypto_ablkcipher *cipher;
};

> + if (snprintf(cryptd_alg_name, CRYPTO_MAX_ALG_NAME,
> + "cryptd(%s)", alg_name) >= CRYPTO_MAX_ALG_NAME)
> + return ERR_PTR(-EINVAL);
> + return crypto_alloc_ablkcipher(cryptd_alg_name, type, mask);

We should also check that the new tfm's module matches ours, i.e.,

crypto_ablkcipher_tfm(cipher)->__crt_alg->cra_module ==
THIS_MODULE

Granted this doesn't do much if we're built-in but it's better
than nothing.

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <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: 2009-01-15 04:17    [W:0.029 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site