diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-08 23:57:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-08 23:57:08 -0400 |
commit | 4d2fa8b44b891f0da5ceda3e5a1402ccf0ab6f26 (patch) | |
tree | cbb763ec5e74cfbaac6ce53df277883cb78a8a1a /crypto/algapi.c | |
parent | 8b68150883ca466a23e90902dd4113b22e692f04 (diff) | |
parent | f3880a23564e3172437285ebcb5b8a124539fdae (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 5.3:
API:
- Test shash interface directly in testmgr
- cra_driver_name is now mandatory
Algorithms:
- Replace arc4 crypto_cipher with library helper
- Implement 5 way interleave for ECB, CBC and CTR on arm64
- Add xxhash
- Add continuous self-test on noise source to drbg
- Update jitter RNG
Drivers:
- Add support for SHA204A random number generator
- Add support for 7211 in iproc-rng200
- Fix fuzz test failures in inside-secure
- Fix fuzz test failures in talitos
- Fix fuzz test failures in qat"
* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (143 commits)
crypto: stm32/hash - remove interruptible condition for dma
crypto: stm32/hash - Fix hmac issue more than 256 bytes
crypto: stm32/crc32 - rename driver file
crypto: amcc - remove memset after dma_alloc_coherent
crypto: ccp - Switch to SPDX license identifiers
crypto: ccp - Validate the the error value used to index error messages
crypto: doc - Fix formatting of new crypto engine content
crypto: doc - Add parameter documentation
crypto: arm64/aes-ce - implement 5 way interleave for ECB, CBC and CTR
crypto: arm64/aes-ce - add 5 way interleave routines
crypto: talitos - drop icv_ool
crypto: talitos - fix hash on SEC1.
crypto: talitos - move struct talitos_edesc into talitos.h
lib/scatterlist: Fix mapping iterator when sg->offset is greater than PAGE_SIZE
crypto/NX: Set receive window credits to max number of CRBs in RxFIFO
crypto: asymmetric_keys - select CRYPTO_HASH where needed
crypto: serpent - mark __serpent_setkey_sbox noinline
crypto: testmgr - dynamically allocate crypto_shash
crypto: testmgr - dynamically allocate testvec_config
crypto: talitos - eliminate unneeded 'done' functions at build time
...
Diffstat (limited to 'crypto/algapi.c')
-rw-r--r-- | crypto/algapi.c | 35 |
1 files changed, 4 insertions, 31 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c index 313a7682cef1..de30ddc952d8 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c | |||
@@ -21,23 +21,6 @@ | |||
21 | 21 | ||
22 | static LIST_HEAD(crypto_template_list); | 22 | static LIST_HEAD(crypto_template_list); |
23 | 23 | ||
24 | static inline int crypto_set_driver_name(struct crypto_alg *alg) | ||
25 | { | ||
26 | static const char suffix[] = "-generic"; | ||
27 | char *driver_name = alg->cra_driver_name; | ||
28 | int len; | ||
29 | |||
30 | if (*driver_name) | ||
31 | return 0; | ||
32 | |||
33 | len = strlcpy(driver_name, alg->cra_name, CRYPTO_MAX_ALG_NAME); | ||
34 | if (len + sizeof(suffix) > CRYPTO_MAX_ALG_NAME) | ||
35 | return -ENAMETOOLONG; | ||
36 | |||
37 | memcpy(driver_name + len, suffix, sizeof(suffix)); | ||
38 | return 0; | ||
39 | } | ||
40 | |||
41 | static inline void crypto_check_module_sig(struct module *mod) | 24 | static inline void crypto_check_module_sig(struct module *mod) |
42 | { | 25 | { |
43 | if (fips_enabled && mod && !module_sig_ok(mod)) | 26 | if (fips_enabled && mod && !module_sig_ok(mod)) |
@@ -49,6 +32,9 @@ static int crypto_check_alg(struct crypto_alg *alg) | |||
49 | { | 32 | { |
50 | crypto_check_module_sig(alg->cra_module); | 33 | crypto_check_module_sig(alg->cra_module); |
51 | 34 | ||
35 | if (!alg->cra_name[0] || !alg->cra_driver_name[0]) | ||
36 | return -EINVAL; | ||
37 | |||
52 | if (alg->cra_alignmask & (alg->cra_alignmask + 1)) | 38 | if (alg->cra_alignmask & (alg->cra_alignmask + 1)) |
53 | return -EINVAL; | 39 | return -EINVAL; |
54 | 40 | ||
@@ -74,7 +60,7 @@ static int crypto_check_alg(struct crypto_alg *alg) | |||
74 | 60 | ||
75 | refcount_set(&alg->cra_refcnt, 1); | 61 | refcount_set(&alg->cra_refcnt, 1); |
76 | 62 | ||
77 | return crypto_set_driver_name(alg); | 63 | return 0; |
78 | } | 64 | } |
79 | 65 | ||
80 | static void crypto_free_instance(struct crypto_instance *inst) | 66 | static void crypto_free_instance(struct crypto_instance *inst) |
@@ -947,19 +933,6 @@ struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue) | |||
947 | } | 933 | } |
948 | EXPORT_SYMBOL_GPL(crypto_dequeue_request); | 934 | EXPORT_SYMBOL_GPL(crypto_dequeue_request); |
949 | 935 | ||
950 | int crypto_tfm_in_queue(struct crypto_queue *queue, struct crypto_tfm *tfm) | ||
951 | { | ||
952 | struct crypto_async_request *req; | ||
953 | |||
954 | list_for_each_entry(req, &queue->list, list) { | ||
955 | if (req->tfm == tfm) | ||
956 | return 1; | ||
957 | } | ||
958 | |||
959 | return 0; | ||
960 | } | ||
961 | EXPORT_SYMBOL_GPL(crypto_tfm_in_queue); | ||
962 | |||
963 | static inline void crypto_inc_byte(u8 *a, unsigned int size) | 936 | static inline void crypto_inc_byte(u8 *a, unsigned int size) |
964 | { | 937 | { |
965 | u8 *b = (a + size); | 938 | u8 *b = (a + size); |