FAILED: patch "[PATCH] s390/pkey: fix PKEY_TYPE_EP11_AES handling in PKEY_CLR2SECK2" failed to apply to 6.5-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.5-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.5.y
git checkout FETCH_HEAD
git cherry-pick -x da2863f15945de100b95c72d5656541d30956c5d
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023091026-dose-avert-d89f@gregkh' --subject-prefix 'PATCH 6.5.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From da2863f15945de100b95c72d5656541d30956c5d Mon Sep 17 00:00:00 2001
From: Holger Dengler <[email protected]>
Date: Tue, 25 Jul 2023 11:24:47 +0200
Subject: [PATCH] s390/pkey: fix PKEY_TYPE_EP11_AES handling in PKEY_CLR2SECK2
IOCTL
Commit 'fa6999e326fe ("s390/pkey: support CCA and EP11 secure ECC private keys")' introduced PKEY_TYPE_EP11_AES for the PKEY_CLR2SECK2 IOCTL to convert an AES clearkey into a securekey of this type. Unfortunately, all PKEY_CLR2SECK2 IOCTL requests with type PKEY_TYPE_EP11_AES return with an error (-EINVAL). Fix the handling for PKEY_TYPE_EP11_AES in PKEY_CLR2SECK2 IOCTL, so that userspace can convert clearkey blobs into PKEY_TYPE_EP11_AES securekey blobs.
drivers/s390/crypto/pkey_api.c +12 -4
@@ -272,7 +272,8 @@ static int pkey_clr2ep11key(const u8 *clrkey, size_t clrkeylen, card = apqns[i] >>16 ; dom = apqns[i] &0xFFFF ; rc =ep11_clr2keyblob (card, dom, clrkeylen *8 , -0 , clrkey, keybuf, keybuflen); +0 , clrkey, keybuf, keybuflen, +PKEY_TYPE_EP11 );if (rc ==0 )break ; }
@@ -775,6 +776,11 @@ static int pkey_clr2seckey2(const struct pkey_apqn *apqns, size_t nr_apqns,if (*keybufsize <MINEP11AESKEYBLOBSIZE )return -EINVAL ;break ; +case PKEY_TYPE_EP11_AES : +if (*keybufsize < (sizeof (struct ep11kblob_header ) + +MINEP11AESKEYBLOBSIZE )) +return -EINVAL ; +break ;default :return -EINVAL ; }
@@ -793,9 +799,11 @@ static int pkey_clr2seckey2(const struct pkey_apqn *apqns, size_t nr_apqns,for (i =0 , rc = -ENODEV ; i < nr_apqns; i++) { card = apqns[i].card; dom = apqns[i].domain; -if (ktype ==PKEY_TYPE_EP11 ) { +if (ktype ==PKEY_TYPE_EP11 || + ktype ==PKEY_TYPE_EP11_AES ) { rc =ep11_clr2keyblob (card, dom, ksize, kflags, - clrkey, keybuf, keybufsize); + clrkey, keybuf, keybufsize, + ktype); }else if (ktype ==PKEY_TYPE_CCA_DATA ) { rc =cca_clr2seckey (card, dom, ksize, clrkey, keybuf);
@@ -1514,7 +1522,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd, apqns =_copy_apqns_from_user (kcs.apqns, kcs.apqn_entries);if (IS_ERR (apqns))return PTR_ERR (apqns); - kkey =kmalloc (klen,GFP_KERNEL ); + kkey =kzalloc (klen,GFP_KERNEL );if (!kkey) {kfree (apqns);return -ENOMEM ;
drivers/s390/crypto/zcrypt_ep11misc.c +46 -15
99 lines not on this page · raw message
drivers/s390/crypto/zcrypt_ep11misc.h +2 -1
@@ -113,7 +113,8 @@ int ep11_genaeskey(u16 card, u16 domain, u32 keybitsize, u32 keygenflags,* Generate EP11 AES secure key with given clear key value. */ int ep11_clr2keyblob (u16 cardnr,u16 domain,u32 keybitsize,u32 keygenflags, -const u8 *clrkey,u8 *keybuf,size_t *keybufsize); +const u8 *clrkey,u8 *keybuf,size_t *keybufsize, +u32 keytype);/* * Build a list of ep11 apqns meeting the following constrains: