aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto/nx/nx.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-06-16 01:54:21 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2015-06-17 03:35:07 -0400
commit201f28f055917300c3301b19d0e0e674b9cf8cb7 (patch)
tree40239555d2d3bd173a28568fd1ae3f21f8d25c53 /drivers/crypto/nx/nx.c
parent0af8fbca8c7149c6c637291ed167badbb011b544 (diff)
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 <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/nx/nx.c')
-rw-r--r--drivers/crypto/nx/nx.c26
1 files changed, 16 insertions, 10 deletions
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 @@
19 * Author: Kent Yoder <yoder1@us.ibm.com> 19 * Author: Kent Yoder <yoder1@us.ibm.com>
20 */ 20 */
21 21
22#include <crypto/internal/aead.h>
22#include <crypto/internal/hash.h> 23#include <crypto/internal/hash.h>
23#include <crypto/hash.h>
24#include <crypto/aes.h> 24#include <crypto/aes.h>
25#include <crypto/sha.h> 25#include <crypto/sha.h>
26#include <crypto/algapi.h> 26#include <crypto/algapi.h>
@@ -29,7 +29,6 @@
29#include <linux/moduleparam.h> 29#include <linux/moduleparam.h>
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/mm.h> 31#include <linux/mm.h>
32#include <linux/crypto.h>
33#include <linux/scatterlist.h> 32#include <linux/scatterlist.h>
34#include <linux/device.h> 33#include <linux/device.h>
35#include <linux/of.h> 34#include <linux/of.h>
@@ -531,11 +530,11 @@ static int nx_register_algs(void)
531 if (rc) 530 if (rc)
532 goto out_unreg_ctr; 531 goto out_unreg_ctr;
533 532
534 rc = crypto_register_alg(&nx_gcm_aes_alg); 533 rc = crypto_register_aead(&nx_gcm_aes_alg);
535 if (rc) 534 if (rc)
536 goto out_unreg_ctr3686; 535 goto out_unreg_ctr3686;
537 536
538 rc = crypto_register_alg(&nx_gcm4106_aes_alg); 537 rc = crypto_register_aead(&nx_gcm4106_aes_alg);
539 if (rc) 538 if (rc)
540 goto out_unreg_gcm; 539 goto out_unreg_gcm;
541 540
@@ -570,9 +569,9 @@ out_unreg_ccm4309:
570out_unreg_ccm: 569out_unreg_ccm:
571 crypto_unregister_alg(&nx_ccm_aes_alg); 570 crypto_unregister_alg(&nx_ccm_aes_alg);
572out_unreg_gcm4106: 571out_unreg_gcm4106:
573 crypto_unregister_alg(&nx_gcm4106_aes_alg); 572 crypto_unregister_aead(&nx_gcm4106_aes_alg);
574out_unreg_gcm: 573out_unreg_gcm:
575 crypto_unregister_alg(&nx_gcm_aes_alg); 574 crypto_unregister_aead(&nx_gcm_aes_alg);
576out_unreg_ctr3686: 575out_unreg_ctr3686:
577 crypto_unregister_alg(&nx_ctr3686_aes_alg); 576 crypto_unregister_alg(&nx_ctr3686_aes_alg);
578out_unreg_ctr: 577out_unreg_ctr:
@@ -639,9 +638,9 @@ int nx_crypto_ctx_aes_ccm_init(struct crypto_tfm *tfm)
639 NX_MODE_AES_CCM); 638 NX_MODE_AES_CCM);
640} 639}
641 640
642int nx_crypto_ctx_aes_gcm_init(struct crypto_tfm *tfm) 641int nx_crypto_ctx_aes_gcm_init(struct crypto_aead *tfm)
643{ 642{
644 return nx_crypto_ctx_init(crypto_tfm_ctx(tfm), NX_FC_AES, 643 return nx_crypto_ctx_init(crypto_aead_ctx(tfm), NX_FC_AES,
645 NX_MODE_AES_GCM); 644 NX_MODE_AES_GCM);
646} 645}
647 646
@@ -693,6 +692,13 @@ void nx_crypto_ctx_exit(struct crypto_tfm *tfm)
693 nx_ctx->out_sg = NULL; 692 nx_ctx->out_sg = NULL;
694} 693}
695 694
695void nx_crypto_ctx_aead_exit(struct crypto_aead *tfm)
696{
697 struct nx_crypto_ctx *nx_ctx = crypto_aead_ctx(tfm);
698
699 kzfree(nx_ctx->kmem);
700}
701
696static int nx_probe(struct vio_dev *viodev, const struct vio_device_id *id) 702static int nx_probe(struct vio_dev *viodev, const struct vio_device_id *id)
697{ 703{
698 dev_dbg(&viodev->dev, "driver probed: %s resource id: 0x%x\n", 704 dev_dbg(&viodev->dev, "driver probed: %s resource id: 0x%x\n",
@@ -721,8 +727,8 @@ static int nx_remove(struct vio_dev *viodev)
721 727
722 crypto_unregister_alg(&nx_ccm_aes_alg); 728 crypto_unregister_alg(&nx_ccm_aes_alg);
723 crypto_unregister_alg(&nx_ccm4309_aes_alg); 729 crypto_unregister_alg(&nx_ccm4309_aes_alg);
724 crypto_unregister_alg(&nx_gcm_aes_alg); 730 crypto_unregister_aead(&nx_gcm_aes_alg);
725 crypto_unregister_alg(&nx_gcm4106_aes_alg); 731 crypto_unregister_aead(&nx_gcm4106_aes_alg);
726 crypto_unregister_alg(&nx_ctr_aes_alg); 732 crypto_unregister_alg(&nx_ctr_aes_alg);
727 crypto_unregister_alg(&nx_ctr3686_aes_alg); 733 crypto_unregister_alg(&nx_ctr3686_aes_alg);
728 crypto_unregister_alg(&nx_cbc_aes_alg); 734 crypto_unregister_alg(&nx_cbc_aes_alg);