mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 16:49:22 +00:00
crypto: qat - set to zero DH parameters before free
[ Upstream commit1731160ff7
] Set to zero the context buffers containing the DH key before they are freed. This is a defense in depth measure that avoids keys to be recovered from memory in case the system is compromised between the free of the buffer and when that area of memory (containing keys) gets overwritten. Cc: stable@vger.kernel.org Fixes:c9839143eb
("crypto: qat - Add DH support") Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Adam Guerin <adam.guerin@intel.com> Reviewed-by: Wojciech Ziemba <wojciech.ziemba@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
5f2d2c2af1
commit
b2549e3e57
1 changed files with 3 additions and 0 deletions
|
@ -420,14 +420,17 @@ static int qat_dh_set_params(struct qat_dh_ctx *ctx, struct dh *params)
|
||||||
static void qat_dh_clear_ctx(struct device *dev, struct qat_dh_ctx *ctx)
|
static void qat_dh_clear_ctx(struct device *dev, struct qat_dh_ctx *ctx)
|
||||||
{
|
{
|
||||||
if (ctx->g) {
|
if (ctx->g) {
|
||||||
|
memset(ctx->g, 0, ctx->p_size);
|
||||||
dma_free_coherent(dev, ctx->p_size, ctx->g, ctx->dma_g);
|
dma_free_coherent(dev, ctx->p_size, ctx->g, ctx->dma_g);
|
||||||
ctx->g = NULL;
|
ctx->g = NULL;
|
||||||
}
|
}
|
||||||
if (ctx->xa) {
|
if (ctx->xa) {
|
||||||
|
memset(ctx->xa, 0, ctx->p_size);
|
||||||
dma_free_coherent(dev, ctx->p_size, ctx->xa, ctx->dma_xa);
|
dma_free_coherent(dev, ctx->p_size, ctx->xa, ctx->dma_xa);
|
||||||
ctx->xa = NULL;
|
ctx->xa = NULL;
|
||||||
}
|
}
|
||||||
if (ctx->p) {
|
if (ctx->p) {
|
||||||
|
memset(ctx->p, 0, ctx->p_size);
|
||||||
dma_free_coherent(dev, ctx->p_size, ctx->p, ctx->dma_p);
|
dma_free_coherent(dev, ctx->p_size, ctx->p, ctx->dma_p);
|
||||||
ctx->p = NULL;
|
ctx->p = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue