aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-14 13:52:09 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-14 13:52:09 -0500
commit37dc79565c4b7e735f190eaa6ed5bb6eb3d3968a (patch)
tree4f20cc3c9240c5759f72bf560b596a809173ee29 /include/linux
parent894025f24bd028942da3e602b87d9f7223109b14 (diff)
parent1d9ddde12e3c9bab7f3d3484eb9446315e3571ca (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 'include/linux')
-rw-r--r--include/linux/crypto.h40
-rw-r--r--include/linux/padata.h4
2 files changed, 44 insertions, 0 deletions
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 84da9978e951..78508ca4b108 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -24,6 +24,7 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/string.h> 25#include <linux/string.h>
26#include <linux/uaccess.h> 26#include <linux/uaccess.h>
27#include <linux/completion.h>
27 28
28/* 29/*
29 * Autoloaded crypto modules should only use a prefixed name to avoid allowing 30 * Autoloaded crypto modules should only use a prefixed name to avoid allowing
@@ -468,6 +469,45 @@ struct crypto_alg {
468} CRYPTO_MINALIGN_ATTR; 469} CRYPTO_MINALIGN_ATTR;
469 470
470/* 471/*
472 * A helper struct for waiting for completion of async crypto ops
473 */
474struct crypto_wait {
475 struct completion completion;
476 int err;
477};
478
479/*
480 * Macro for declaring a crypto op async wait object on stack
481 */
482#define DECLARE_CRYPTO_WAIT(_wait) \
483 struct crypto_wait _wait = { \
484 COMPLETION_INITIALIZER_ONSTACK((_wait).completion), 0 }
485
486/*
487 * Async ops completion helper functioons
488 */
489void crypto_req_done(struct crypto_async_request *req, int err);
490
491static inline int crypto_wait_req(int err, struct crypto_wait *wait)
492{
493 switch (err) {
494 case -EINPROGRESS:
495 case -EBUSY:
496 wait_for_completion(&wait->completion);
497 reinit_completion(&wait->completion);
498 err = wait->err;
499 break;
500 };
501
502 return err;
503}
504
505static inline void crypto_init_wait(struct crypto_wait *wait)
506{
507 init_completion(&wait->completion);
508}
509
510/*
471 * Algorithm registration interface. 511 * Algorithm registration interface.
472 */ 512 */
473int crypto_register_alg(struct crypto_alg *alg); 513int crypto_register_alg(struct crypto_alg *alg);
diff --git a/include/linux/padata.h b/include/linux/padata.h
index 2f9c1f93b1ce..5d13d25da2c8 100644
--- a/include/linux/padata.h
+++ b/include/linux/padata.h
@@ -37,6 +37,7 @@
37 * @list: List entry, to attach to the padata lists. 37 * @list: List entry, to attach to the padata lists.
38 * @pd: Pointer to the internal control structure. 38 * @pd: Pointer to the internal control structure.
39 * @cb_cpu: Callback cpu for serializatioon. 39 * @cb_cpu: Callback cpu for serializatioon.
40 * @cpu: Cpu for parallelization.
40 * @seq_nr: Sequence number of the parallelized data object. 41 * @seq_nr: Sequence number of the parallelized data object.
41 * @info: Used to pass information from the parallel to the serial function. 42 * @info: Used to pass information from the parallel to the serial function.
42 * @parallel: Parallel execution function. 43 * @parallel: Parallel execution function.
@@ -46,6 +47,7 @@ struct padata_priv {
46 struct list_head list; 47 struct list_head list;
47 struct parallel_data *pd; 48 struct parallel_data *pd;
48 int cb_cpu; 49 int cb_cpu;
50 int cpu;
49 int info; 51 int info;
50 void (*parallel)(struct padata_priv *padata); 52 void (*parallel)(struct padata_priv *padata);
51 void (*serial)(struct padata_priv *padata); 53 void (*serial)(struct padata_priv *padata);
@@ -85,6 +87,7 @@ struct padata_serial_queue {
85 * @swork: work struct for serialization. 87 * @swork: work struct for serialization.
86 * @pd: Backpointer to the internal control structure. 88 * @pd: Backpointer to the internal control structure.
87 * @work: work struct for parallelization. 89 * @work: work struct for parallelization.
90 * @reorder_work: work struct for reordering.
88 * @num_obj: Number of objects that are processed by this cpu. 91 * @num_obj: Number of objects that are processed by this cpu.
89 * @cpu_index: Index of the cpu. 92 * @cpu_index: Index of the cpu.
90 */ 93 */
@@ -93,6 +96,7 @@ struct padata_parallel_queue {
93 struct padata_list reorder; 96 struct padata_list reorder;
94 struct parallel_data *pd; 97 struct parallel_data *pd;
95 struct work_struct work; 98 struct work_struct work;
99 struct work_struct reorder_work;
96 atomic_t num_obj; 100 atomic_t num_obj;
97 int cpu_index; 101 int cpu_index;
98}; 102};