Skip to content

Commit b9352e4

Browse files
holger-denglerhcahca
authored andcommitted
s390/pkey: fix PKEY_TYPE_EP11_AES handling for sysfs attributes
Commit 'fa6999e326fe ("s390/pkey: support CCA and EP11 secure ECC private keys")' introduced a new PKEY_TYPE_EP11_AES securekey type as a supplement to the existing PKEY_TYPE_EP11 (which won't work in environments with session-bound keys). The pkey EP11 securekey attributes use PKEY_TYPE_EP11_AES (instead of PKEY_TYPE_EP11) keyblobs, to make the generated keyblobs usable also in environments, where session-bound keys are required. There should be no negative impacts to userspace because the internal structure of the keyblobs is opaque. The increased size of the generated keyblobs is reflected by the changed size of the attributes. Fixes: fa6999e ("s390/pkey: support CCA and EP11 secure ECC private keys") Signed-off-by: Holger Dengler <[email protected]> Reviewed-by: Ingo Franzki <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent 745742d commit b9352e4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

arch/s390/include/uapi/asm/pkey.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#define MAXCLRKEYSIZE 32 /* a clear key value may be up to 32 bytes */
2727
#define MAXAESCIPHERKEYSIZE 136 /* our aes cipher keys have always 136 bytes */
2828
#define MINEP11AESKEYBLOBSIZE 256 /* min EP11 AES key blob size */
29-
#define MAXEP11AESKEYBLOBSIZE 320 /* max EP11 AES key blob size */
29+
#define MAXEP11AESKEYBLOBSIZE 336 /* max EP11 AES key blob size */
3030

3131
/* Minimum size of a key blob */
3232
#define MINKEYBLOBSIZE SECKEYBLOBSIZE

drivers/s390/crypto/pkey_api.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,7 +2142,7 @@ static struct attribute_group ccacipher_attr_group = {
21422142
* (i.e. off != 0 or count < key blob size) -EINVAL is returned.
21432143
* This function and the sysfs attributes using it provide EP11 key blobs
21442144
* padded to the upper limit of MAXEP11AESKEYBLOBSIZE which is currently
2145-
* 320 bytes.
2145+
* 336 bytes.
21462146
*/
21472147
static ssize_t pkey_ep11_aes_attr_read(enum pkey_key_size keybits,
21482148
bool is_xts, char *buf, loff_t off,
@@ -2171,7 +2171,7 @@ static ssize_t pkey_ep11_aes_attr_read(enum pkey_key_size keybits,
21712171
card = apqns[i] >> 16;
21722172
dom = apqns[i] & 0xFFFF;
21732173
rc = ep11_genaeskey(card, dom, keybits, 0, buf, &keysize,
2174-
PKEY_TYPE_EP11);
2174+
PKEY_TYPE_EP11_AES);
21752175
if (rc == 0)
21762176
break;
21772177
}
@@ -2182,7 +2182,7 @@ static ssize_t pkey_ep11_aes_attr_read(enum pkey_key_size keybits,
21822182
keysize = MAXEP11AESKEYBLOBSIZE;
21832183
buf += MAXEP11AESKEYBLOBSIZE;
21842184
rc = ep11_genaeskey(card, dom, keybits, 0, buf, &keysize,
2185-
PKEY_TYPE_EP11);
2185+
PKEY_TYPE_EP11_AES);
21862186
if (rc == 0)
21872187
return 2 * MAXEP11AESKEYBLOBSIZE;
21882188
}

0 commit comments

Comments
 (0)