diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-11-19 14:15:45 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-11-19 14:15:45 -0500 |
commit | 384b0dc4c84eb0ffe04589694a31a06226d61f7a (patch) | |
tree | b60236afef24712752b2560d92b4e5578a95e071 | |
parent | 6741897602aabae6542631cafbd2616943acc735 (diff) | |
parent | a8348bca2944d397a528772f5c0ccb47a8b58af4 (diff) |
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu:
"This fixes the following issues:
- Compiler warning in caam driver that was the last one remaining
- Do not register aes-xts in caam drivers on unsupported platforms
- Regression in algif_hash interface that may lead to an oops"
* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
crypto: algif_hash - Fix NULL hash crash with shash
crypto: caam - fix type mismatch warning
crypto: caam - do not register AES-XTS mode on LP units
-rw-r--r-- | crypto/algif_hash.c | 17 | ||||
-rw-r--r-- | drivers/crypto/caam/caamalg.c | 11 |
2 files changed, 20 insertions, 8 deletions
diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c index 2d8466f9e49b..05e21b464433 100644 --- a/crypto/algif_hash.c +++ b/crypto/algif_hash.c | |||
@@ -214,23 +214,26 @@ static int hash_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, | |||
214 | 214 | ||
215 | ahash_request_set_crypt(&ctx->req, NULL, ctx->result, 0); | 215 | ahash_request_set_crypt(&ctx->req, NULL, ctx->result, 0); |
216 | 216 | ||
217 | if (ctx->more) { | 217 | if (!result) { |
218 | err = af_alg_wait_for_completion( | ||
219 | crypto_ahash_init(&ctx->req), | ||
220 | &ctx->completion); | ||
221 | if (err) | ||
222 | goto unlock; | ||
223 | } | ||
224 | |||
225 | if (!result || ctx->more) { | ||
218 | ctx->more = 0; | 226 | ctx->more = 0; |
219 | err = af_alg_wait_for_completion(crypto_ahash_final(&ctx->req), | 227 | err = af_alg_wait_for_completion(crypto_ahash_final(&ctx->req), |
220 | &ctx->completion); | 228 | &ctx->completion); |
221 | if (err) | 229 | if (err) |
222 | goto unlock; | 230 | goto unlock; |
223 | } else if (!result) { | ||
224 | err = af_alg_wait_for_completion( | ||
225 | crypto_ahash_digest(&ctx->req), | ||
226 | &ctx->completion); | ||
227 | } | 231 | } |
228 | 232 | ||
229 | err = memcpy_to_msg(msg, ctx->result, len); | 233 | err = memcpy_to_msg(msg, ctx->result, len); |
230 | 234 | ||
231 | hash_free_result(sk, ctx); | ||
232 | |||
233 | unlock: | 235 | unlock: |
236 | hash_free_result(sk, ctx); | ||
234 | release_sock(sk); | 237 | release_sock(sk); |
235 | 238 | ||
236 | return err ?: len; | 239 | return err ?: len; |
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index 156aad167cd6..954a64c7757b 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c | |||
@@ -137,7 +137,7 @@ static void dbg_dump_sg(const char *level, const char *prefix_str, | |||
137 | } | 137 | } |
138 | 138 | ||
139 | buf = it_page + it->offset; | 139 | buf = it_page + it->offset; |
140 | len = min(tlen, it->length); | 140 | len = min_t(size_t, tlen, it->length); |
141 | print_hex_dump(level, prefix_str, prefix_type, rowsize, | 141 | print_hex_dump(level, prefix_str, prefix_type, rowsize, |
142 | groupsize, buf, len, ascii); | 142 | groupsize, buf, len, ascii); |
143 | tlen -= len; | 143 | tlen -= len; |
@@ -4583,6 +4583,15 @@ static int __init caam_algapi_init(void) | |||
4583 | if (!aes_inst && (alg_sel == OP_ALG_ALGSEL_AES)) | 4583 | if (!aes_inst && (alg_sel == OP_ALG_ALGSEL_AES)) |
4584 | continue; | 4584 | continue; |
4585 | 4585 | ||
4586 | /* | ||
4587 | * Check support for AES modes not available | ||
4588 | * on LP devices. | ||
4589 | */ | ||
4590 | if ((cha_vid & CHA_ID_LS_AES_MASK) == CHA_ID_LS_AES_LP) | ||
4591 | if ((alg->class1_alg_type & OP_ALG_AAI_MASK) == | ||
4592 | OP_ALG_AAI_XTS) | ||
4593 | continue; | ||
4594 | |||
4586 | t_alg = caam_alg_alloc(alg); | 4595 | t_alg = caam_alg_alloc(alg); |
4587 | if (IS_ERR(t_alg)) { | 4596 | if (IS_ERR(t_alg)) { |
4588 | err = PTR_ERR(t_alg); | 4597 | err = PTR_ERR(t_alg); |