s390/zcrypt: ep11 structs rework, export zcrypt_send_ep11_cprb

Minor rework for struct ep11_cprb and struct ep11_urb. Use of u8, u16,
u32 instead of unsigned char. Declare pointers to mem from userspace
with __user to give sparse a chance to check.

Export zcrypt_send_ep11_cprb() function as this function will be
called by code in progress which will build ep11 cprbs within the
zcrypt device driver zoo and send them to EP11 crypto cards.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
Harald Freudenberger
2019-08-30 15:57:17 +02:00
committed by Vasily Gorbik
parent 8f291ebf32
commit a7367997ab
3 changed files with 25 additions and 18 deletions

View File

@@ -923,8 +923,8 @@ static bool is_desired_ep11_queue(unsigned int dev_qid,
return false;
}
static long zcrypt_send_ep11_cprb(struct ap_perms *perms,
struct ep11_urb *xcrb)
static long _zcrypt_send_ep11_cprb(struct ap_perms *perms,
struct ep11_urb *xcrb)
{
struct zcrypt_card *zc, *pref_zc;
struct zcrypt_queue *zq, *pref_zq;
@@ -1029,6 +1029,12 @@ out:
return rc;
}
long zcrypt_send_ep11_cprb(struct ep11_urb *xcrb)
{
return _zcrypt_send_ep11_cprb(&ap_perms, xcrb);
}
EXPORT_SYMBOL(zcrypt_send_ep11_cprb);
static long zcrypt_rng(char *buffer)
{
struct zcrypt_card *zc, *pref_zc;
@@ -1369,12 +1375,12 @@ static long zcrypt_unlocked_ioctl(struct file *filp, unsigned int cmd,
if (copy_from_user(&xcrb, uxcrb, sizeof(xcrb)))
return -EFAULT;
do {
rc = zcrypt_send_ep11_cprb(perms, &xcrb);
rc = _zcrypt_send_ep11_cprb(perms, &xcrb);
} while (rc == -EAGAIN);
/* on failure: retry once again after a requested rescan */
if ((rc == -ENODEV) && (zcrypt_process_rescan()))
do {
rc = zcrypt_send_ep11_cprb(perms, &xcrb);
rc = _zcrypt_send_ep11_cprb(perms, &xcrb);
} while (rc == -EAGAIN);
if (rc)
ZCRYPT_DBF(DBF_DEBUG, "ioctl ZSENDEP11CPRB rc=%d\n", rc);