Commit cc815653 authored by Herbert Xu's avatar Herbert Xu

crypto: nx - Convert ccm to new AEAD interface

This patch converts the nx ccm and 4309 implementations to the
new AEAD interface.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 2642d6ab
This diff is collapsed.
...@@ -612,11 +612,11 @@ static int nx_register_algs(void) ...@@ -612,11 +612,11 @@ static int nx_register_algs(void)
if (rc) if (rc)
goto out_unreg_gcm; goto out_unreg_gcm;
rc = nx_register_alg(&nx_ccm_aes_alg, NX_FC_AES, NX_MODE_AES_CCM); rc = nx_register_aead(&nx_ccm_aes_alg, NX_FC_AES, NX_MODE_AES_CCM);
if (rc) if (rc)
goto out_unreg_gcm4106; goto out_unreg_gcm4106;
rc = nx_register_alg(&nx_ccm4309_aes_alg, NX_FC_AES, NX_MODE_AES_CCM); rc = nx_register_aead(&nx_ccm4309_aes_alg, NX_FC_AES, NX_MODE_AES_CCM);
if (rc) if (rc)
goto out_unreg_ccm; goto out_unreg_ccm;
...@@ -644,9 +644,9 @@ static int nx_register_algs(void) ...@@ -644,9 +644,9 @@ static int nx_register_algs(void)
nx_unregister_shash(&nx_shash_sha256_alg, NX_FC_SHA, NX_MODE_SHA, nx_unregister_shash(&nx_shash_sha256_alg, NX_FC_SHA, NX_MODE_SHA,
NX_PROPS_SHA256); NX_PROPS_SHA256);
out_unreg_ccm4309: out_unreg_ccm4309:
nx_unregister_alg(&nx_ccm4309_aes_alg, NX_FC_AES, NX_MODE_AES_CCM); nx_unregister_aead(&nx_ccm4309_aes_alg, NX_FC_AES, NX_MODE_AES_CCM);
out_unreg_ccm: out_unreg_ccm:
nx_unregister_alg(&nx_ccm_aes_alg, NX_FC_AES, NX_MODE_AES_CCM); nx_unregister_aead(&nx_ccm_aes_alg, NX_FC_AES, NX_MODE_AES_CCM);
out_unreg_gcm4106: out_unreg_gcm4106:
nx_unregister_aead(&nx_gcm4106_aes_alg, NX_FC_AES, NX_MODE_AES_GCM); nx_unregister_aead(&nx_gcm4106_aes_alg, NX_FC_AES, NX_MODE_AES_GCM);
out_unreg_gcm: out_unreg_gcm:
...@@ -711,11 +711,10 @@ static int nx_crypto_ctx_init(struct nx_crypto_ctx *nx_ctx, u32 fc, u32 mode) ...@@ -711,11 +711,10 @@ static int nx_crypto_ctx_init(struct nx_crypto_ctx *nx_ctx, u32 fc, u32 mode)
} }
/* entry points from the crypto tfm initializers */ /* entry points from the crypto tfm initializers */
int nx_crypto_ctx_aes_ccm_init(struct crypto_tfm *tfm) int nx_crypto_ctx_aes_ccm_init(struct crypto_aead *tfm)
{ {
crypto_aead_set_reqsize(__crypto_aead_cast(tfm), crypto_aead_set_reqsize(tfm, sizeof(struct nx_ccm_rctx));
sizeof(struct nx_ccm_rctx)); return nx_crypto_ctx_init(crypto_aead_ctx(tfm), NX_FC_AES,
return nx_crypto_ctx_init(crypto_tfm_ctx(tfm), NX_FC_AES,
NX_MODE_AES_CCM); NX_MODE_AES_CCM);
} }
...@@ -813,9 +812,9 @@ static int nx_remove(struct vio_dev *viodev) ...@@ -813,9 +812,9 @@ static int nx_remove(struct vio_dev *viodev)
NX_FC_SHA, NX_MODE_SHA, NX_PROPS_SHA256); NX_FC_SHA, NX_MODE_SHA, NX_PROPS_SHA256);
nx_unregister_shash(&nx_shash_sha256_alg, nx_unregister_shash(&nx_shash_sha256_alg,
NX_FC_SHA, NX_MODE_SHA, NX_PROPS_SHA512); NX_FC_SHA, NX_MODE_SHA, NX_PROPS_SHA512);
nx_unregister_alg(&nx_ccm4309_aes_alg, nx_unregister_aead(&nx_ccm4309_aes_alg,
NX_FC_AES, NX_MODE_AES_CCM); NX_FC_AES, NX_MODE_AES_CCM);
nx_unregister_alg(&nx_ccm_aes_alg, NX_FC_AES, NX_MODE_AES_CCM); nx_unregister_aead(&nx_ccm_aes_alg, NX_FC_AES, NX_MODE_AES_CCM);
nx_unregister_aead(&nx_gcm4106_aes_alg, nx_unregister_aead(&nx_gcm4106_aes_alg,
NX_FC_AES, NX_MODE_AES_GCM); NX_FC_AES, NX_MODE_AES_GCM);
nx_unregister_aead(&nx_gcm_aes_alg, nx_unregister_aead(&nx_gcm_aes_alg,
......
...@@ -150,7 +150,7 @@ struct nx_crypto_ctx { ...@@ -150,7 +150,7 @@ struct nx_crypto_ctx {
}; };
/* prototypes */ /* prototypes */
int nx_crypto_ctx_aes_ccm_init(struct crypto_tfm *tfm); int nx_crypto_ctx_aes_ccm_init(struct crypto_aead *tfm);
int nx_crypto_ctx_aes_gcm_init(struct crypto_aead *tfm); int nx_crypto_ctx_aes_gcm_init(struct crypto_aead *tfm);
int nx_crypto_ctx_aes_xcbc_init(struct crypto_tfm *tfm); int nx_crypto_ctx_aes_xcbc_init(struct crypto_tfm *tfm);
int nx_crypto_ctx_aes_ctr_init(struct crypto_tfm *tfm); int nx_crypto_ctx_aes_ctr_init(struct crypto_tfm *tfm);
...@@ -189,8 +189,8 @@ extern struct aead_alg nx_gcm_aes_alg; ...@@ -189,8 +189,8 @@ extern struct aead_alg nx_gcm_aes_alg;
extern struct aead_alg nx_gcm4106_aes_alg; extern struct aead_alg nx_gcm4106_aes_alg;
extern struct crypto_alg nx_ctr_aes_alg; extern struct crypto_alg nx_ctr_aes_alg;
extern struct crypto_alg nx_ctr3686_aes_alg; extern struct crypto_alg nx_ctr3686_aes_alg;
extern struct crypto_alg nx_ccm_aes_alg; extern struct aead_alg nx_ccm_aes_alg;
extern struct crypto_alg nx_ccm4309_aes_alg; extern struct aead_alg nx_ccm4309_aes_alg;
extern struct shash_alg nx_shash_aes_xcbc_alg; extern struct shash_alg nx_shash_aes_xcbc_alg;
extern struct shash_alg nx_shash_sha512_alg; extern struct shash_alg nx_shash_sha512_alg;
extern struct shash_alg nx_shash_sha256_alg; extern struct shash_alg nx_shash_sha256_alg;
......
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