Re: [RFC PATCH crypto -v3 1/2] AES-NI: Add support to accessunderlying blkcipher under cryptd ablkcipher
From: Herbert Xu
Date: Wed Jan 14 2009 - 22:15:20 EST
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@xxxxxxxxx>
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@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/