Skip to content

Commit

Permalink
s390/crypto: explicitly memzero stack key material in aes_s390.c
Browse files Browse the repository at this point in the history
aes_s390.c has several functions which allocate space for key material on
the stack and leave the used keys there. It is considered good practice
to clean these locations before the function returns.

Link: https://lkml.kernel.org/r/20200221165511.GB6928@lst.de
Signed-off-by: Torsten Duwe <duwe@suse.de>
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
  • Loading branch information
Torsten Duwe authored and Vasily Gorbik committed Feb 27, 2020
1 parent fa226f1 commit 4a559cd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/s390/crypto/aes_s390.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ static int cbc_aes_crypt(struct skcipher_request *req, unsigned long modifier)
memcpy(walk.iv, param.iv, AES_BLOCK_SIZE);
ret = skcipher_walk_done(&walk, nbytes - n);
}
memzero_explicit(&param, sizeof(param));
return ret;
}

Expand Down Expand Up @@ -470,6 +471,8 @@ static int xts_aes_crypt(struct skcipher_request *req, unsigned long modifier)
walk.dst.virt.addr, walk.src.virt.addr, n);
ret = skcipher_walk_done(&walk, nbytes - n);
}
memzero_explicit(&pcc_param, sizeof(pcc_param));
memzero_explicit(&xts_param, sizeof(xts_param));
return ret;
}

Expand Down

0 comments on commit 4a559cd

Please sign in to comment.