diff options
author | Felix Beck <felix.beck@de.ibm.com> | 2011-01-05 06:47:48 -0500 |
---|---|---|
committer | Martin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com> | 2011-01-05 06:47:27 -0500 |
commit | 078f8ecaa30718694d1e13d9f415b7ce75b3c968 (patch) | |
tree | 3cbb3ac8af8db120fdecdf8e2f35c2ae6c5f1a86 /drivers/s390/crypto | |
parent | c2567f8ffa2704f6f2f81013e9a590deca5a865f (diff) |
[S390] Handling of 4096 bit RSA keys in CRT format.
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>
Diffstat (limited to 'drivers/s390/crypto')
-rw-r--r-- | drivers/s390/crypto/zcrypt_api.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c index 7fca9c10ffcf..8e65447f76b7 100644 --- a/drivers/s390/crypto/zcrypt_api.c +++ b/drivers/s390/crypto/zcrypt_api.c | |||
@@ -396,8 +396,15 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt) | |||
396 | if (copied == 0) { | 396 | if (copied == 0) { |
397 | unsigned int len; | 397 | unsigned int len; |
398 | spin_unlock_bh(&zcrypt_device_lock); | 398 | spin_unlock_bh(&zcrypt_device_lock); |
399 | /* len is max 256 / 2 - 120 = 8 */ | 399 | /* len is max 256 / 2 - 120 = 8 |
400 | 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; | ||
401 | if (len > sizeof(z1)) | 408 | if (len > sizeof(z1)) |
402 | return -EFAULT; | 409 | return -EFAULT; |
403 | z1 = z2 = z3 = 0; | 410 | z1 = z2 = z3 = 0; |
@@ -405,6 +412,7 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt) | |||
405 | copy_from_user(&z2, crt->bp_key, len) || | 412 | copy_from_user(&z2, crt->bp_key, len) || |
406 | copy_from_user(&z3, crt->u_mult_inv, len)) | 413 | copy_from_user(&z3, crt->u_mult_inv, len)) |
407 | return -EFAULT; | 414 | return -EFAULT; |
415 | z1 = z2 = z3 = 0; | ||
408 | copied = 1; | 416 | copied = 1; |
409 | /* | 417 | /* |
410 | * We have to restart device lookup - | 418 | * We have to restart device lookup - |