mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Use cryptd(%s) as cryptd-ed algorithm name instead of %s
@ 2009-01-14  6:44 Huang Ying
  2009-01-14  6:53 ` Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Huang Ying @ 2009-01-14  6:44 UTC (permalink / raw)
  To: Herbert Xu; +Cc: linux-kernel, linux-crypto

[-- Attachment #1: Type: text/plain, Size: 959 bytes --]

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;


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-01-14  8:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-14  6:44 Use cryptd(%s) as cryptd-ed algorithm name instead of %s Huang Ying
2009-01-14  6:53 ` Herbert Xu
2009-01-14  7:01   ` Huang Ying
2009-01-14  8:23     ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®