Use cryptd(%s) as cryptd-ed algorithm name instead of %s

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>

---
 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: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux