summaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorHarald Freudenberger <freude@linux.ibm.com>2019-08-29 15:16:35 +0200
committerVasily Gorbik <gor@linux.ibm.com>2019-08-29 16:31:44 +0200
commitdeffa48fb014f06f7cf8c4b3ea3c96160be3c854 (patch)
tree8ac58be33daa3bb1f6a1501825e146bf5dffc920 /drivers/s390
parentMerge tag 'vfio-ccw-20190828' of https://git.kernel.org/pub/scm/linux/kernel/... (diff)
downloadlinux-deffa48fb014f06f7cf8c4b3ea3c96160be3c854.tar.xz
linux-deffa48fb014f06f7cf8c4b3ea3c96160be3c854.zip
s390/zcrypt: fix wrong handling of cca cipher keygenflags
Tests showed that the keygenflags parameter is not handled correctly within the zcrypt ccamisc generate cca cipher key code. A similar code is used with cca cipher key value import and there the flags are handled correctly. For unknown reason these lines have not been updated for the generate function and so this patch now introduces these two lines of code. This affects only pkey with the use of CCA cipher keys and the use of additional key generate flags. Fixes: 4bc123b18ce6 ("s390/zcrypt: Add low level functions for CCA AES cipher keys") Signed-off-by: Harald Freudenberger <freude@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/crypto/zcrypt_ccamisc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/s390/crypto/zcrypt_ccamisc.c b/drivers/s390/crypto/zcrypt_ccamisc.c
index 3b2d3705d2db..c1db64a2db21 100644
--- a/drivers/s390/crypto/zcrypt_ccamisc.c
+++ b/drivers/s390/crypto/zcrypt_ccamisc.c
@@ -838,7 +838,8 @@ int cca_gencipherkey(u16 cardnr, u16 domain, u32 keybitsize, u32 keygenflags,
/* patch the skeleton key token export flags inside the kb block */
if (keygenflags) {
t = (struct cipherkeytoken *) preqparm->kb.tlv3.gen_key_id_1;
- t->kmf1 |= (u16) (keygenflags & 0x0000FFFF);
+ t->kmf1 |= (u16) (keygenflags & 0x0000FF00);
+ t->kmf1 &= (u16) ~(keygenflags & 0x000000FF);
}
/* prepare xcrb struct */