lkml.org 
[lkml]   [2009]   [Jan]   [14]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectUse cryptd(%s) as cryptd-ed algorithm name instead of %s
FromHuang Ying <>
DateWed, 14 Jan 2009 14:44:08 +0800
Because:

1. if use %s, you can only request cryptd(<driver name>), not
   cryptd(<alg name>), because generated new algorithm instance has
   algorithm name: <alg name> and driver name cryptd(<driver name>).

2. Generated cryptd-ed algorithm will have the same algorithm name and
   higher priority, but some user may not want to use cryptd-ed
   version.

Signed-off-by: Huang Ying <ying.huang@intel.com>

---
 crypto/cryptd.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
--- a/crypto/cryptd.c
+++ b/crypto/cryptd.c
@@ -215,7 +215,9 @@ static struct crypto_instance *cryptd_al
 
 	ctx->state = state;
 
-	memcpy(inst->alg.cra_name, alg->cra_name, CRYPTO_MAX_ALG_NAME);
+	if (snprintf(inst->alg.cra_name, CRYPTO_MAX_ALG_NAME,
+		     "cryptd(%s)", alg->cra_name) >= CRYPTO_MAX_ALG_NAME)
+		goto out_free_inst;
 
 	inst->alg.cra_priority = alg->cra_priority + 50;
 	inst->alg.cra_blocksize = alg->cra_blocksize;
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2009-01-14 07:47    [from the cache]
©2003-2008