[LEDE-DEV] [PATCH 3/3] ltq-deu: fix cra_priority

Martin Schiller mschiller at tdt.de
Thu Aug 18 03:03:17 PDT 2016


With the default priority of 0, the DEU algos would be overlapped
by the generic algos (if available).

To fix this, set the cra_priority of the hardware algos to the
recommended value of 300/400.

Signed-off-by: Martin Schiller <mschiller at tdt.de>
---
 package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c       | 5 +++++
 package/kernel/lantiq/ltq-deu/src/ifxmips_arc4.c      | 2 ++
 package/kernel/lantiq/ltq-deu/src/ifxmips_async_aes.c | 8 ++++----
 package/kernel/lantiq/ltq-deu/src/ifxmips_async_des.c | 8 ++++----
 package/kernel/lantiq/ltq-deu/src/ifxmips_des.c       | 6 ++++++
 package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c       | 1 +
 package/kernel/lantiq/ltq-deu/src/ifxmips_md5_hmac.c  | 1 +
 package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c      | 1 +
 package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c | 1 +
 9 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c
index 9ef42d1..b51cf47 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c
@@ -455,6 +455,7 @@ void aes_decrypt (struct crypto_tfm *tfm, uint8_t *out, const uint8_t *in)
 struct crypto_alg ifxdeu_aes_alg = {
     .cra_name       =   "aes",
     .cra_driver_name    =   "ifxdeu-aes",
+    .cra_priority   =   300,
     .cra_flags      =   CRYPTO_ALG_TYPE_CIPHER,
     .cra_blocksize      =   AES_BLOCK_SIZE,
     .cra_ctxsize        =   sizeof(struct aes_ctx),
@@ -541,6 +542,7 @@ int ecb_aes_decrypt(struct blkcipher_desc *desc,
 struct crypto_alg ifxdeu_ecb_aes_alg = {
     .cra_name       =   "ecb(aes)",
     .cra_driver_name    =   "ifxdeu-ecb(aes)",
+    .cra_priority   =   400,
     .cra_flags      =   CRYPTO_ALG_TYPE_BLKCIPHER,
     .cra_blocksize      =   AES_BLOCK_SIZE,
     .cra_ctxsize        =   sizeof(struct aes_ctx),
@@ -631,6 +633,7 @@ int cbc_aes_decrypt(struct blkcipher_desc *desc,
 struct crypto_alg ifxdeu_cbc_aes_alg = {
     .cra_name       =   "cbc(aes)",
     .cra_driver_name    =   "ifxdeu-cbc(aes)",
+    .cra_priority   =   400,
     .cra_flags      =   CRYPTO_ALG_TYPE_BLKCIPHER,
     .cra_blocksize      =   AES_BLOCK_SIZE,
     .cra_ctxsize        =   sizeof(struct aes_ctx),
@@ -722,6 +725,7 @@ int ctr_basic_aes_decrypt(struct blkcipher_desc *desc,
 struct crypto_alg ifxdeu_ctr_basic_aes_alg = {
     .cra_name       =   "ctr(aes)",
     .cra_driver_name    =   "ifxdeu-ctr(aes)",
+    .cra_priority   =   400,
     .cra_flags      =   CRYPTO_ALG_TYPE_BLKCIPHER,
     .cra_blocksize      =   AES_BLOCK_SIZE,
     .cra_ctxsize        =   sizeof(struct aes_ctx),
@@ -861,6 +865,7 @@ int ctr_rfc3686_aes_decrypt(struct blkcipher_desc *desc,
 struct crypto_alg ifxdeu_ctr_rfc3686_aes_alg = {
     .cra_name       	=   "rfc3686(ctr(aes))",
     .cra_driver_name    =   "ifxdeu-ctr-rfc3686(aes)",
+    .cra_priority       =   400,
     .cra_flags      	=   CRYPTO_ALG_TYPE_BLKCIPHER,
     .cra_blocksize      =   AES_BLOCK_SIZE,
     .cra_ctxsize        =   sizeof(struct aes_ctx),
diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_arc4.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_arc4.c
index ee56187..d0818dd 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_arc4.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_arc4.c
@@ -242,6 +242,7 @@ static void arc4_crypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
 static struct crypto_alg ifxdeu_arc4_alg = {
         .cra_name               =       "arc4",
         .cra_driver_name        =       "ifxdeu-arc4",
+        .cra_priority           =       300,
         .cra_flags              =       CRYPTO_ALG_TYPE_CIPHER,
         .cra_blocksize          =       ARC4_BLOCK_SIZE,
         .cra_ctxsize            =       sizeof(struct arc4_ctx),
@@ -324,6 +325,7 @@ static int ecb_arc4_decrypt(struct blkcipher_desc *desc,
 static struct crypto_alg ifxdeu_ecb_arc4_alg = {
         .cra_name               =       "ecb(arc4)",
         .cra_driver_name        =       "ifxdeu-ecb(arc4)",
+        .cra_priority           =       400,
         .cra_flags              =       CRYPTO_ALG_TYPE_BLKCIPHER,
         .cra_blocksize          =       ARC4_BLOCK_SIZE,
         .cra_ctxsize            =       sizeof(struct arc4_ctx),
diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_async_aes.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_async_aes.c
index 64536da..15e1485 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_async_aes.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_async_aes.c
@@ -992,7 +992,7 @@ static struct lq_aes_alg aes_drivers_alg[] = {
            .cra_blocksize   = AES_BLOCK_SIZE,
            .cra_ctxsize     = sizeof(struct aes_ctx),
            .cra_type        = &crypto_ablkcipher_type,
-           .cra_priority    = 300,
+           .cra_priority    = 400,
            .cra_module      = THIS_MODULE,
            .cra_ablkcipher = {
                                 .setkey = aes_generic_setkey,
@@ -1012,7 +1012,7 @@ static struct lq_aes_alg aes_drivers_alg[] = {
            .cra_blocksize   = AES_BLOCK_SIZE,
            .cra_ctxsize     = sizeof(struct aes_ctx),
            .cra_type        = &crypto_ablkcipher_type,
-           .cra_priority    = 300,
+           .cra_priority    = 400,
            .cra_module      = THIS_MODULE,
            .cra_ablkcipher = {
                                 .setkey = aes_generic_setkey,
@@ -1032,7 +1032,7 @@ static struct lq_aes_alg aes_drivers_alg[] = {
            .cra_blocksize   = AES_BLOCK_SIZE,
            .cra_ctxsize     = sizeof(struct aes_ctx),
            .cra_type        = &crypto_ablkcipher_type,
-           .cra_priority    = 300,
+           .cra_priority    = 400,
            .cra_module      = THIS_MODULE,
            .cra_ablkcipher = {
                                 .setkey = aes_generic_setkey,
@@ -1052,7 +1052,7 @@ static struct lq_aes_alg aes_drivers_alg[] = {
            .cra_blocksize   = AES_BLOCK_SIZE,
            .cra_ctxsize     = sizeof(struct aes_ctx),
            .cra_type        = &crypto_ablkcipher_type,
-           .cra_priority    = 300,
+           .cra_priority    = 400,
            .cra_module      = THIS_MODULE,
            .cra_ablkcipher = {
                                 .setkey = rfc3686_aes_setkey,
diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_async_des.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_async_des.c
index 9c593ae..ea94c64 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_async_des.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_async_des.c
@@ -790,7 +790,7 @@ static struct lq_des_alg des_drivers_alg [] = {
             .cra_blocksize   = DES_BLOCK_SIZE,
             .cra_ctxsize     = sizeof(struct des_ctx),
             .cra_type        = &crypto_ablkcipher_type,
-            .cra_priority    = 300,
+            .cra_priority    = 400,
             .cra_module      = THIS_MODULE,
             .cra_ablkcipher  = {
                                 .setkey = lq_des_setkey,
@@ -810,7 +810,7 @@ static struct lq_des_alg des_drivers_alg [] = {
             .cra_blocksize   = DES_BLOCK_SIZE,
             .cra_ctxsize     = sizeof(struct des_ctx),
             .cra_type        = &crypto_ablkcipher_type,
-            .cra_priority    = 300,
+            .cra_priority    = 400,
             .cra_module      = THIS_MODULE,
             .cra_ablkcipher  = {
                                 .setkey = lq_des_setkey,
@@ -850,7 +850,7 @@ static struct lq_des_alg des_drivers_alg [] = {
             .cra_blocksize   = DES_BLOCK_SIZE,
             .cra_ctxsize     = sizeof(struct des_ctx),
             .cra_type        = &crypto_ablkcipher_type,
-            .cra_priority    = 300,
+            .cra_priority    = 400,
             .cra_module      = THIS_MODULE,
             .cra_ablkcipher  = {
                                 .setkey = lq_des3_ede_setkey,
@@ -870,7 +870,7 @@ static struct lq_des_alg des_drivers_alg [] = {
             .cra_blocksize   = DES_BLOCK_SIZE,
             .cra_ctxsize     = sizeof(struct des_ctx),
             .cra_type        = &crypto_ablkcipher_type,
-            .cra_priority    = 300,
+            .cra_priority    = 400,
             .cra_module      = THIS_MODULE,
             .cra_ablkcipher  = {
                                 .setkey = lq_des3_ede_setkey,
diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c
index 513c916..5b73b6a 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c
@@ -416,6 +416,7 @@ int des3_ede_setkey(struct crypto_tfm *tfm, const u8 *key,
 struct crypto_alg ifxdeu_des_alg = {
         .cra_name               =       "des",
         .cra_driver_name        =       "ifxdeu-des",
+        .cra_priority           =       300,
         .cra_flags              =       CRYPTO_ALG_TYPE_CIPHER,
         .cra_blocksize          =       DES_BLOCK_SIZE,
         .cra_ctxsize            =       sizeof(struct des_ctx),
@@ -436,6 +437,7 @@ struct crypto_alg ifxdeu_des_alg = {
 struct crypto_alg ifxdeu_des3_ede_alg = {
         .cra_name               =       "des3_ede",
         .cra_driver_name        =       "ifxdeu-des3_ede",
+        .cra_priority           =       300,
         .cra_flags              =       CRYPTO_ALG_TYPE_CIPHER,
         .cra_blocksize          =       DES_BLOCK_SIZE,
         .cra_ctxsize            =       sizeof(struct des_ctx),
@@ -520,6 +522,7 @@ int ecb_des_decrypt(struct blkcipher_desc *desc,
 struct crypto_alg ifxdeu_ecb_des_alg = {
         .cra_name               =       "ecb(des)",
         .cra_driver_name        =       "ifxdeu-ecb(des)",
+        .cra_priority           =       400,
         .cra_flags              =       CRYPTO_ALG_TYPE_BLKCIPHER,
         .cra_blocksize          =       DES_BLOCK_SIZE,
         .cra_ctxsize            =       sizeof(struct des_ctx),
@@ -543,6 +546,7 @@ struct crypto_alg ifxdeu_ecb_des_alg = {
 struct crypto_alg ifxdeu_ecb_des3_ede_alg = {
         .cra_name               =       "ecb(des3_ede)",
         .cra_driver_name        =       "ifxdeu-ecb(des3_ede)",
+        .cra_priority           =       400,
         .cra_flags              =       CRYPTO_ALG_TYPE_BLKCIPHER,
         .cra_blocksize          =       DES3_EDE_BLOCK_SIZE,
         .cra_ctxsize            =       sizeof(struct des_ctx),
@@ -634,6 +638,7 @@ int cbc_des_decrypt(struct blkcipher_desc *desc,
 struct crypto_alg ifxdeu_cbc_des_alg = {
         .cra_name               =       "cbc(des)",
         .cra_driver_name        =       "ifxdeu-cbc(des)",
+        .cra_priority           =       400,
         .cra_flags              =       CRYPTO_ALG_TYPE_BLKCIPHER,
         .cra_blocksize          =       DES_BLOCK_SIZE,
         .cra_ctxsize            =       sizeof(struct des_ctx),
@@ -658,6 +663,7 @@ struct crypto_alg ifxdeu_cbc_des_alg = {
 struct crypto_alg ifxdeu_cbc_des3_ede_alg = {
         .cra_name               =       "cbc(des3_ede)",
         .cra_driver_name        =       "ifxdeu-cbc(des3_ede)",
+        .cra_priority           =       400,
         .cra_flags              =       CRYPTO_ALG_TYPE_BLKCIPHER,
         .cra_blocksize          =       DES3_EDE_BLOCK_SIZE,
         .cra_ctxsize            =       sizeof(struct des_ctx),
diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c
index 591389f..47e1f49 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c
@@ -269,6 +269,7 @@ static struct shash_alg ifxdeu_md5_alg = {
     .base               =       {
                 .cra_name       =       "md5",
                 .cra_driver_name=       "ifxdeu-md5",
+                .cra_priority   =       300,
                 .cra_flags      =       CRYPTO_ALG_TYPE_DIGEST,
                 .cra_blocksize  =       MD5_HMAC_BLOCK_SIZE,
                 .cra_module     =       THIS_MODULE,
diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_md5_hmac.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_md5_hmac.c
index fc6f52e..ef2f6aa 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_md5_hmac.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_md5_hmac.c
@@ -344,6 +344,7 @@ static struct shash_alg ifxdeu_md5_hmac_alg = {
     .base               =       {
         .cra_name       =       "hmac(md5)",
         .cra_driver_name=       "ifxdeu-md5_hmac",
+        .cra_priority   =       400,
         .cra_ctxsize    =	sizeof(struct md5_hmac_ctx),
         .cra_flags      =       CRYPTO_ALG_TYPE_DIGEST,
         .cra_blocksize  =       MD5_HMAC_BLOCK_SIZE,
diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c
index 2492549..1471574 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c
@@ -258,6 +258,7 @@ static struct shash_alg ifxdeu_sha1_alg = {
         .base           =       {
                 .cra_name       =       "sha1",
                 .cra_driver_name=       "ifxdeu-sha1",
+                .cra_priority   =       300,
                 .cra_flags      =       CRYPTO_ALG_TYPE_DIGEST,
                 .cra_blocksize  =       SHA1_HMAC_BLOCK_SIZE,
                 .cra_module     =       THIS_MODULE,
diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c
index a447c15..7287a82 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c
@@ -332,6 +332,7 @@ static struct shash_alg ifxdeu_sha1_hmac_alg = {
         .base           =       {
                 .cra_name       =       "hmac(sha1)",
                 .cra_driver_name=       "ifxdeu-sha1_hmac",
+                .cra_priority   =       400,
 		.cra_ctxsize    =	sizeof(struct sha1_hmac_ctx),
                 .cra_flags      =       CRYPTO_ALG_TYPE_DIGEST,
                 .cra_blocksize  =       SHA1_HMAC_BLOCK_SIZE,
-- 
2.1.4




More information about the Lede-dev mailing list