summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Freudenberger <freude@linux.ibm.com>2026-03-18 19:41:33 +0300
committerVasily Gorbik <gor@linux.ibm.com>2026-03-24 23:00:42 +0300
commit2a0a1db5081df02d6753deb1826fd3932a1ab168 (patch)
treeebb5140c288f42c5aca1350877a14fdf79c2a91b
parent0e72b785b60e2a33f7bfe1c492f0717e7835b9a4 (diff)
downloadlinux-2a0a1db5081df02d6753deb1826fd3932a1ab168.tar.xz
s390/zcrypt: Slight rework on the agent_id field
The agent_id field is a two byte ascii field addressing the target agent on the crypto card. Some code however addresses this field as unsigned short. Rework these places to treat this field always as a two byte array. Unfortunately this field also shows up as __u16 in struct ica_xcRB as part of the zcrypt ioctl interface. Leave this untouched as it would break the API. There are two other places (func_id) where a byte array gets assigned with hex values but in fact these are ascii value. So replace these assignments with real ascii values for more readability. Signed-off-by: Harald Freudenberger <freude@linux.ibm.com> Acked-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
-rw-r--r--drivers/s390/crypto/zcrypt_ccamisc.c2
-rw-r--r--drivers/s390/crypto/zcrypt_msgtype6.c7
2 files changed, 4 insertions, 5 deletions
diff --git a/drivers/s390/crypto/zcrypt_ccamisc.c b/drivers/s390/crypto/zcrypt_ccamisc.c
index 3727e0df9827..135033f94c36 100644
--- a/drivers/s390/crypto/zcrypt_ccamisc.c
+++ b/drivers/s390/crypto/zcrypt_ccamisc.c
@@ -305,7 +305,7 @@ static inline void prep_xcrb(struct ica_xcRB *pxcrb,
struct CPRBX *prepcblk)
{
memset(pxcrb, 0, sizeof(*pxcrb));
- pxcrb->agent_ID = 0x4341; /* 'CA' */
+ memcpy(&pxcrb->agent_ID, "CA", 2);
pxcrb->user_defined = (cardnr == 0xFFFF ? AUTOSELECT : cardnr);
pxcrb->request_control_blk_length =
preqcblk->cprb_len + preqcblk->req_parml;
diff --git a/drivers/s390/crypto/zcrypt_msgtype6.c b/drivers/s390/crypto/zcrypt_msgtype6.c
index 02648d0e8380..bab8860417de 100644
--- a/drivers/s390/crypto/zcrypt_msgtype6.c
+++ b/drivers/s390/crypto/zcrypt_msgtype6.c
@@ -65,7 +65,7 @@ struct function_and_rules_block {
static const struct CPRBX static_cprbx = {
.cprb_len = 0x00DC,
.cprb_ver_id = 0x02,
- .func_id = {0x54, 0x32},
+ .func_id = {'T', '2'},
};
int speed_idx_cca(int req_type)
@@ -455,8 +455,7 @@ static int xcrb_msg_to_type6_ep11cprb_msgx(bool userspace, struct ap_message *ap
.type = 0x06,
.rqid = {0x00, 0x01},
.function_code = {0x00, 0x00},
- .agent_id[0] = 0x58, /* {'X'} */
- .agent_id[1] = 0x43, /* {'C'} */
+ .agent_id = {'X', 'C'},
.offset1 = 0x00000058,
};
@@ -1285,7 +1284,7 @@ static inline void rng_type6cprb_msgx(struct ap_message *ap_msg,
static struct CPRBX local_cprbx = {
.cprb_len = 0x00dc,
.cprb_ver_id = 0x02,
- .func_id = {0x54, 0x32},
+ .func_id = {'T', '2'},
.req_parml = sizeof(*msg) - sizeof(msg->hdr) -
sizeof(msg->cprbx),
.rpl_msgbl = sizeof(*msg) - sizeof(msg->hdr),