Re: [PATCH v2 1/3] crypto: sahara - avoid needlessly saving and restoring sahara_ctx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 13, 2016 at 03:52:02PM -0200, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@xxxxxxx>
> 
> 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.estevam@xxxxxxx>

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 <herbert@xxxxxxxxxxxxxxxxxxx>
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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux