Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Huang Ying <ying.huang@intel.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>
Subject: Use cryptd(%s) as cryptd-ed algorithm name instead of %s
Date: Wed, 14 Jan 2009 14:44:08 +0800	[thread overview]
Message-ID: <1231915448.5937.145.camel@yhuang-dev.sh.intel.com> (raw)

[-- 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 --]

             reply	other threads:[~2009-01-14  6:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-14  6:44 Huang Ying [this message]
2009-01-14  6:53 ` Use cryptd(%s) as cryptd-ed algorithm name instead of %s Herbert Xu
2009-01-14  7:01   ` Huang Ying
2009-01-14  8:23     ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1231915448.5937.145.camel@yhuang-dev.sh.intel.com \
    --to=ying.huang@intel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox