Commit 7c783029 authored by Tudor Ambarus's avatar Tudor Ambarus Committed by Herbert Xu

crypto: atmel-{sha,tdes} - Change algorithm priorities

Increase the algorithm priorities so the hardware acceleration is now
preferred to the software computation: the generic drivers use 100
as priority.
Signed-off-by: default avatarTudor Ambarus <tudor.ambarus@microchip.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 7b49fabf
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
#include "atmel-sha-regs.h" #include "atmel-sha-regs.h"
#include "atmel-authenc.h" #include "atmel-authenc.h"
#define ATMEL_SHA_PRIORITY 300
/* SHA flags */ /* SHA flags */
#define SHA_FLAGS_BUSY BIT(0) #define SHA_FLAGS_BUSY BIT(0)
#define SHA_FLAGS_FINAL BIT(1) #define SHA_FLAGS_FINAL BIT(1)
...@@ -1263,7 +1265,7 @@ static struct ahash_alg sha_1_256_algs[] = { ...@@ -1263,7 +1265,7 @@ static struct ahash_alg sha_1_256_algs[] = {
.base = { .base = {
.cra_name = "sha1", .cra_name = "sha1",
.cra_driver_name = "atmel-sha1", .cra_driver_name = "atmel-sha1",
.cra_priority = 100, .cra_priority = ATMEL_SHA_PRIORITY,
.cra_flags = CRYPTO_ALG_ASYNC, .cra_flags = CRYPTO_ALG_ASYNC,
.cra_blocksize = SHA1_BLOCK_SIZE, .cra_blocksize = SHA1_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct atmel_sha_ctx), .cra_ctxsize = sizeof(struct atmel_sha_ctx),
...@@ -1287,7 +1289,7 @@ static struct ahash_alg sha_1_256_algs[] = { ...@@ -1287,7 +1289,7 @@ static struct ahash_alg sha_1_256_algs[] = {
.base = { .base = {
.cra_name = "sha256", .cra_name = "sha256",
.cra_driver_name = "atmel-sha256", .cra_driver_name = "atmel-sha256",
.cra_priority = 100, .cra_priority = ATMEL_SHA_PRIORITY,
.cra_flags = CRYPTO_ALG_ASYNC, .cra_flags = CRYPTO_ALG_ASYNC,
.cra_blocksize = SHA256_BLOCK_SIZE, .cra_blocksize = SHA256_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct atmel_sha_ctx), .cra_ctxsize = sizeof(struct atmel_sha_ctx),
...@@ -1313,7 +1315,7 @@ static struct ahash_alg sha_224_alg = { ...@@ -1313,7 +1315,7 @@ static struct ahash_alg sha_224_alg = {
.base = { .base = {
.cra_name = "sha224", .cra_name = "sha224",
.cra_driver_name = "atmel-sha224", .cra_driver_name = "atmel-sha224",
.cra_priority = 100, .cra_priority = ATMEL_SHA_PRIORITY,
.cra_flags = CRYPTO_ALG_ASYNC, .cra_flags = CRYPTO_ALG_ASYNC,
.cra_blocksize = SHA224_BLOCK_SIZE, .cra_blocksize = SHA224_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct atmel_sha_ctx), .cra_ctxsize = sizeof(struct atmel_sha_ctx),
...@@ -1339,7 +1341,7 @@ static struct ahash_alg sha_384_512_algs[] = { ...@@ -1339,7 +1341,7 @@ static struct ahash_alg sha_384_512_algs[] = {
.base = { .base = {
.cra_name = "sha384", .cra_name = "sha384",
.cra_driver_name = "atmel-sha384", .cra_driver_name = "atmel-sha384",
.cra_priority = 100, .cra_priority = ATMEL_SHA_PRIORITY,
.cra_flags = CRYPTO_ALG_ASYNC, .cra_flags = CRYPTO_ALG_ASYNC,
.cra_blocksize = SHA384_BLOCK_SIZE, .cra_blocksize = SHA384_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct atmel_sha_ctx), .cra_ctxsize = sizeof(struct atmel_sha_ctx),
...@@ -1363,7 +1365,7 @@ static struct ahash_alg sha_384_512_algs[] = { ...@@ -1363,7 +1365,7 @@ static struct ahash_alg sha_384_512_algs[] = {
.base = { .base = {
.cra_name = "sha512", .cra_name = "sha512",
.cra_driver_name = "atmel-sha512", .cra_driver_name = "atmel-sha512",
.cra_priority = 100, .cra_priority = ATMEL_SHA_PRIORITY,
.cra_flags = CRYPTO_ALG_ASYNC, .cra_flags = CRYPTO_ALG_ASYNC,
.cra_blocksize = SHA512_BLOCK_SIZE, .cra_blocksize = SHA512_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct atmel_sha_ctx), .cra_ctxsize = sizeof(struct atmel_sha_ctx),
...@@ -2099,7 +2101,7 @@ static struct ahash_alg sha_hmac_algs[] = { ...@@ -2099,7 +2101,7 @@ static struct ahash_alg sha_hmac_algs[] = {
.base = { .base = {
.cra_name = "hmac(sha1)", .cra_name = "hmac(sha1)",
.cra_driver_name = "atmel-hmac-sha1", .cra_driver_name = "atmel-hmac-sha1",
.cra_priority = 100, .cra_priority = ATMEL_SHA_PRIORITY,
.cra_flags = CRYPTO_ALG_ASYNC, .cra_flags = CRYPTO_ALG_ASYNC,
.cra_blocksize = SHA1_BLOCK_SIZE, .cra_blocksize = SHA1_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct atmel_sha_hmac_ctx), .cra_ctxsize = sizeof(struct atmel_sha_hmac_ctx),
...@@ -2124,7 +2126,7 @@ static struct ahash_alg sha_hmac_algs[] = { ...@@ -2124,7 +2126,7 @@ static struct ahash_alg sha_hmac_algs[] = {
.base = { .base = {
.cra_name = "hmac(sha224)", .cra_name = "hmac(sha224)",
.cra_driver_name = "atmel-hmac-sha224", .cra_driver_name = "atmel-hmac-sha224",
.cra_priority = 100, .cra_priority = ATMEL_SHA_PRIORITY,
.cra_flags = CRYPTO_ALG_ASYNC, .cra_flags = CRYPTO_ALG_ASYNC,
.cra_blocksize = SHA224_BLOCK_SIZE, .cra_blocksize = SHA224_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct atmel_sha_hmac_ctx), .cra_ctxsize = sizeof(struct atmel_sha_hmac_ctx),
...@@ -2149,7 +2151,7 @@ static struct ahash_alg sha_hmac_algs[] = { ...@@ -2149,7 +2151,7 @@ static struct ahash_alg sha_hmac_algs[] = {
.base = { .base = {
.cra_name = "hmac(sha256)", .cra_name = "hmac(sha256)",
.cra_driver_name = "atmel-hmac-sha256", .cra_driver_name = "atmel-hmac-sha256",
.cra_priority = 100, .cra_priority = ATMEL_SHA_PRIORITY,
.cra_flags = CRYPTO_ALG_ASYNC, .cra_flags = CRYPTO_ALG_ASYNC,
.cra_blocksize = SHA256_BLOCK_SIZE, .cra_blocksize = SHA256_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct atmel_sha_hmac_ctx), .cra_ctxsize = sizeof(struct atmel_sha_hmac_ctx),
...@@ -2174,7 +2176,7 @@ static struct ahash_alg sha_hmac_algs[] = { ...@@ -2174,7 +2176,7 @@ static struct ahash_alg sha_hmac_algs[] = {
.base = { .base = {
.cra_name = "hmac(sha384)", .cra_name = "hmac(sha384)",
.cra_driver_name = "atmel-hmac-sha384", .cra_driver_name = "atmel-hmac-sha384",
.cra_priority = 100, .cra_priority = ATMEL_SHA_PRIORITY,
.cra_flags = CRYPTO_ALG_ASYNC, .cra_flags = CRYPTO_ALG_ASYNC,
.cra_blocksize = SHA384_BLOCK_SIZE, .cra_blocksize = SHA384_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct atmel_sha_hmac_ctx), .cra_ctxsize = sizeof(struct atmel_sha_hmac_ctx),
...@@ -2199,7 +2201,7 @@ static struct ahash_alg sha_hmac_algs[] = { ...@@ -2199,7 +2201,7 @@ static struct ahash_alg sha_hmac_algs[] = {
.base = { .base = {
.cra_name = "hmac(sha512)", .cra_name = "hmac(sha512)",
.cra_driver_name = "atmel-hmac-sha512", .cra_driver_name = "atmel-hmac-sha512",
.cra_priority = 100, .cra_priority = ATMEL_SHA_PRIORITY,
.cra_flags = CRYPTO_ALG_ASYNC, .cra_flags = CRYPTO_ALG_ASYNC,
.cra_blocksize = SHA512_BLOCK_SIZE, .cra_blocksize = SHA512_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct atmel_sha_hmac_ctx), .cra_ctxsize = sizeof(struct atmel_sha_hmac_ctx),
......
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
#include <linux/platform_data/crypto-atmel.h> #include <linux/platform_data/crypto-atmel.h>
#include "atmel-tdes-regs.h" #include "atmel-tdes-regs.h"
#define ATMEL_TDES_PRIORITY 300
/* TDES flags */ /* TDES flags */
#define TDES_FLAGS_MODE_MASK 0x00ff #define TDES_FLAGS_MODE_MASK 0x00ff
#define TDES_FLAGS_ENCRYPT BIT(0) #define TDES_FLAGS_ENCRYPT BIT(0)
...@@ -917,7 +919,7 @@ static struct skcipher_alg tdes_algs[] = { ...@@ -917,7 +919,7 @@ static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "ecb(des)", .base.cra_name = "ecb(des)",
.base.cra_driver_name = "atmel-ecb-des", .base.cra_driver_name = "atmel-ecb-des",
.base.cra_priority = 100, .base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC, .base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = DES_BLOCK_SIZE, .base.cra_blocksize = DES_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx), .base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
...@@ -934,7 +936,7 @@ static struct skcipher_alg tdes_algs[] = { ...@@ -934,7 +936,7 @@ static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "cbc(des)", .base.cra_name = "cbc(des)",
.base.cra_driver_name = "atmel-cbc-des", .base.cra_driver_name = "atmel-cbc-des",
.base.cra_priority = 100, .base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC, .base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = DES_BLOCK_SIZE, .base.cra_blocksize = DES_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx), .base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
...@@ -952,7 +954,7 @@ static struct skcipher_alg tdes_algs[] = { ...@@ -952,7 +954,7 @@ static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "cfb(des)", .base.cra_name = "cfb(des)",
.base.cra_driver_name = "atmel-cfb-des", .base.cra_driver_name = "atmel-cfb-des",
.base.cra_priority = 100, .base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC, .base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = DES_BLOCK_SIZE, .base.cra_blocksize = DES_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx), .base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
...@@ -970,7 +972,7 @@ static struct skcipher_alg tdes_algs[] = { ...@@ -970,7 +972,7 @@ static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "cfb8(des)", .base.cra_name = "cfb8(des)",
.base.cra_driver_name = "atmel-cfb8-des", .base.cra_driver_name = "atmel-cfb8-des",
.base.cra_priority = 100, .base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC, .base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = CFB8_BLOCK_SIZE, .base.cra_blocksize = CFB8_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx), .base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
...@@ -988,7 +990,7 @@ static struct skcipher_alg tdes_algs[] = { ...@@ -988,7 +990,7 @@ static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "cfb16(des)", .base.cra_name = "cfb16(des)",
.base.cra_driver_name = "atmel-cfb16-des", .base.cra_driver_name = "atmel-cfb16-des",
.base.cra_priority = 100, .base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC, .base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = CFB16_BLOCK_SIZE, .base.cra_blocksize = CFB16_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx), .base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
...@@ -1006,7 +1008,7 @@ static struct skcipher_alg tdes_algs[] = { ...@@ -1006,7 +1008,7 @@ static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "cfb32(des)", .base.cra_name = "cfb32(des)",
.base.cra_driver_name = "atmel-cfb32-des", .base.cra_driver_name = "atmel-cfb32-des",
.base.cra_priority = 100, .base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC, .base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = CFB32_BLOCK_SIZE, .base.cra_blocksize = CFB32_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx), .base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
...@@ -1024,7 +1026,7 @@ static struct skcipher_alg tdes_algs[] = { ...@@ -1024,7 +1026,7 @@ static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "ofb(des)", .base.cra_name = "ofb(des)",
.base.cra_driver_name = "atmel-ofb-des", .base.cra_driver_name = "atmel-ofb-des",
.base.cra_priority = 100, .base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC, .base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = DES_BLOCK_SIZE, .base.cra_blocksize = DES_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx), .base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
...@@ -1042,7 +1044,7 @@ static struct skcipher_alg tdes_algs[] = { ...@@ -1042,7 +1044,7 @@ static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "ecb(des3_ede)", .base.cra_name = "ecb(des3_ede)",
.base.cra_driver_name = "atmel-ecb-tdes", .base.cra_driver_name = "atmel-ecb-tdes",
.base.cra_priority = 100, .base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC, .base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = DES_BLOCK_SIZE, .base.cra_blocksize = DES_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx), .base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
...@@ -1059,7 +1061,7 @@ static struct skcipher_alg tdes_algs[] = { ...@@ -1059,7 +1061,7 @@ static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "cbc(des3_ede)", .base.cra_name = "cbc(des3_ede)",
.base.cra_driver_name = "atmel-cbc-tdes", .base.cra_driver_name = "atmel-cbc-tdes",
.base.cra_priority = 100, .base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC, .base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = DES_BLOCK_SIZE, .base.cra_blocksize = DES_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx), .base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
...@@ -1077,7 +1079,7 @@ static struct skcipher_alg tdes_algs[] = { ...@@ -1077,7 +1079,7 @@ static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "ofb(des3_ede)", .base.cra_name = "ofb(des3_ede)",
.base.cra_driver_name = "atmel-ofb-tdes", .base.cra_driver_name = "atmel-ofb-tdes",
.base.cra_priority = 100, .base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC, .base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = DES_BLOCK_SIZE, .base.cra_blocksize = DES_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx), .base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment