On Wed, Jan 13, 2016 at 03:52:02PM -0200, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.este...@nxp.com>
> 
> Based on commit 434b421241f2d0 ("crypto: caam - avoid needlessly saving and
> restoring caam_hash_ctx") from Russell King.
> 
> 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 sahara_ctx structure on export, and
> restoring it on import is a waste of resources.  So, remove this code.
> 
> Signed-off-by: Fabio Estevam <fabio.este...@nxp.com>

Very good.  Not only is it a waste, it's a gaping security hole
because modifying the tfm from import will corrupt it.

But this is not enough, you're still copying things like the mutex
which should not be copied but instead should be reinitialised in
import.

Thanks,
-- 
Email: Herbert Xu <herb...@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to