aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-05-07 10:35:07 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2008-07-10 08:35:11 -0400
commit281d6bd45385c689e7c03c9ff2434c143971682d (patch)
treee29da5a132baa3c1c45739801cb26225415499f0 /drivers/crypto
parent136f702f51a4bfa38003660768e7153823fff8a1 (diff)
[HIFN]: Use unique driver names for different algos
When the CryptoAPI instantiates a new algorithm, it performs a lookup by driver name. Since hifn uses the same name for all modes of one algorithm, the lookup may return an incorrect algorithm. Change the name to use <mode>-<algo>-<devicename> to provide unique names for the different combinations and devices. Signed-off-by: Patrick McHardy <kaber@trash.net> Acked-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/hifn_795x.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
index 366e974d0e59..d09338f70dca 100644
--- a/drivers/crypto/hifn_795x.c
+++ b/drivers/crypto/hifn_795x.c
@@ -2355,7 +2355,7 @@ static struct hifn_alg_template hifn_alg_templates[] = {
2355 * 3DES ECB, CBC, CFB and OFB modes. 2355 * 3DES ECB, CBC, CFB and OFB modes.
2356 */ 2356 */
2357 { 2357 {
2358 .name = "cfb(des3_ede)", .drv_name = "hifn-3des", .bsize = 8, 2358 .name = "cfb(des3_ede)", .drv_name = "cfb-3des", .bsize = 8,
2359 .ablkcipher = { 2359 .ablkcipher = {
2360 .min_keysize = HIFN_3DES_KEY_LENGTH, 2360 .min_keysize = HIFN_3DES_KEY_LENGTH,
2361 .max_keysize = HIFN_3DES_KEY_LENGTH, 2361 .max_keysize = HIFN_3DES_KEY_LENGTH,
@@ -2365,7 +2365,7 @@ static struct hifn_alg_template hifn_alg_templates[] = {
2365 }, 2365 },
2366 }, 2366 },
2367 { 2367 {
2368 .name = "ofb(des3_ede)", .drv_name = "hifn-3des", .bsize = 8, 2368 .name = "ofb(des3_ede)", .drv_name = "ofb-3des", .bsize = 8,
2369 .ablkcipher = { 2369 .ablkcipher = {
2370 .min_keysize = HIFN_3DES_KEY_LENGTH, 2370 .min_keysize = HIFN_3DES_KEY_LENGTH,
2371 .max_keysize = HIFN_3DES_KEY_LENGTH, 2371 .max_keysize = HIFN_3DES_KEY_LENGTH,
@@ -2375,7 +2375,7 @@ static struct hifn_alg_template hifn_alg_templates[] = {
2375 }, 2375 },
2376 }, 2376 },
2377 { 2377 {
2378 .name = "cbc(des3_ede)", .drv_name = "hifn-3des", .bsize = 8, 2378 .name = "cbc(des3_ede)", .drv_name = "cbc-3des", .bsize = 8,
2379 .ablkcipher = { 2379 .ablkcipher = {
2380 .min_keysize = HIFN_3DES_KEY_LENGTH, 2380 .min_keysize = HIFN_3DES_KEY_LENGTH,
2381 .max_keysize = HIFN_3DES_KEY_LENGTH, 2381 .max_keysize = HIFN_3DES_KEY_LENGTH,
@@ -2385,7 +2385,7 @@ static struct hifn_alg_template hifn_alg_templates[] = {
2385 }, 2385 },
2386 }, 2386 },
2387 { 2387 {
2388 .name = "ecb(des3_ede)", .drv_name = "hifn-3des", .bsize = 8, 2388 .name = "ecb(des3_ede)", .drv_name = "ecb-3des", .bsize = 8,
2389 .ablkcipher = { 2389 .ablkcipher = {
2390 .min_keysize = HIFN_3DES_KEY_LENGTH, 2390 .min_keysize = HIFN_3DES_KEY_LENGTH,
2391 .max_keysize = HIFN_3DES_KEY_LENGTH, 2391 .max_keysize = HIFN_3DES_KEY_LENGTH,
@@ -2399,7 +2399,7 @@ static struct hifn_alg_template hifn_alg_templates[] = {
2399 * DES ECB, CBC, CFB and OFB modes. 2399 * DES ECB, CBC, CFB and OFB modes.
2400 */ 2400 */
2401 { 2401 {
2402 .name = "cfb(des)", .drv_name = "hifn-des", .bsize = 8, 2402 .name = "cfb(des)", .drv_name = "cfb-des", .bsize = 8,
2403 .ablkcipher = { 2403 .ablkcipher = {
2404 .min_keysize = HIFN_DES_KEY_LENGTH, 2404 .min_keysize = HIFN_DES_KEY_LENGTH,
2405 .max_keysize = HIFN_DES_KEY_LENGTH, 2405 .max_keysize = HIFN_DES_KEY_LENGTH,
@@ -2409,7 +2409,7 @@ static struct hifn_alg_template hifn_alg_templates[] = {
2409 }, 2409 },
2410 }, 2410 },
2411 { 2411 {
2412 .name = "ofb(des)", .drv_name = "hifn-des", .bsize = 8, 2412 .name = "ofb(des)", .drv_name = "ofb-des", .bsize = 8,
2413 .ablkcipher = { 2413 .ablkcipher = {
2414 .min_keysize = HIFN_DES_KEY_LENGTH, 2414 .min_keysize = HIFN_DES_KEY_LENGTH,
2415 .max_keysize = HIFN_DES_KEY_LENGTH, 2415 .max_keysize = HIFN_DES_KEY_LENGTH,
@@ -2419,7 +2419,7 @@ static struct hifn_alg_template hifn_alg_templates[] = {
2419 }, 2419 },
2420 }, 2420 },
2421 { 2421 {
2422 .name = "cbc(des)", .drv_name = "hifn-des", .bsize = 8, 2422 .name = "cbc(des)", .drv_name = "cbc-des", .bsize = 8,
2423 .ablkcipher = { 2423 .ablkcipher = {
2424 .min_keysize = HIFN_DES_KEY_LENGTH, 2424 .min_keysize = HIFN_DES_KEY_LENGTH,
2425 .max_keysize = HIFN_DES_KEY_LENGTH, 2425 .max_keysize = HIFN_DES_KEY_LENGTH,
@@ -2429,7 +2429,7 @@ static struct hifn_alg_template hifn_alg_templates[] = {
2429 }, 2429 },
2430 }, 2430 },
2431 { 2431 {
2432 .name = "ecb(des)", .drv_name = "hifn-des", .bsize = 8, 2432 .name = "ecb(des)", .drv_name = "ecb-des", .bsize = 8,
2433 .ablkcipher = { 2433 .ablkcipher = {
2434 .min_keysize = HIFN_DES_KEY_LENGTH, 2434 .min_keysize = HIFN_DES_KEY_LENGTH,
2435 .max_keysize = HIFN_DES_KEY_LENGTH, 2435 .max_keysize = HIFN_DES_KEY_LENGTH,
@@ -2443,7 +2443,7 @@ static struct hifn_alg_template hifn_alg_templates[] = {
2443 * AES ECB, CBC, CFB and OFB modes. 2443 * AES ECB, CBC, CFB and OFB modes.
2444 */ 2444 */
2445 { 2445 {
2446 .name = "ecb(aes)", .drv_name = "hifn-aes", .bsize = 16, 2446 .name = "ecb(aes)", .drv_name = "ecb-aes", .bsize = 16,
2447 .ablkcipher = { 2447 .ablkcipher = {
2448 .min_keysize = AES_MIN_KEY_SIZE, 2448 .min_keysize = AES_MIN_KEY_SIZE,
2449 .max_keysize = AES_MAX_KEY_SIZE, 2449 .max_keysize = AES_MAX_KEY_SIZE,
@@ -2453,7 +2453,7 @@ static struct hifn_alg_template hifn_alg_templates[] = {
2453 }, 2453 },
2454 }, 2454 },
2455 { 2455 {
2456 .name = "cbc(aes)", .drv_name = "hifn-aes", .bsize = 16, 2456 .name = "cbc(aes)", .drv_name = "cbc-aes", .bsize = 16,
2457 .ablkcipher = { 2457 .ablkcipher = {
2458 .min_keysize = AES_MIN_KEY_SIZE, 2458 .min_keysize = AES_MIN_KEY_SIZE,
2459 .max_keysize = AES_MAX_KEY_SIZE, 2459 .max_keysize = AES_MAX_KEY_SIZE,
@@ -2463,7 +2463,7 @@ static struct hifn_alg_template hifn_alg_templates[] = {
2463 }, 2463 },
2464 }, 2464 },
2465 { 2465 {
2466 .name = "cfb(aes)", .drv_name = "hifn-aes", .bsize = 16, 2466 .name = "cfb(aes)", .drv_name = "cfb-aes", .bsize = 16,
2467 .ablkcipher = { 2467 .ablkcipher = {
2468 .min_keysize = AES_MIN_KEY_SIZE, 2468 .min_keysize = AES_MIN_KEY_SIZE,
2469 .max_keysize = AES_MAX_KEY_SIZE, 2469 .max_keysize = AES_MAX_KEY_SIZE,
@@ -2473,7 +2473,7 @@ static struct hifn_alg_template hifn_alg_templates[] = {
2473 }, 2473 },
2474 }, 2474 },
2475 { 2475 {
2476 .name = "ofb(aes)", .drv_name = "hifn-aes", .bsize = 16, 2476 .name = "ofb(aes)", .drv_name = "ofb-aes", .bsize = 16,
2477 .ablkcipher = { 2477 .ablkcipher = {
2478 .min_keysize = AES_MIN_KEY_SIZE, 2478 .min_keysize = AES_MIN_KEY_SIZE,
2479 .max_keysize = AES_MAX_KEY_SIZE, 2479 .max_keysize = AES_MAX_KEY_SIZE,
@@ -2505,7 +2505,8 @@ static int hifn_alg_alloc(struct hifn_device *dev, struct hifn_alg_template *t)
2505 return -ENOMEM; 2505 return -ENOMEM;
2506 2506
2507 snprintf(alg->alg.cra_name, CRYPTO_MAX_ALG_NAME, "%s", t->name); 2507 snprintf(alg->alg.cra_name, CRYPTO_MAX_ALG_NAME, "%s", t->name);
2508 snprintf(alg->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s", t->drv_name); 2508 snprintf(alg->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s-%s",
2509 t->drv_name, dev->name);
2509 2510
2510 alg->alg.cra_priority = 300; 2511 alg->alg.cra_priority = 300;
2511 alg->alg.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC; 2512 alg->alg.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC;