aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/crypto/zcrypt_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/crypto/zcrypt_api.c')
-rw-r--r--drivers/s390/crypto/zcrypt_api.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c
index 41e0aaefafd5..8e65447f76b7 100644
--- a/drivers/s390/crypto/zcrypt_api.c
+++ b/drivers/s390/crypto/zcrypt_api.c
@@ -35,7 +35,6 @@
35#include <linux/proc_fs.h> 35#include <linux/proc_fs.h>
36#include <linux/seq_file.h> 36#include <linux/seq_file.h>
37#include <linux/compat.h> 37#include <linux/compat.h>
38#include <linux/smp_lock.h>
39#include <linux/slab.h> 38#include <linux/slab.h>
40#include <asm/atomic.h> 39#include <asm/atomic.h>
41#include <asm/uaccess.h> 40#include <asm/uaccess.h>
@@ -397,8 +396,15 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt)
397 if (copied == 0) { 396 if (copied == 0) {
398 unsigned int len; 397 unsigned int len;
399 spin_unlock_bh(&zcrypt_device_lock); 398 spin_unlock_bh(&zcrypt_device_lock);
400 /* len is max 256 / 2 - 120 = 8 */ 399 /* len is max 256 / 2 - 120 = 8
401 len = crt->inputdatalength / 2 - 120; 400 * For bigger device just assume len of leading
401 * 0s is 8 as stated in the requirements for
402 * ica_rsa_modexpo_crt struct in zcrypt.h.
403 */
404 if (crt->inputdatalength <= 256)
405 len = crt->inputdatalength / 2 - 120;
406 else
407 len = 8;
402 if (len > sizeof(z1)) 408 if (len > sizeof(z1))
403 return -EFAULT; 409 return -EFAULT;
404 z1 = z2 = z3 = 0; 410 z1 = z2 = z3 = 0;
@@ -406,6 +412,7 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt)
406 copy_from_user(&z2, crt->bp_key, len) || 412 copy_from_user(&z2, crt->bp_key, len) ||
407 copy_from_user(&z3, crt->u_mult_inv, len)) 413 copy_from_user(&z3, crt->u_mult_inv, len))
408 return -EFAULT; 414 return -EFAULT;
415 z1 = z2 = z3 = 0;
409 copied = 1; 416 copied = 1;
410 /* 417 /*
411 * We have to restart device lookup - 418 * We have to restart device lookup -
@@ -897,7 +904,8 @@ static const struct file_operations zcrypt_fops = {
897 .compat_ioctl = zcrypt_compat_ioctl, 904 .compat_ioctl = zcrypt_compat_ioctl,
898#endif 905#endif
899 .open = zcrypt_open, 906 .open = zcrypt_open,
900 .release = zcrypt_release 907 .release = zcrypt_release,
908 .llseek = no_llseek,
901}; 909};
902 910
903/* 911/*