diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-14 13:52:09 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-14 13:52:09 -0500 |
| commit | 37dc79565c4b7e735f190eaa6ed5bb6eb3d3968a (patch) | |
| tree | 4f20cc3c9240c5759f72bf560b596a809173ee29 /drivers/crypto/qce | |
| parent | 894025f24bd028942da3e602b87d9f7223109b14 (diff) | |
| parent | 1d9ddde12e3c9bab7f3d3484eb9446315e3571ca (diff) | |
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto updates from Herbert Xu:
"Here is the crypto update for 4.15:
API:
- Disambiguate EBUSY when queueing crypto request by adding ENOSPC.
This change touches code outside the crypto API.
- Reset settings when empty string is written to rng_current.
Algorithms:
- Add OSCCA SM3 secure hash.
Drivers:
- Remove old mv_cesa driver (replaced by marvell/cesa).
- Enable rfc3686/ecb/cfb/ofb AES in crypto4xx.
- Add ccm/gcm AES in crypto4xx.
- Add support for BCM7278 in iproc-rng200.
- Add hash support on Exynos in s5p-sss.
- Fix fallback-induced error in vmx.
- Fix output IV in atmel-aes.
- Fix empty GCM hash in mediatek.
Others:
- Fix DoS potential in lib/mpi.
- Fix potential out-of-order issues with padata"
* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (162 commits)
lib/mpi: call cond_resched() from mpi_powm() loop
crypto: stm32/hash - Fix return issue on update
crypto: dh - Remove pointless checks for NULL 'p' and 'g'
crypto: qat - Clean up error handling in qat_dh_set_secret()
crypto: dh - Don't permit 'key' or 'g' size longer than 'p'
crypto: dh - Don't permit 'p' to be 0
crypto: dh - Fix double free of ctx->p
hwrng: iproc-rng200 - Add support for BCM7278
dt-bindings: rng: Document BCM7278 RNG200 compatible
crypto: chcr - Replace _manual_ swap with swap macro
crypto: marvell - Add a NULL entry at the end of mv_cesa_plat_id_table[]
hwrng: virtio - Virtio RNG devices need to be re-registered after suspend/resume
crypto: atmel - remove empty functions
crypto: ecdh - remove empty exit()
MAINTAINERS: update maintainer for qat
crypto: caam - remove unused param of ctx_map_to_sec4_sg()
crypto: caam - remove unneeded edesc zeroization
crypto: atmel-aes - Reset the controller before each use
crypto: atmel-aes - properly set IV after {en,de}crypt
hwrng: core - Reset user selected rng by writing "" to rng_current
...
Diffstat (limited to 'drivers/crypto/qce')
| -rw-r--r-- | drivers/crypto/qce/ablkcipher.c | 5 | ||||
| -rw-r--r-- | drivers/crypto/qce/sha.c | 30 |
2 files changed, 5 insertions, 30 deletions
diff --git a/drivers/crypto/qce/ablkcipher.c b/drivers/crypto/qce/ablkcipher.c index b04b42f48366..ea4d96bf47e8 100644 --- a/drivers/crypto/qce/ablkcipher.c +++ b/drivers/crypto/qce/ablkcipher.c | |||
| @@ -248,10 +248,7 @@ static int qce_ablkcipher_init(struct crypto_tfm *tfm) | |||
| 248 | ctx->fallback = crypto_alloc_skcipher(crypto_tfm_alg_name(tfm), 0, | 248 | ctx->fallback = crypto_alloc_skcipher(crypto_tfm_alg_name(tfm), 0, |
| 249 | CRYPTO_ALG_ASYNC | | 249 | CRYPTO_ALG_ASYNC | |
| 250 | CRYPTO_ALG_NEED_FALLBACK); | 250 | CRYPTO_ALG_NEED_FALLBACK); |
| 251 | if (IS_ERR(ctx->fallback)) | 251 | return PTR_ERR_OR_ZERO(ctx->fallback); |
| 252 | return PTR_ERR(ctx->fallback); | ||
| 253 | |||
| 254 | return 0; | ||
| 255 | } | 252 | } |
| 256 | 253 | ||
| 257 | static void qce_ablkcipher_exit(struct crypto_tfm *tfm) | 254 | static void qce_ablkcipher_exit(struct crypto_tfm *tfm) |
diff --git a/drivers/crypto/qce/sha.c b/drivers/crypto/qce/sha.c index 47e114ac09d0..53227d70d397 100644 --- a/drivers/crypto/qce/sha.c +++ b/drivers/crypto/qce/sha.c | |||
| @@ -349,28 +349,12 @@ static int qce_ahash_digest(struct ahash_request *req) | |||
| 349 | return qce->async_req_enqueue(tmpl->qce, &req->base); | 349 | return qce->async_req_enqueue(tmpl->qce, &req->base); |
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | struct qce_ahash_result { | ||
| 353 | struct completion completion; | ||
| 354 | int error; | ||
| 355 | }; | ||
| 356 | |||
| 357 | static void qce_digest_complete(struct crypto_async_request *req, int error) | ||
| 358 | { | ||
| 359 | struct qce_ahash_result *result = req->data; | ||
| 360 | |||
| 361 | if (error == -EINPROGRESS) | ||
| 362 | return; | ||
| 363 | |||
| 364 | result->error = error; | ||
| 365 | complete(&result->completion); | ||
| 366 | } | ||
| 367 | |||
| 368 | static int qce_ahash_hmac_setkey(struct crypto_ahash *tfm, const u8 *key, | 352 | static int qce_ahash_hmac_setkey(struct crypto_ahash *tfm, const u8 *key, |
| 369 | unsigned int keylen) | 353 | unsigned int keylen) |
| 370 | { | 354 | { |
| 371 | unsigned int digestsize = crypto_ahash_digestsize(tfm); | 355 | unsigned int digestsize = crypto_ahash_digestsize(tfm); |
| 372 | struct qce_sha_ctx *ctx = crypto_tfm_ctx(&tfm->base); | 356 | struct qce_sha_ctx *ctx = crypto_tfm_ctx(&tfm->base); |
| 373 | struct qce_ahash_result result; | 357 | struct crypto_wait wait; |
| 374 | struct ahash_request *req; | 358 | struct ahash_request *req; |
| 375 | struct scatterlist sg; | 359 | struct scatterlist sg; |
| 376 | unsigned int blocksize; | 360 | unsigned int blocksize; |
| @@ -405,9 +389,9 @@ static int qce_ahash_hmac_setkey(struct crypto_ahash *tfm, const u8 *key, | |||
| 405 | goto err_free_ahash; | 389 | goto err_free_ahash; |
| 406 | } | 390 | } |
| 407 | 391 | ||
| 408 | init_completion(&result.completion); | 392 | crypto_init_wait(&wait); |
| 409 | ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, | 393 | ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, |
| 410 | qce_digest_complete, &result); | 394 | crypto_req_done, &wait); |
| 411 | crypto_ahash_clear_flags(ahash_tfm, ~0); | 395 | crypto_ahash_clear_flags(ahash_tfm, ~0); |
| 412 | 396 | ||
| 413 | buf = kzalloc(keylen + QCE_MAX_ALIGN_SIZE, GFP_KERNEL); | 397 | buf = kzalloc(keylen + QCE_MAX_ALIGN_SIZE, GFP_KERNEL); |
| @@ -420,13 +404,7 @@ static int qce_ahash_hmac_setkey(struct crypto_ahash *tfm, const u8 *key, | |||
| 420 | sg_init_one(&sg, buf, keylen); | 404 | sg_init_one(&sg, buf, keylen); |
| 421 | ahash_request_set_crypt(req, &sg, ctx->authkey, keylen); | 405 | ahash_request_set_crypt(req, &sg, ctx->authkey, keylen); |
| 422 | 406 | ||
| 423 | ret = crypto_ahash_digest(req); | 407 | ret = crypto_wait_req(crypto_ahash_digest(req), &wait); |
| 424 | if (ret == -EINPROGRESS || ret == -EBUSY) { | ||
| 425 | ret = wait_for_completion_interruptible(&result.completion); | ||
| 426 | if (!ret) | ||
| 427 | ret = result.error; | ||
| 428 | } | ||
| 429 | |||
| 430 | if (ret) | 408 | if (ret) |
| 431 | crypto_ahash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); | 409 | crypto_ahash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); |
| 432 | 410 | ||
