Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/crypto: explicitly memzero stack key material in aes_s390.c

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>

authored by

Torsten Duwe and committed by
Vasily Gorbik
4a559cd1 fa226f1d

+3
+3
arch/s390/crypto/aes_s390.c
··· 342 342 memcpy(walk.iv, param.iv, AES_BLOCK_SIZE); 343 343 ret = skcipher_walk_done(&walk, nbytes - n); 344 344 } 345 + memzero_explicit(&param, sizeof(param)); 345 346 return ret; 346 347 } 347 348 ··· 471 470 walk.dst.virt.addr, walk.src.virt.addr, n); 472 471 ret = skcipher_walk_done(&walk, nbytes - n); 473 472 } 473 + memzero_explicit(&pcc_param, sizeof(pcc_param)); 474 + memzero_explicit(&xts_param, sizeof(xts_param)); 474 475 return ret; 475 476 } 476 477