aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/crypto
diff options
context:
space:
mode:
authorTorsten Duwe <duwe@suse.de>2020-02-25 15:34:30 +0100
committerVasily Gorbik <gor@linux.ibm.com>2020-02-27 16:02:21 +0100
commit4a559cd15dbc79958fa9b18ad4e8afe4a0bf4744 (patch)
tree4c42b6a1b4f5cbc506bd574474dc8b1f0f9c2fa3 /arch/s390/crypto
parents390: Replace zero-length array with flexible-array member (diff)
downloadlinux-dev-4a559cd15dbc79958fa9b18ad4e8afe4a0bf4744.tar.xz
linux-dev-4a559cd15dbc79958fa9b18ad4e8afe4a0bf4744.zip
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>
Diffstat (limited to 'arch/s390/crypto')
-rw-r--r--arch/s390/crypto/aes_s390.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
index 1c23d84a9097..73044634d342 100644
--- a/arch/s390/crypto/aes_s390.c
+++ b/arch/s390/crypto/aes_s390.c
@@ -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;
}
@@ -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;
}