Commit ce0183cb authored by Ard Biesheuvel's avatar Ard Biesheuvel Committed by Herbert Xu

crypto: rockchip - switch to skcipher API

Commit 7a7ffe65 ("crypto: skcipher - Add top-level skcipher interface")
dated 20 august 2015 introduced the new skcipher API which is supposed to
replace both blkcipher and ablkcipher. While all consumers of the API have
been converted long ago, some producers of the ablkcipher remain, forcing
us to keep the ablkcipher support routines alive, along with the matching
code to expose [a]blkciphers via the skcipher API.

So switch this driver to the skcipher API, allowing us to finally drop the
ablkcipher code in the near future.

Cc: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 23a6564a
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_CRYPTO_DEV_ROCKCHIP) += rk_crypto.o obj-$(CONFIG_CRYPTO_DEV_ROCKCHIP) += rk_crypto.o
rk_crypto-objs := rk3288_crypto.o \ rk_crypto-objs := rk3288_crypto.o \
rk3288_crypto_ablkcipher.o \ rk3288_crypto_skcipher.o \
rk3288_crypto_ahash.o rk3288_crypto_ahash.o
...@@ -264,8 +264,8 @@ static int rk_crypto_register(struct rk_crypto_info *crypto_info) ...@@ -264,8 +264,8 @@ static int rk_crypto_register(struct rk_crypto_info *crypto_info)
for (i = 0; i < ARRAY_SIZE(rk_cipher_algs); i++) { for (i = 0; i < ARRAY_SIZE(rk_cipher_algs); i++) {
rk_cipher_algs[i]->dev = crypto_info; rk_cipher_algs[i]->dev = crypto_info;
if (rk_cipher_algs[i]->type == ALG_TYPE_CIPHER) if (rk_cipher_algs[i]->type == ALG_TYPE_CIPHER)
err = crypto_register_alg( err = crypto_register_skcipher(
&rk_cipher_algs[i]->alg.crypto); &rk_cipher_algs[i]->alg.skcipher);
else else
err = crypto_register_ahash( err = crypto_register_ahash(
&rk_cipher_algs[i]->alg.hash); &rk_cipher_algs[i]->alg.hash);
...@@ -277,7 +277,7 @@ static int rk_crypto_register(struct rk_crypto_info *crypto_info) ...@@ -277,7 +277,7 @@ static int rk_crypto_register(struct rk_crypto_info *crypto_info)
err_cipher_algs: err_cipher_algs:
for (k = 0; k < i; k++) { for (k = 0; k < i; k++) {
if (rk_cipher_algs[i]->type == ALG_TYPE_CIPHER) if (rk_cipher_algs[i]->type == ALG_TYPE_CIPHER)
crypto_unregister_alg(&rk_cipher_algs[k]->alg.crypto); crypto_unregister_skcipher(&rk_cipher_algs[k]->alg.skcipher);
else else
crypto_unregister_ahash(&rk_cipher_algs[i]->alg.hash); crypto_unregister_ahash(&rk_cipher_algs[i]->alg.hash);
} }
...@@ -290,7 +290,7 @@ static void rk_crypto_unregister(void) ...@@ -290,7 +290,7 @@ static void rk_crypto_unregister(void)
for (i = 0; i < ARRAY_SIZE(rk_cipher_algs); i++) { for (i = 0; i < ARRAY_SIZE(rk_cipher_algs); i++) {
if (rk_cipher_algs[i]->type == ALG_TYPE_CIPHER) if (rk_cipher_algs[i]->type == ALG_TYPE_CIPHER)
crypto_unregister_alg(&rk_cipher_algs[i]->alg.crypto); crypto_unregister_skcipher(&rk_cipher_algs[i]->alg.skcipher);
else else
crypto_unregister_ahash(&rk_cipher_algs[i]->alg.hash); crypto_unregister_ahash(&rk_cipher_algs[i]->alg.hash);
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <crypto/internal/hash.h> #include <crypto/internal/hash.h>
#include <crypto/internal/skcipher.h>
#include <crypto/md5.h> #include <crypto/md5.h>
#include <crypto/sha.h> #include <crypto/sha.h>
...@@ -256,7 +257,7 @@ enum alg_type { ...@@ -256,7 +257,7 @@ enum alg_type {
struct rk_crypto_tmp { struct rk_crypto_tmp {
struct rk_crypto_info *dev; struct rk_crypto_info *dev;
union { union {
struct crypto_alg crypto; struct skcipher_alg skcipher;
struct ahash_alg hash; struct ahash_alg hash;
} alg; } alg;
enum alg_type type; enum alg_type type;
......
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