diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/s390/crypto | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'arch/s390/crypto')
-rw-r--r-- | arch/s390/crypto/aes_s390.c | 25 | ||||
-rw-r--r-- | arch/s390/crypto/crypt_s390.h | 10 | ||||
-rw-r--r-- | arch/s390/crypto/des_s390.c | 24 | ||||
-rw-r--r-- | arch/s390/crypto/ghash_s390.c | 22 | ||||
-rw-r--r-- | arch/s390/crypto/prng.c | 2 | ||||
-rw-r--r-- | arch/s390/crypto/sha1_s390.c | 2 | ||||
-rw-r--r-- | arch/s390/crypto/sha256_s390.c | 2 | ||||
-rw-r--r-- | arch/s390/crypto/sha_common.c | 10 |
8 files changed, 45 insertions, 52 deletions
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c index b4dbade8ca2..a9ce135893f 100644 --- a/arch/s390/crypto/aes_s390.c +++ b/arch/s390/crypto/aes_s390.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * s390 implementation of the AES Cipher Algorithm. | 4 | * s390 implementation of the AES Cipher Algorithm. |
5 | * | 5 | * |
6 | * s390 Version: | 6 | * s390 Version: |
7 | * Copyright IBM Corp. 2005, 2007 | 7 | * Copyright IBM Corp. 2005,2007 |
8 | * Author(s): Jan Glauber (jang@de.ibm.com) | 8 | * Author(s): Jan Glauber (jang@de.ibm.com) |
9 | * Sebastian Siewior (sebastian@breakpoint.cc> SW-Fallback | 9 | * Sebastian Siewior (sebastian@breakpoint.cc> SW-Fallback |
10 | * | 10 | * |
@@ -216,6 +216,7 @@ static struct crypto_alg aes_alg = { | |||
216 | .cra_blocksize = AES_BLOCK_SIZE, | 216 | .cra_blocksize = AES_BLOCK_SIZE, |
217 | .cra_ctxsize = sizeof(struct s390_aes_ctx), | 217 | .cra_ctxsize = sizeof(struct s390_aes_ctx), |
218 | .cra_module = THIS_MODULE, | 218 | .cra_module = THIS_MODULE, |
219 | .cra_list = LIST_HEAD_INIT(aes_alg.cra_list), | ||
219 | .cra_init = fallback_init_cip, | 220 | .cra_init = fallback_init_cip, |
220 | .cra_exit = fallback_exit_cip, | 221 | .cra_exit = fallback_exit_cip, |
221 | .cra_u = { | 222 | .cra_u = { |
@@ -325,8 +326,7 @@ static int ecb_aes_crypt(struct blkcipher_desc *desc, long func, void *param, | |||
325 | u8 *in = walk->src.virt.addr; | 326 | u8 *in = walk->src.virt.addr; |
326 | 327 | ||
327 | ret = crypt_s390_km(func, param, out, in, n); | 328 | ret = crypt_s390_km(func, param, out, in, n); |
328 | if (ret < 0 || ret != n) | 329 | BUG_ON((ret < 0) || (ret != n)); |
329 | return -EIO; | ||
330 | 330 | ||
331 | nbytes &= AES_BLOCK_SIZE - 1; | 331 | nbytes &= AES_BLOCK_SIZE - 1; |
332 | ret = blkcipher_walk_done(desc, walk, nbytes); | 332 | ret = blkcipher_walk_done(desc, walk, nbytes); |
@@ -398,6 +398,7 @@ static struct crypto_alg ecb_aes_alg = { | |||
398 | .cra_ctxsize = sizeof(struct s390_aes_ctx), | 398 | .cra_ctxsize = sizeof(struct s390_aes_ctx), |
399 | .cra_type = &crypto_blkcipher_type, | 399 | .cra_type = &crypto_blkcipher_type, |
400 | .cra_module = THIS_MODULE, | 400 | .cra_module = THIS_MODULE, |
401 | .cra_list = LIST_HEAD_INIT(ecb_aes_alg.cra_list), | ||
401 | .cra_init = fallback_init_blk, | 402 | .cra_init = fallback_init_blk, |
402 | .cra_exit = fallback_exit_blk, | 403 | .cra_exit = fallback_exit_blk, |
403 | .cra_u = { | 404 | .cra_u = { |
@@ -458,8 +459,7 @@ static int cbc_aes_crypt(struct blkcipher_desc *desc, long func, void *param, | |||
458 | u8 *in = walk->src.virt.addr; | 459 | u8 *in = walk->src.virt.addr; |
459 | 460 | ||
460 | ret = crypt_s390_kmc(func, param, out, in, n); | 461 | ret = crypt_s390_kmc(func, param, out, in, n); |
461 | if (ret < 0 || ret != n) | 462 | BUG_ON((ret < 0) || (ret != n)); |
462 | return -EIO; | ||
463 | 463 | ||
464 | nbytes &= AES_BLOCK_SIZE - 1; | 464 | nbytes &= AES_BLOCK_SIZE - 1; |
465 | ret = blkcipher_walk_done(desc, walk, nbytes); | 465 | ret = blkcipher_walk_done(desc, walk, nbytes); |
@@ -508,6 +508,7 @@ static struct crypto_alg cbc_aes_alg = { | |||
508 | .cra_ctxsize = sizeof(struct s390_aes_ctx), | 508 | .cra_ctxsize = sizeof(struct s390_aes_ctx), |
509 | .cra_type = &crypto_blkcipher_type, | 509 | .cra_type = &crypto_blkcipher_type, |
510 | .cra_module = THIS_MODULE, | 510 | .cra_module = THIS_MODULE, |
511 | .cra_list = LIST_HEAD_INIT(cbc_aes_alg.cra_list), | ||
511 | .cra_init = fallback_init_blk, | 512 | .cra_init = fallback_init_blk, |
512 | .cra_exit = fallback_exit_blk, | 513 | .cra_exit = fallback_exit_blk, |
513 | .cra_u = { | 514 | .cra_u = { |
@@ -627,8 +628,7 @@ static int xts_aes_crypt(struct blkcipher_desc *desc, long func, | |||
627 | memcpy(xts_ctx->pcc.tweak, walk->iv, sizeof(xts_ctx->pcc.tweak)); | 628 | memcpy(xts_ctx->pcc.tweak, walk->iv, sizeof(xts_ctx->pcc.tweak)); |
628 | param = xts_ctx->pcc.key + offset; | 629 | param = xts_ctx->pcc.key + offset; |
629 | ret = crypt_s390_pcc(func, param); | 630 | ret = crypt_s390_pcc(func, param); |
630 | if (ret < 0) | 631 | BUG_ON(ret < 0); |
631 | return -EIO; | ||
632 | 632 | ||
633 | memcpy(xts_ctx->xts_param, xts_ctx->pcc.xts, 16); | 633 | memcpy(xts_ctx->xts_param, xts_ctx->pcc.xts, 16); |
634 | param = xts_ctx->key + offset; | 634 | param = xts_ctx->key + offset; |
@@ -639,8 +639,7 @@ static int xts_aes_crypt(struct blkcipher_desc *desc, long func, | |||
639 | in = walk->src.virt.addr; | 639 | in = walk->src.virt.addr; |
640 | 640 | ||
641 | ret = crypt_s390_km(func, param, out, in, n); | 641 | ret = crypt_s390_km(func, param, out, in, n); |
642 | if (ret < 0 || ret != n) | 642 | BUG_ON(ret < 0 || ret != n); |
643 | return -EIO; | ||
644 | 643 | ||
645 | nbytes &= AES_BLOCK_SIZE - 1; | 644 | nbytes &= AES_BLOCK_SIZE - 1; |
646 | ret = blkcipher_walk_done(desc, walk, nbytes); | 645 | ret = blkcipher_walk_done(desc, walk, nbytes); |
@@ -711,6 +710,7 @@ static struct crypto_alg xts_aes_alg = { | |||
711 | .cra_ctxsize = sizeof(struct s390_xts_ctx), | 710 | .cra_ctxsize = sizeof(struct s390_xts_ctx), |
712 | .cra_type = &crypto_blkcipher_type, | 711 | .cra_type = &crypto_blkcipher_type, |
713 | .cra_module = THIS_MODULE, | 712 | .cra_module = THIS_MODULE, |
713 | .cra_list = LIST_HEAD_INIT(xts_aes_alg.cra_list), | ||
714 | .cra_init = xts_fallback_init, | 714 | .cra_init = xts_fallback_init, |
715 | .cra_exit = xts_fallback_exit, | 715 | .cra_exit = xts_fallback_exit, |
716 | .cra_u = { | 716 | .cra_u = { |
@@ -773,8 +773,7 @@ static int ctr_aes_crypt(struct blkcipher_desc *desc, long func, | |||
773 | crypto_inc(ctrblk + i, AES_BLOCK_SIZE); | 773 | crypto_inc(ctrblk + i, AES_BLOCK_SIZE); |
774 | } | 774 | } |
775 | ret = crypt_s390_kmctr(func, sctx->key, out, in, n, ctrblk); | 775 | ret = crypt_s390_kmctr(func, sctx->key, out, in, n, ctrblk); |
776 | if (ret < 0 || ret != n) | 776 | BUG_ON(ret < 0 || ret != n); |
777 | return -EIO; | ||
778 | if (n > AES_BLOCK_SIZE) | 777 | if (n > AES_BLOCK_SIZE) |
779 | memcpy(ctrblk, ctrblk + n - AES_BLOCK_SIZE, | 778 | memcpy(ctrblk, ctrblk + n - AES_BLOCK_SIZE, |
780 | AES_BLOCK_SIZE); | 779 | AES_BLOCK_SIZE); |
@@ -793,8 +792,7 @@ static int ctr_aes_crypt(struct blkcipher_desc *desc, long func, | |||
793 | in = walk->src.virt.addr; | 792 | in = walk->src.virt.addr; |
794 | ret = crypt_s390_kmctr(func, sctx->key, buf, in, | 793 | ret = crypt_s390_kmctr(func, sctx->key, buf, in, |
795 | AES_BLOCK_SIZE, ctrblk); | 794 | AES_BLOCK_SIZE, ctrblk); |
796 | if (ret < 0 || ret != AES_BLOCK_SIZE) | 795 | BUG_ON(ret < 0 || ret != AES_BLOCK_SIZE); |
797 | return -EIO; | ||
798 | memcpy(out, buf, nbytes); | 796 | memcpy(out, buf, nbytes); |
799 | crypto_inc(ctrblk, AES_BLOCK_SIZE); | 797 | crypto_inc(ctrblk, AES_BLOCK_SIZE); |
800 | ret = blkcipher_walk_done(desc, walk, 0); | 798 | ret = blkcipher_walk_done(desc, walk, 0); |
@@ -834,6 +832,7 @@ static struct crypto_alg ctr_aes_alg = { | |||
834 | .cra_ctxsize = sizeof(struct s390_aes_ctx), | 832 | .cra_ctxsize = sizeof(struct s390_aes_ctx), |
835 | .cra_type = &crypto_blkcipher_type, | 833 | .cra_type = &crypto_blkcipher_type, |
836 | .cra_module = THIS_MODULE, | 834 | .cra_module = THIS_MODULE, |
835 | .cra_list = LIST_HEAD_INIT(ctr_aes_alg.cra_list), | ||
837 | .cra_u = { | 836 | .cra_u = { |
838 | .blkcipher = { | 837 | .blkcipher = { |
839 | .min_keysize = AES_MIN_KEY_SIZE, | 838 | .min_keysize = AES_MIN_KEY_SIZE, |
diff --git a/arch/s390/crypto/crypt_s390.h b/arch/s390/crypto/crypt_s390.h index 6c5cc6da711..49676771bd6 100644 --- a/arch/s390/crypto/crypt_s390.h +++ b/arch/s390/crypto/crypt_s390.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Support for s390 cryptographic instructions. | 4 | * Support for s390 cryptographic instructions. |
5 | * | 5 | * |
6 | * Copyright IBM Corp. 2003, 2007 | 6 | * Copyright IBM Corp. 2003,2007 |
7 | * Author(s): Thomas Spatzier | 7 | * Author(s): Thomas Spatzier |
8 | * Jan Glauber (jan.glauber@de.ibm.com) | 8 | * Jan Glauber (jan.glauber@de.ibm.com) |
9 | * | 9 | * |
@@ -17,7 +17,6 @@ | |||
17 | #define _CRYPTO_ARCH_S390_CRYPT_S390_H | 17 | #define _CRYPTO_ARCH_S390_CRYPT_S390_H |
18 | 18 | ||
19 | #include <asm/errno.h> | 19 | #include <asm/errno.h> |
20 | #include <asm/facility.h> | ||
21 | 20 | ||
22 | #define CRYPT_S390_OP_MASK 0xFF00 | 21 | #define CRYPT_S390_OP_MASK 0xFF00 |
23 | #define CRYPT_S390_FUNC_MASK 0x00FF | 22 | #define CRYPT_S390_FUNC_MASK 0x00FF |
@@ -369,12 +368,9 @@ static inline int crypt_s390_func_available(int func, | |||
369 | 368 | ||
370 | if (facility_mask & CRYPT_S390_MSA && !test_facility(17)) | 369 | if (facility_mask & CRYPT_S390_MSA && !test_facility(17)) |
371 | return 0; | 370 | return 0; |
372 | 371 | if (facility_mask & CRYPT_S390_MSA3 && !test_facility(76)) | |
373 | if (facility_mask & CRYPT_S390_MSA3 && | ||
374 | (!test_facility(2) || !test_facility(76))) | ||
375 | return 0; | 372 | return 0; |
376 | if (facility_mask & CRYPT_S390_MSA4 && | 373 | if (facility_mask & CRYPT_S390_MSA4 && !test_facility(77)) |
377 | (!test_facility(2) || !test_facility(77))) | ||
378 | return 0; | 374 | return 0; |
379 | 375 | ||
380 | switch (func & CRYPT_S390_OP_MASK) { | 376 | switch (func & CRYPT_S390_OP_MASK) { |
diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c index bcca01c9989..a52bfd124d8 100644 --- a/arch/s390/crypto/des_s390.c +++ b/arch/s390/crypto/des_s390.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * s390 implementation of the DES Cipher Algorithm. | 4 | * s390 implementation of the DES Cipher Algorithm. |
5 | * | 5 | * |
6 | * Copyright IBM Corp. 2003, 2011 | 6 | * Copyright IBM Corp. 2003,2011 |
7 | * Author(s): Thomas Spatzier | 7 | * Author(s): Thomas Spatzier |
8 | * Jan Glauber (jan.glauber@de.ibm.com) | 8 | * Jan Glauber (jan.glauber@de.ibm.com) |
9 | * | 9 | * |
@@ -70,6 +70,7 @@ static struct crypto_alg des_alg = { | |||
70 | .cra_blocksize = DES_BLOCK_SIZE, | 70 | .cra_blocksize = DES_BLOCK_SIZE, |
71 | .cra_ctxsize = sizeof(struct s390_des_ctx), | 71 | .cra_ctxsize = sizeof(struct s390_des_ctx), |
72 | .cra_module = THIS_MODULE, | 72 | .cra_module = THIS_MODULE, |
73 | .cra_list = LIST_HEAD_INIT(des_alg.cra_list), | ||
73 | .cra_u = { | 74 | .cra_u = { |
74 | .cipher = { | 75 | .cipher = { |
75 | .cia_min_keysize = DES_KEY_SIZE, | 76 | .cia_min_keysize = DES_KEY_SIZE, |
@@ -94,8 +95,7 @@ static int ecb_desall_crypt(struct blkcipher_desc *desc, long func, | |||
94 | u8 *in = walk->src.virt.addr; | 95 | u8 *in = walk->src.virt.addr; |
95 | 96 | ||
96 | ret = crypt_s390_km(func, key, out, in, n); | 97 | ret = crypt_s390_km(func, key, out, in, n); |
97 | if (ret < 0 || ret != n) | 98 | BUG_ON((ret < 0) || (ret != n)); |
98 | return -EIO; | ||
99 | 99 | ||
100 | nbytes &= DES_BLOCK_SIZE - 1; | 100 | nbytes &= DES_BLOCK_SIZE - 1; |
101 | ret = blkcipher_walk_done(desc, walk, nbytes); | 101 | ret = blkcipher_walk_done(desc, walk, nbytes); |
@@ -121,8 +121,7 @@ static int cbc_desall_crypt(struct blkcipher_desc *desc, long func, | |||
121 | u8 *in = walk->src.virt.addr; | 121 | u8 *in = walk->src.virt.addr; |
122 | 122 | ||
123 | ret = crypt_s390_kmc(func, iv, out, in, n); | 123 | ret = crypt_s390_kmc(func, iv, out, in, n); |
124 | if (ret < 0 || ret != n) | 124 | BUG_ON((ret < 0) || (ret != n)); |
125 | return -EIO; | ||
126 | 125 | ||
127 | nbytes &= DES_BLOCK_SIZE - 1; | 126 | nbytes &= DES_BLOCK_SIZE - 1; |
128 | ret = blkcipher_walk_done(desc, walk, nbytes); | 127 | ret = blkcipher_walk_done(desc, walk, nbytes); |
@@ -164,6 +163,7 @@ static struct crypto_alg ecb_des_alg = { | |||
164 | .cra_ctxsize = sizeof(struct s390_des_ctx), | 163 | .cra_ctxsize = sizeof(struct s390_des_ctx), |
165 | .cra_type = &crypto_blkcipher_type, | 164 | .cra_type = &crypto_blkcipher_type, |
166 | .cra_module = THIS_MODULE, | 165 | .cra_module = THIS_MODULE, |
166 | .cra_list = LIST_HEAD_INIT(ecb_des_alg.cra_list), | ||
167 | .cra_u = { | 167 | .cra_u = { |
168 | .blkcipher = { | 168 | .blkcipher = { |
169 | .min_keysize = DES_KEY_SIZE, | 169 | .min_keysize = DES_KEY_SIZE, |
@@ -206,6 +206,7 @@ static struct crypto_alg cbc_des_alg = { | |||
206 | .cra_ctxsize = sizeof(struct s390_des_ctx), | 206 | .cra_ctxsize = sizeof(struct s390_des_ctx), |
207 | .cra_type = &crypto_blkcipher_type, | 207 | .cra_type = &crypto_blkcipher_type, |
208 | .cra_module = THIS_MODULE, | 208 | .cra_module = THIS_MODULE, |
209 | .cra_list = LIST_HEAD_INIT(cbc_des_alg.cra_list), | ||
209 | .cra_u = { | 210 | .cra_u = { |
210 | .blkcipher = { | 211 | .blkcipher = { |
211 | .min_keysize = DES_KEY_SIZE, | 212 | .min_keysize = DES_KEY_SIZE, |
@@ -270,6 +271,7 @@ static struct crypto_alg des3_alg = { | |||
270 | .cra_blocksize = DES_BLOCK_SIZE, | 271 | .cra_blocksize = DES_BLOCK_SIZE, |
271 | .cra_ctxsize = sizeof(struct s390_des_ctx), | 272 | .cra_ctxsize = sizeof(struct s390_des_ctx), |
272 | .cra_module = THIS_MODULE, | 273 | .cra_module = THIS_MODULE, |
274 | .cra_list = LIST_HEAD_INIT(des3_alg.cra_list), | ||
273 | .cra_u = { | 275 | .cra_u = { |
274 | .cipher = { | 276 | .cipher = { |
275 | .cia_min_keysize = DES3_KEY_SIZE, | 277 | .cia_min_keysize = DES3_KEY_SIZE, |
@@ -312,6 +314,8 @@ static struct crypto_alg ecb_des3_alg = { | |||
312 | .cra_ctxsize = sizeof(struct s390_des_ctx), | 314 | .cra_ctxsize = sizeof(struct s390_des_ctx), |
313 | .cra_type = &crypto_blkcipher_type, | 315 | .cra_type = &crypto_blkcipher_type, |
314 | .cra_module = THIS_MODULE, | 316 | .cra_module = THIS_MODULE, |
317 | .cra_list = LIST_HEAD_INIT( | ||
318 | ecb_des3_alg.cra_list), | ||
315 | .cra_u = { | 319 | .cra_u = { |
316 | .blkcipher = { | 320 | .blkcipher = { |
317 | .min_keysize = DES3_KEY_SIZE, | 321 | .min_keysize = DES3_KEY_SIZE, |
@@ -354,6 +358,8 @@ static struct crypto_alg cbc_des3_alg = { | |||
354 | .cra_ctxsize = sizeof(struct s390_des_ctx), | 358 | .cra_ctxsize = sizeof(struct s390_des_ctx), |
355 | .cra_type = &crypto_blkcipher_type, | 359 | .cra_type = &crypto_blkcipher_type, |
356 | .cra_module = THIS_MODULE, | 360 | .cra_module = THIS_MODULE, |
361 | .cra_list = LIST_HEAD_INIT( | ||
362 | cbc_des3_alg.cra_list), | ||
357 | .cra_u = { | 363 | .cra_u = { |
358 | .blkcipher = { | 364 | .blkcipher = { |
359 | .min_keysize = DES3_KEY_SIZE, | 365 | .min_keysize = DES3_KEY_SIZE, |
@@ -388,8 +394,7 @@ static int ctr_desall_crypt(struct blkcipher_desc *desc, long func, | |||
388 | crypto_inc(ctrblk + i, DES_BLOCK_SIZE); | 394 | crypto_inc(ctrblk + i, DES_BLOCK_SIZE); |
389 | } | 395 | } |
390 | ret = crypt_s390_kmctr(func, ctx->key, out, in, n, ctrblk); | 396 | ret = crypt_s390_kmctr(func, ctx->key, out, in, n, ctrblk); |
391 | if (ret < 0 || ret != n) | 397 | BUG_ON((ret < 0) || (ret != n)); |
392 | return -EIO; | ||
393 | if (n > DES_BLOCK_SIZE) | 398 | if (n > DES_BLOCK_SIZE) |
394 | memcpy(ctrblk, ctrblk + n - DES_BLOCK_SIZE, | 399 | memcpy(ctrblk, ctrblk + n - DES_BLOCK_SIZE, |
395 | DES_BLOCK_SIZE); | 400 | DES_BLOCK_SIZE); |
@@ -407,8 +412,7 @@ static int ctr_desall_crypt(struct blkcipher_desc *desc, long func, | |||
407 | in = walk->src.virt.addr; | 412 | in = walk->src.virt.addr; |
408 | ret = crypt_s390_kmctr(func, ctx->key, buf, in, | 413 | ret = crypt_s390_kmctr(func, ctx->key, buf, in, |
409 | DES_BLOCK_SIZE, ctrblk); | 414 | DES_BLOCK_SIZE, ctrblk); |
410 | if (ret < 0 || ret != DES_BLOCK_SIZE) | 415 | BUG_ON(ret < 0 || ret != DES_BLOCK_SIZE); |
411 | return -EIO; | ||
412 | memcpy(out, buf, nbytes); | 416 | memcpy(out, buf, nbytes); |
413 | crypto_inc(ctrblk, DES_BLOCK_SIZE); | 417 | crypto_inc(ctrblk, DES_BLOCK_SIZE); |
414 | ret = blkcipher_walk_done(desc, walk, 0); | 418 | ret = blkcipher_walk_done(desc, walk, 0); |
@@ -448,6 +452,7 @@ static struct crypto_alg ctr_des_alg = { | |||
448 | .cra_ctxsize = sizeof(struct s390_des_ctx), | 452 | .cra_ctxsize = sizeof(struct s390_des_ctx), |
449 | .cra_type = &crypto_blkcipher_type, | 453 | .cra_type = &crypto_blkcipher_type, |
450 | .cra_module = THIS_MODULE, | 454 | .cra_module = THIS_MODULE, |
455 | .cra_list = LIST_HEAD_INIT(ctr_des_alg.cra_list), | ||
451 | .cra_u = { | 456 | .cra_u = { |
452 | .blkcipher = { | 457 | .blkcipher = { |
453 | .min_keysize = DES_KEY_SIZE, | 458 | .min_keysize = DES_KEY_SIZE, |
@@ -491,6 +496,7 @@ static struct crypto_alg ctr_des3_alg = { | |||
491 | .cra_ctxsize = sizeof(struct s390_des_ctx), | 496 | .cra_ctxsize = sizeof(struct s390_des_ctx), |
492 | .cra_type = &crypto_blkcipher_type, | 497 | .cra_type = &crypto_blkcipher_type, |
493 | .cra_module = THIS_MODULE, | 498 | .cra_module = THIS_MODULE, |
499 | .cra_list = LIST_HEAD_INIT(ctr_des3_alg.cra_list), | ||
494 | .cra_u = { | 500 | .cra_u = { |
495 | .blkcipher = { | 501 | .blkcipher = { |
496 | .min_keysize = DES3_KEY_SIZE, | 502 | .min_keysize = DES3_KEY_SIZE, |
diff --git a/arch/s390/crypto/ghash_s390.c b/arch/s390/crypto/ghash_s390.c index d43485d142e..b1bd170f24b 100644 --- a/arch/s390/crypto/ghash_s390.c +++ b/arch/s390/crypto/ghash_s390.c | |||
@@ -72,16 +72,14 @@ static int ghash_update(struct shash_desc *desc, | |||
72 | if (!dctx->bytes) { | 72 | if (!dctx->bytes) { |
73 | ret = crypt_s390_kimd(KIMD_GHASH, ctx, buf, | 73 | ret = crypt_s390_kimd(KIMD_GHASH, ctx, buf, |
74 | GHASH_BLOCK_SIZE); | 74 | GHASH_BLOCK_SIZE); |
75 | if (ret != GHASH_BLOCK_SIZE) | 75 | BUG_ON(ret != GHASH_BLOCK_SIZE); |
76 | return -EIO; | ||
77 | } | 76 | } |
78 | } | 77 | } |
79 | 78 | ||
80 | n = srclen & ~(GHASH_BLOCK_SIZE - 1); | 79 | n = srclen & ~(GHASH_BLOCK_SIZE - 1); |
81 | if (n) { | 80 | if (n) { |
82 | ret = crypt_s390_kimd(KIMD_GHASH, ctx, src, n); | 81 | ret = crypt_s390_kimd(KIMD_GHASH, ctx, src, n); |
83 | if (ret != n) | 82 | BUG_ON(ret != n); |
84 | return -EIO; | ||
85 | src += n; | 83 | src += n; |
86 | srclen -= n; | 84 | srclen -= n; |
87 | } | 85 | } |
@@ -94,7 +92,7 @@ static int ghash_update(struct shash_desc *desc, | |||
94 | return 0; | 92 | return 0; |
95 | } | 93 | } |
96 | 94 | ||
97 | static int ghash_flush(struct ghash_ctx *ctx, struct ghash_desc_ctx *dctx) | 95 | static void ghash_flush(struct ghash_ctx *ctx, struct ghash_desc_ctx *dctx) |
98 | { | 96 | { |
99 | u8 *buf = dctx->buffer; | 97 | u8 *buf = dctx->buffer; |
100 | int ret; | 98 | int ret; |
@@ -105,24 +103,21 @@ static int ghash_flush(struct ghash_ctx *ctx, struct ghash_desc_ctx *dctx) | |||
105 | memset(pos, 0, dctx->bytes); | 103 | memset(pos, 0, dctx->bytes); |
106 | 104 | ||
107 | ret = crypt_s390_kimd(KIMD_GHASH, ctx, buf, GHASH_BLOCK_SIZE); | 105 | ret = crypt_s390_kimd(KIMD_GHASH, ctx, buf, GHASH_BLOCK_SIZE); |
108 | if (ret != GHASH_BLOCK_SIZE) | 106 | BUG_ON(ret != GHASH_BLOCK_SIZE); |
109 | return -EIO; | ||
110 | } | 107 | } |
111 | 108 | ||
112 | dctx->bytes = 0; | 109 | dctx->bytes = 0; |
113 | return 0; | ||
114 | } | 110 | } |
115 | 111 | ||
116 | static int ghash_final(struct shash_desc *desc, u8 *dst) | 112 | static int ghash_final(struct shash_desc *desc, u8 *dst) |
117 | { | 113 | { |
118 | struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); | 114 | struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); |
119 | struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); | 115 | struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); |
120 | int ret; | ||
121 | 116 | ||
122 | ret = ghash_flush(ctx, dctx); | 117 | ghash_flush(ctx, dctx); |
123 | if (!ret) | 118 | memcpy(dst, ctx->icv, GHASH_BLOCK_SIZE); |
124 | memcpy(dst, ctx->icv, GHASH_BLOCK_SIZE); | 119 | |
125 | return ret; | 120 | return 0; |
126 | } | 121 | } |
127 | 122 | ||
128 | static struct shash_alg ghash_alg = { | 123 | static struct shash_alg ghash_alg = { |
@@ -140,6 +135,7 @@ static struct shash_alg ghash_alg = { | |||
140 | .cra_blocksize = GHASH_BLOCK_SIZE, | 135 | .cra_blocksize = GHASH_BLOCK_SIZE, |
141 | .cra_ctxsize = sizeof(struct ghash_ctx), | 136 | .cra_ctxsize = sizeof(struct ghash_ctx), |
142 | .cra_module = THIS_MODULE, | 137 | .cra_module = THIS_MODULE, |
138 | .cra_list = LIST_HEAD_INIT(ghash_alg.base.cra_list), | ||
143 | }, | 139 | }, |
144 | }; | 140 | }; |
145 | 141 | ||
diff --git a/arch/s390/crypto/prng.c b/arch/s390/crypto/prng.c index 94a35a4c1b4..0808fbf0f7d 100644 --- a/arch/s390/crypto/prng.c +++ b/arch/s390/crypto/prng.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright IBM Corp. 2006, 2007 | 2 | * Copyright IBM Corp. 2006,2007 |
3 | * Author(s): Jan Glauber <jan.glauber@de.ibm.com> | 3 | * Author(s): Jan Glauber <jan.glauber@de.ibm.com> |
4 | * Driver for the s390 pseudo random number generator | 4 | * Driver for the s390 pseudo random number generator |
5 | */ | 5 | */ |
diff --git a/arch/s390/crypto/sha1_s390.c b/arch/s390/crypto/sha1_s390.c index a1b3a9dc9d8..e9868c6e0a0 100644 --- a/arch/s390/crypto/sha1_s390.c +++ b/arch/s390/crypto/sha1_s390.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * implementation written by Steve Reid. | 8 | * implementation written by Steve Reid. |
9 | * | 9 | * |
10 | * s390 Version: | 10 | * s390 Version: |
11 | * Copyright IBM Corp. 2003, 2007 | 11 | * Copyright IBM Corp. 2003,2007 |
12 | * Author(s): Thomas Spatzier | 12 | * Author(s): Thomas Spatzier |
13 | * Jan Glauber (jan.glauber@de.ibm.com) | 13 | * Jan Glauber (jan.glauber@de.ibm.com) |
14 | * | 14 | * |
diff --git a/arch/s390/crypto/sha256_s390.c b/arch/s390/crypto/sha256_s390.c index 9b853809a49..0317a3547cb 100644 --- a/arch/s390/crypto/sha256_s390.c +++ b/arch/s390/crypto/sha256_s390.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * s390 implementation of the SHA256 and SHA224 Secure Hash Algorithm. | 4 | * s390 implementation of the SHA256 and SHA224 Secure Hash Algorithm. |
5 | * | 5 | * |
6 | * s390 Version: | 6 | * s390 Version: |
7 | * Copyright IBM Corp. 2005, 2011 | 7 | * Copyright IBM Corp. 2005,2011 |
8 | * Author(s): Jan Glauber (jang@de.ibm.com) | 8 | * Author(s): Jan Glauber (jang@de.ibm.com) |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify it | 10 | * This program is free software; you can redistribute it and/or modify it |
diff --git a/arch/s390/crypto/sha_common.c b/arch/s390/crypto/sha_common.c index 8620b0ec9c4..48884f89ab9 100644 --- a/arch/s390/crypto/sha_common.c +++ b/arch/s390/crypto/sha_common.c | |||
@@ -14,7 +14,6 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <crypto/internal/hash.h> | 16 | #include <crypto/internal/hash.h> |
17 | #include <linux/module.h> | ||
18 | #include "sha.h" | 17 | #include "sha.h" |
19 | #include "crypt_s390.h" | 18 | #include "crypt_s390.h" |
20 | 19 | ||
@@ -36,8 +35,7 @@ int s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len) | |||
36 | if (index) { | 35 | if (index) { |
37 | memcpy(ctx->buf + index, data, bsize - index); | 36 | memcpy(ctx->buf + index, data, bsize - index); |
38 | ret = crypt_s390_kimd(ctx->func, ctx->state, ctx->buf, bsize); | 37 | ret = crypt_s390_kimd(ctx->func, ctx->state, ctx->buf, bsize); |
39 | if (ret != bsize) | 38 | BUG_ON(ret != bsize); |
40 | return -EIO; | ||
41 | data += bsize - index; | 39 | data += bsize - index; |
42 | len -= bsize - index; | 40 | len -= bsize - index; |
43 | index = 0; | 41 | index = 0; |
@@ -47,8 +45,7 @@ int s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len) | |||
47 | if (len >= bsize) { | 45 | if (len >= bsize) { |
48 | ret = crypt_s390_kimd(ctx->func, ctx->state, data, | 46 | ret = crypt_s390_kimd(ctx->func, ctx->state, data, |
49 | len & ~(bsize - 1)); | 47 | len & ~(bsize - 1)); |
50 | if (ret != (len & ~(bsize - 1))) | 48 | BUG_ON(ret != (len & ~(bsize - 1))); |
51 | return -EIO; | ||
52 | data += ret; | 49 | data += ret; |
53 | len -= ret; | 50 | len -= ret; |
54 | } | 51 | } |
@@ -90,8 +87,7 @@ int s390_sha_final(struct shash_desc *desc, u8 *out) | |||
90 | memcpy(ctx->buf + end - 8, &bits, sizeof(bits)); | 87 | memcpy(ctx->buf + end - 8, &bits, sizeof(bits)); |
91 | 88 | ||
92 | ret = crypt_s390_kimd(ctx->func, ctx->state, ctx->buf, end); | 89 | ret = crypt_s390_kimd(ctx->func, ctx->state, ctx->buf, end); |
93 | if (ret != end) | 90 | BUG_ON(ret != end); |
94 | return -EIO; | ||
95 | 91 | ||
96 | /* copy digest to out */ | 92 | /* copy digest to out */ |
97 | memcpy(out, ctx->state, crypto_shash_digestsize(desc->tfm)); | 93 | memcpy(out, ctx->state, crypto_shash_digestsize(desc->tfm)); |