ltq-deu: make cipher/digest usable by openssl
authorMathias Kresin <dev@kresin.me>
Wed, 14 Apr 2021 22:38:36 +0000 (00:38 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Wed, 5 Jan 2022 22:05:38 +0000 (23:05 +0100)
OpenSSL with cryptdev support uses the data encryption unit (DEU) driver
for hard accelerated processing of ciphers/digests, if the flag
CRYPTO_ALG_KERN_DRIVER_ONLY is set.

Signed-off-by: Mathias Kresin <dev@kresin.me>
[fix commit title prefix]
Signed-off-by: Daniel Kestrel <kestrel1974@t-online.de>
package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c
package/kernel/lantiq/ltq-deu/src/ifxmips_arc4.c
package/kernel/lantiq/ltq-deu/src/ifxmips_async_aes.c
package/kernel/lantiq/ltq-deu/src/ifxmips_async_des.c
package/kernel/lantiq/ltq-deu/src/ifxmips_des.c
package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c
package/kernel/lantiq/ltq-deu/src/ifxmips_md5_hmac.c
package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c
package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c

index ab30293340d975a7354e97c9d92e151a03cf77fd..7d11a251de43a664949d0ddf7f5719505f600301 100644 (file)
@@ -457,7 +457,7 @@ struct crypto_alg ifxdeu_aes_alg = {
     .cra_name       =   "aes",
     .cra_driver_name    =   "ifxdeu-aes",
     .cra_priority   =   300,
-    .cra_flags      =   CRYPTO_ALG_TYPE_CIPHER,
+    .cra_flags      =   CRYPTO_ALG_TYPE_CIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY,
     .cra_blocksize      =   AES_BLOCK_SIZE,
     .cra_ctxsize        =   sizeof(struct aes_ctx),
     .cra_module     =   THIS_MODULE,
@@ -544,7 +544,7 @@ 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_flags      =   CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY,
     .cra_blocksize      =   AES_BLOCK_SIZE,
     .cra_ctxsize        =   sizeof(struct aes_ctx),
     .cra_type       =   &crypto_blkcipher_type,
@@ -635,7 +635,7 @@ 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_flags      =   CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY,
     .cra_blocksize      =   AES_BLOCK_SIZE,
     .cra_ctxsize        =   sizeof(struct aes_ctx),
     .cra_type       =   &crypto_blkcipher_type,
@@ -718,7 +718,7 @@ 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_flags      =   CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY,
     .cra_blocksize      =   1,
     .cra_ctxsize        =   sizeof(struct aes_ctx),
     .cra_type       =   &crypto_blkcipher_type,
@@ -858,7 +858,7 @@ 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_flags         =   CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY,
     .cra_blocksize      =   1,
     .cra_ctxsize        =   sizeof(struct aes_ctx),
     .cra_type          =   &crypto_blkcipher_type,
index 9faad94016bc93d44c6125dc90440ffaf70dc3c1..b2e7c9d14593be9f897ff205191d04d9c0a34b46 100644 (file)
@@ -243,7 +243,7 @@ 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_flags              =       CRYPTO_ALG_TYPE_CIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY,
         .cra_blocksize          =       ARC4_BLOCK_SIZE,
         .cra_ctxsize            =       sizeof(struct arc4_ctx),
         .cra_module             =       THIS_MODULE,
@@ -326,7 +326,7 @@ 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_flags              =       CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY,
         .cra_blocksize          =       ARC4_BLOCK_SIZE,
         .cra_ctxsize            =       sizeof(struct arc4_ctx),
         .cra_type               =       &crypto_blkcipher_type,
index dcd059371fade6095e93a306c06843d6ece1cd9f..8184fed71fa0b37f6f3477d540b3476e7e7249b6 100644 (file)
@@ -964,7 +964,7 @@ static struct lq_aes_alg aes_drivers_alg[] = {
          .alg = {
            .cra_name       = "aes",
            .cra_driver_name = "ifxdeu-aes",
-           .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
+           .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
            .cra_blocksize   = AES_BLOCK_SIZE,
            .cra_ctxsize     = sizeof(struct aes_ctx),
            .cra_type        = &crypto_ablkcipher_type,
@@ -984,7 +984,7 @@ static struct lq_aes_alg aes_drivers_alg[] = {
      .alg = {
            .cra_name        = "ecb(aes)",
            .cra_driver_name = "ifxdeu-ecb(aes)",
-           .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
+           .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
            .cra_blocksize   = AES_BLOCK_SIZE,
            .cra_ctxsize     = sizeof(struct aes_ctx),
            .cra_type        = &crypto_ablkcipher_type,
@@ -1004,7 +1004,7 @@ static struct lq_aes_alg aes_drivers_alg[] = {
          .alg = {
            .cra_name        = "cbc(aes)",
            .cra_driver_name = "ifxdeu-cbc(aes)",
-           .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
+           .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
            .cra_blocksize   = AES_BLOCK_SIZE,
            .cra_ctxsize     = sizeof(struct aes_ctx),
            .cra_type        = &crypto_ablkcipher_type,
@@ -1024,7 +1024,7 @@ static struct lq_aes_alg aes_drivers_alg[] = {
          .alg = {
            .cra_name        = "ctr(aes)",
            .cra_driver_name = "ifxdeu-ctr(aes)",
-           .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
+           .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
            .cra_blocksize   = AES_BLOCK_SIZE,
            .cra_ctxsize     = sizeof(struct aes_ctx),
            .cra_type        = &crypto_ablkcipher_type,
@@ -1044,7 +1044,7 @@ static struct lq_aes_alg aes_drivers_alg[] = {
      .alg = {
            .cra_name        = "rfc3686(ctr(aes))",
            .cra_driver_name = "ifxdeu-rfc3686(ctr(aes))",
-           .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
+           .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
            .cra_blocksize   = AES_BLOCK_SIZE,
            .cra_ctxsize     = sizeof(struct aes_ctx),
            .cra_type        = &crypto_ablkcipher_type,
index 1523763ccd70710b74eec0f0bf2f21af990d1d2c..bd560bf6596d42cf4f5fe0d9cd006c03eda2234a 100644 (file)
@@ -761,7 +761,7 @@ static struct lq_des_alg des_drivers_alg [] = {
         .alg = {
             .cra_name        = "des",
             .cra_driver_name = "lqdeu-des",
-            .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, 
+            .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC, 
             .cra_blocksize   = DES_BLOCK_SIZE,
             .cra_ctxsize     = sizeof(struct des_ctx),
             .cra_type        = &crypto_ablkcipher_type,
@@ -782,7 +782,7 @@ static struct lq_des_alg des_drivers_alg [] = {
         .alg = {
             .cra_name        = "ecb(des)",
             .cra_driver_name = "lqdeu-ecb(des)",
-            .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, 
+            .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC, 
             .cra_blocksize   = DES_BLOCK_SIZE,
             .cra_ctxsize     = sizeof(struct des_ctx),
             .cra_type        = &crypto_ablkcipher_type,
@@ -802,7 +802,7 @@ static struct lq_des_alg des_drivers_alg [] = {
         .alg = {
             .cra_name        = "cbc(des)",
             .cra_driver_name = "lqdeu-cbc(des)",
-            .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, 
+            .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC, 
             .cra_blocksize   = DES_BLOCK_SIZE,
             .cra_ctxsize     = sizeof(struct des_ctx),
             .cra_type        = &crypto_ablkcipher_type,
@@ -822,7 +822,7 @@ static struct lq_des_alg des_drivers_alg [] = {
         .alg = {
             .cra_name        = "des3_ede",
             .cra_driver_name = "lqdeu-des3_ede",
-            .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, 
+            .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC, 
             .cra_blocksize   = DES_BLOCK_SIZE,
             .cra_ctxsize     = sizeof(struct des_ctx),
             .cra_type        = &crypto_ablkcipher_type,
@@ -842,7 +842,7 @@ static struct lq_des_alg des_drivers_alg [] = {
         .alg = {
             .cra_name        = "ecb(des3_ede)",
             .cra_driver_name = "lqdeu-ecb(des3_ede)",
-            .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, 
+            .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC, 
             .cra_blocksize   = DES_BLOCK_SIZE,
             .cra_ctxsize     = sizeof(struct des_ctx),
             .cra_type        = &crypto_ablkcipher_type,
@@ -862,7 +862,7 @@ static struct lq_des_alg des_drivers_alg [] = {
         .alg = {
             .cra_name        = "cbc(des3_ede)",
             .cra_driver_name = "lqdeu-cbc(des3_ede)",
-            .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, 
+            .cra_flags       = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC, 
             .cra_blocksize   = DES_BLOCK_SIZE,
             .cra_ctxsize     = sizeof(struct des_ctx),
             .cra_type        = &crypto_ablkcipher_type,
index 69a758c33c32211700ef157c1ca56a92a8928372..7bb14b4d579027cd5362e6fb6368ac83a24715da 100644 (file)
@@ -417,7 +417,7 @@ struct crypto_alg ifxdeu_des_alg = {
         .cra_name               =       "des",
         .cra_driver_name        =       "ifxdeu-des",
         .cra_priority           =       300,
-        .cra_flags              =       CRYPTO_ALG_TYPE_CIPHER,
+        .cra_flags              =       CRYPTO_ALG_TYPE_CIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY,
         .cra_blocksize          =       DES_BLOCK_SIZE,
         .cra_ctxsize            =       sizeof(struct des_ctx),
         .cra_module             =       THIS_MODULE,
@@ -438,7 +438,7 @@ 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_flags              =       CRYPTO_ALG_TYPE_CIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY,
         .cra_blocksize          =       DES_BLOCK_SIZE,
         .cra_ctxsize            =       sizeof(struct des_ctx),
         .cra_module             =       THIS_MODULE,
@@ -523,7 +523,7 @@ 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_flags              =       CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY,
         .cra_blocksize          =       DES_BLOCK_SIZE,
         .cra_ctxsize            =       sizeof(struct des_ctx),
         .cra_type               =       &crypto_blkcipher_type,
@@ -547,7 +547,7 @@ 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_flags              =       CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY,
         .cra_blocksize          =       DES3_EDE_BLOCK_SIZE,
         .cra_ctxsize            =       sizeof(struct des_ctx),
         .cra_type               =       &crypto_blkcipher_type,
@@ -639,7 +639,7 @@ 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_flags              =       CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY,
         .cra_blocksize          =       DES_BLOCK_SIZE,
         .cra_ctxsize            =       sizeof(struct des_ctx),
         .cra_type               =       &crypto_blkcipher_type,
@@ -664,7 +664,7 @@ 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_flags              =       CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY,
         .cra_blocksize          =       DES3_EDE_BLOCK_SIZE,
         .cra_ctxsize            =       sizeof(struct des_ctx),
         .cra_type               =       &crypto_blkcipher_type,
index 11cb64799e900a3cfe1303fda6016f7d0fbed8a0..14967c30d6e7a7c18d0e1e5e5a0bf96d7c5fbe1f 100644 (file)
@@ -270,7 +270,7 @@ static struct shash_alg ifxdeu_md5_alg = {
                 .cra_name       =       "md5",
                 .cra_driver_name=       "ifxdeu-md5",
                 .cra_priority   =       300,
-                .cra_flags      =       CRYPTO_ALG_TYPE_HASH,
+                .cra_flags      =       CRYPTO_ALG_TYPE_HASH | CRYPTO_ALG_KERN_DRIVER_ONLY,
                 .cra_blocksize  =       MD5_HMAC_BLOCK_SIZE,
                 .cra_module     =       THIS_MODULE,
     }
index 6cb2e5a417433505ef94506ae3f6a8be78817632..b6e65c8b22180119acaeca99000c90434c0e889f 100644 (file)
@@ -346,7 +346,7 @@ static struct shash_alg ifxdeu_md5_hmac_alg = {
         .cra_driver_name=       "ifxdeu-md5_hmac",
         .cra_priority   =       400,
         .cra_ctxsize    =      sizeof(struct md5_hmac_ctx),
-        .cra_flags      =       CRYPTO_ALG_TYPE_HASH,
+        .cra_flags      =       CRYPTO_ALG_TYPE_HASH | CRYPTO_ALG_KERN_DRIVER_ONLY,
         .cra_blocksize  =       MD5_HMAC_BLOCK_SIZE,
         .cra_module     =       THIS_MODULE,
         }
index d711c4804db505dc4d132442586b7c15f3d3b09d..9112febbb71db3fa37dbc2124c8040341e3856d0 100644 (file)
@@ -259,7 +259,7 @@ static struct shash_alg ifxdeu_sha1_alg = {
                 .cra_name       =       "sha1",
                 .cra_driver_name=       "ifxdeu-sha1",
                 .cra_priority   =       300,
-                .cra_flags      =       CRYPTO_ALG_TYPE_HASH,
+                .cra_flags      =       CRYPTO_ALG_TYPE_HASH | CRYPTO_ALG_KERN_DRIVER_ONLY,
                 .cra_blocksize  =       SHA1_HMAC_BLOCK_SIZE,
                 .cra_module     =       THIS_MODULE,
         }
index 7776c51686a2bccfda871dcd760636d008bf7f88..465c58f1050b09f9bf54b6c51fd62cfc540ac38e 100644 (file)
@@ -334,7 +334,7 @@ static struct shash_alg ifxdeu_sha1_hmac_alg = {
                 .cra_driver_name=       "ifxdeu-sha1_hmac",
                 .cra_priority   =       400,
                .cra_ctxsize    =       sizeof(struct sha1_hmac_ctx),
-                .cra_flags      =       CRYPTO_ALG_TYPE_HASH,
+                .cra_flags      =       CRYPTO_ALG_TYPE_HASH | CRYPTO_ALG_KERN_DRIVER_ONLY,
                 .cra_blocksize  =       SHA1_HMAC_BLOCK_SIZE,
                 .cra_module     =       THIS_MODULE,
         }