Skip to content

Commit

Permalink
[S390] Handling of 4096 bit RSA keys in CRT format.
Browse files Browse the repository at this point in the history
Also process 4096 bit RSA keys in CRT format. Handle them like the
smaller keys and take care of the zero padding.

Signed-off-by: Felix Beck <felix.beck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Felix Beck authored and Martin Schwidefsky committed Jan 5, 2011
1 parent c2567f8 commit 078f8ec
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions drivers/s390/crypto/zcrypt_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,15 +396,23 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt)
if (copied == 0) {
unsigned int len;
spin_unlock_bh(&zcrypt_device_lock);
/* len is max 256 / 2 - 120 = 8 */
len = crt->inputdatalength / 2 - 120;
/* len is max 256 / 2 - 120 = 8
* For bigger device just assume len of leading
* 0s is 8 as stated in the requirements for
* ica_rsa_modexpo_crt struct in zcrypt.h.
*/
if (crt->inputdatalength <= 256)
len = crt->inputdatalength / 2 - 120;
else
len = 8;
if (len > sizeof(z1))
return -EFAULT;
z1 = z2 = z3 = 0;
if (copy_from_user(&z1, crt->np_prime, len) ||
copy_from_user(&z2, crt->bp_key, len) ||
copy_from_user(&z3, crt->u_mult_inv, len))
return -EFAULT;
z1 = z2 = z3 = 0;
copied = 1;
/*
* We have to restart device lookup -
Expand Down

0 comments on commit 078f8ec

Please sign in to comment.