diff options
author | Jan Glauber <jang@linux.vnet.ibm.com> | 2012-10-26 09:06:12 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2012-11-23 05:14:27 -0500 |
commit | 36eb2caa7bace31b7868a57f77cb148e58d1c9f9 (patch) | |
tree | 440ee2134281ce81fec701f1f2ca4f2393f5659c /arch/s390/crypto/sha_common.c | |
parent | ce1d801462ce75f9ba84e0bb32a05e1a7c881efe (diff) |
s390/crypto: Don't panic after crypto instruction failures
Remove the BUG_ON's that check for failure or incomplete
results of the s390 hardware crypto instructions.
Rather report the errors as -EIO to the crypto layer.
Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/crypto/sha_common.c')
-rw-r--r-- | arch/s390/crypto/sha_common.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/arch/s390/crypto/sha_common.c b/arch/s390/crypto/sha_common.c index bd37d09b9d3c..8620b0ec9c42 100644 --- a/arch/s390/crypto/sha_common.c +++ b/arch/s390/crypto/sha_common.c | |||
@@ -36,7 +36,8 @@ int s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len) | |||
36 | if (index) { | 36 | if (index) { |
37 | memcpy(ctx->buf + index, data, bsize - index); | 37 | memcpy(ctx->buf + index, data, bsize - index); |
38 | ret = crypt_s390_kimd(ctx->func, ctx->state, ctx->buf, bsize); | 38 | ret = crypt_s390_kimd(ctx->func, ctx->state, ctx->buf, bsize); |
39 | BUG_ON(ret != bsize); | 39 | if (ret != bsize) |
40 | return -EIO; | ||
40 | data += bsize - index; | 41 | data += bsize - index; |
41 | len -= bsize - index; | 42 | len -= bsize - index; |
42 | index = 0; | 43 | index = 0; |
@@ -46,7 +47,8 @@ int s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len) | |||
46 | if (len >= bsize) { | 47 | if (len >= bsize) { |
47 | ret = crypt_s390_kimd(ctx->func, ctx->state, data, | 48 | ret = crypt_s390_kimd(ctx->func, ctx->state, data, |
48 | len & ~(bsize - 1)); | 49 | len & ~(bsize - 1)); |
49 | BUG_ON(ret != (len & ~(bsize - 1))); | 50 | if (ret != (len & ~(bsize - 1))) |
51 | return -EIO; | ||
50 | data += ret; | 52 | data += ret; |
51 | len -= ret; | 53 | len -= ret; |
52 | } | 54 | } |
@@ -88,7 +90,8 @@ int s390_sha_final(struct shash_desc *desc, u8 *out) | |||
88 | memcpy(ctx->buf + end - 8, &bits, sizeof(bits)); | 90 | memcpy(ctx->buf + end - 8, &bits, sizeof(bits)); |
89 | 91 | ||
90 | ret = crypt_s390_kimd(ctx->func, ctx->state, ctx->buf, end); | 92 | ret = crypt_s390_kimd(ctx->func, ctx->state, ctx->buf, end); |
91 | BUG_ON(ret != end); | 93 | if (ret != end) |
94 | return -EIO; | ||
92 | 95 | ||
93 | /* copy digest to out */ | 96 | /* copy digest to out */ |
94 | memcpy(out, ctx->state, crypto_shash_digestsize(desc->tfm)); | 97 | memcpy(out, ctx->state, crypto_shash_digestsize(desc->tfm)); |