summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe.montjoie@gmail.com>2016-08-10 11:45:33 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2016-08-16 17:17:00 +0800
commit9b17e5ad7831cde78314f96445cfb4a9945c6c68 (patch)
tree6fc6f864150f8bf3602f0d141e9ba820c680edfe /drivers/crypto/sunxi-ss/sun4i-ss-hash.c
parent933e7e3ab239fe7fad5d64f3e2828618b3568e8c (diff)
downloadtalos-obmc-linux-9b17e5ad7831cde78314f96445cfb4a9945c6c68.tar.gz
talos-obmc-linux-9b17e5ad7831cde78314f96445cfb4a9945c6c68.zip
crypto: sun4i-ss - Always use sun4i_tfm_ctx for storing pointer to dev ss
The dev *ss is stored both in sun4i_tfm_ctx and sun4i_req_ctx. Since this pointer will never be changed during tfm life, it is better to remove it from sun4i_req_ctx. Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/sunxi-ss/sun4i-ss-hash.c')
-rw-r--r--drivers/crypto/sunxi-ss/sun4i-ss-hash.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
index 60031e0eeb25..2ee3b59d5ddf 100644
--- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
@@ -20,6 +20,15 @@
int sun4i_hash_crainit(struct crypto_tfm *tfm)
{
+ struct sun4i_tfm_ctx *op = crypto_tfm_ctx(tfm);
+ struct ahash_alg *alg = __crypto_ahash_alg(tfm->__crt_alg);
+ struct sun4i_ss_alg_template *algt;
+
+ memset(op, 0, sizeof(struct sun4i_tfm_ctx));
+
+ algt = container_of(alg, struct sun4i_ss_alg_template, alg.hash);
+ op->ss = algt->ss;
+
crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
sizeof(struct sun4i_req_ctx));
return 0;
@@ -36,7 +45,6 @@ int sun4i_hash_init(struct ahash_request *areq)
memset(op, 0, sizeof(struct sun4i_req_ctx));
algt = container_of(alg, struct sun4i_ss_alg_template, alg.hash);
- op->ss = algt->ss;
op->mode = algt->mode;
return 0;
@@ -168,8 +176,9 @@ int sun4i_hash(struct ahash_request *areq)
*/
struct sun4i_req_ctx *op = ahash_request_ctx(areq);
- struct sun4i_ss_ctx *ss = op->ss;
struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
+ struct sun4i_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm);
+ struct sun4i_ss_ctx *ss = tfmctx->ss;
unsigned int in_i = 0; /* advancement in the current SG */
unsigned int end;
/*
OpenPOWER on IntegriCloud