From 201f28f055917300c3301b19d0e0e674b9cf8cb7 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Tue, 16 Jun 2015 13:54:21 +0800 Subject: crypto: nx - Convert GCM to new AEAD interface This patch converts the nx GCM implementations to the new AEAD interface. This is compile-tested only. Signed-off-by: Herbert Xu --- drivers/crypto/nx/nx.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'drivers/crypto/nx/nx.c') diff --git a/drivers/crypto/nx/nx.c b/drivers/crypto/nx/nx.c index 2e2529ce8d31..847350534cc1 100644 --- a/drivers/crypto/nx/nx.c +++ b/drivers/crypto/nx/nx.c @@ -19,8 +19,8 @@ * Author: Kent Yoder */ +#include #include -#include #include #include #include @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -531,11 +530,11 @@ static int nx_register_algs(void) if (rc) goto out_unreg_ctr; - rc = crypto_register_alg(&nx_gcm_aes_alg); + rc = crypto_register_aead(&nx_gcm_aes_alg); if (rc) goto out_unreg_ctr3686; - rc = crypto_register_alg(&nx_gcm4106_aes_alg); + rc = crypto_register_aead(&nx_gcm4106_aes_alg); if (rc) goto out_unreg_gcm; @@ -570,9 +569,9 @@ out_unreg_ccm4309: out_unreg_ccm: crypto_unregister_alg(&nx_ccm_aes_alg); out_unreg_gcm4106: - crypto_unregister_alg(&nx_gcm4106_aes_alg); + crypto_unregister_aead(&nx_gcm4106_aes_alg); out_unreg_gcm: - crypto_unregister_alg(&nx_gcm_aes_alg); + crypto_unregister_aead(&nx_gcm_aes_alg); out_unreg_ctr3686: crypto_unregister_alg(&nx_ctr3686_aes_alg); out_unreg_ctr: @@ -639,9 +638,9 @@ int nx_crypto_ctx_aes_ccm_init(struct crypto_tfm *tfm) NX_MODE_AES_CCM); } -int nx_crypto_ctx_aes_gcm_init(struct crypto_tfm *tfm) +int nx_crypto_ctx_aes_gcm_init(struct crypto_aead *tfm) { - return nx_crypto_ctx_init(crypto_tfm_ctx(tfm), NX_FC_AES, + return nx_crypto_ctx_init(crypto_aead_ctx(tfm), NX_FC_AES, NX_MODE_AES_GCM); } @@ -693,6 +692,13 @@ void nx_crypto_ctx_exit(struct crypto_tfm *tfm) nx_ctx->out_sg = NULL; } +void nx_crypto_ctx_aead_exit(struct crypto_aead *tfm) +{ + struct nx_crypto_ctx *nx_ctx = crypto_aead_ctx(tfm); + + kzfree(nx_ctx->kmem); +} + static int nx_probe(struct vio_dev *viodev, const struct vio_device_id *id) { dev_dbg(&viodev->dev, "driver probed: %s resource id: 0x%x\n", @@ -721,8 +727,8 @@ static int nx_remove(struct vio_dev *viodev) crypto_unregister_alg(&nx_ccm_aes_alg); crypto_unregister_alg(&nx_ccm4309_aes_alg); - crypto_unregister_alg(&nx_gcm_aes_alg); - crypto_unregister_alg(&nx_gcm4106_aes_alg); + crypto_unregister_aead(&nx_gcm_aes_alg); + crypto_unregister_aead(&nx_gcm4106_aes_alg); crypto_unregister_alg(&nx_ctr_aes_alg); crypto_unregister_alg(&nx_ctr3686_aes_alg); crypto_unregister_alg(&nx_cbc_aes_alg); -- cgit