diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2015-10-18 17:51:15 +0100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2015-10-20 22:11:10 +0800 |
commit | 434b421241f2d0faa7fea75f6320de00c5e3430e (patch) | |
tree | ac0626da8df3346d76537e1e9dc28da5d4742e70 /drivers/crypto | |
parent | 6ea30f0acfd1c269520c561b45762c0de590007f (diff) | |
download | op-kernel-dev-434b421241f2d0faa7fea75f6320de00c5e3430e.zip op-kernel-dev-434b421241f2d0faa7fea75f6320de00c5e3430e.tar.gz |
crypto: caam - avoid needlessly saving and restoring caam_hash_ctx
When exporting and importing the hash state, we will only export and
import into hashes which share the same struct crypto_ahash pointer.
(See hash_accept->af_alg_accept->hash_accept_parent.)
This means that saving the caam_hash_ctx structure on export, and
restoring it on import is a waste of resources. So, remove this code.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/caam/caamhash.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c index 1f58a79..cb7af55 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c @@ -1554,24 +1554,20 @@ static int ahash_final(struct ahash_request *req) static int ahash_export(struct ahash_request *req, void *out) { struct crypto_ahash *ahash = crypto_ahash_reqtfm(req); - struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash); struct caam_hash_state *state = ahash_request_ctx(req); - memcpy(out, ctx, sizeof(struct caam_hash_ctx)); - memcpy(out + sizeof(struct caam_hash_ctx), state, - sizeof(struct caam_hash_state)); + memcpy(out, state, sizeof(struct caam_hash_state)); + return 0; } static int ahash_import(struct ahash_request *req, const void *in) { struct crypto_ahash *ahash = crypto_ahash_reqtfm(req); - struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash); struct caam_hash_state *state = ahash_request_ctx(req); - memcpy(ctx, in, sizeof(struct caam_hash_ctx)); - memcpy(state, in + sizeof(struct caam_hash_ctx), - sizeof(struct caam_hash_state)); + memcpy(state, in, sizeof(struct caam_hash_state)); + return 0; } |