aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-02-13tee: amdtee: amdtee depends on CRYPTO_DEV_CCP_DDHongbo Yao1-1/+1
If CRYPTO_DEV_CCP_DD=m and AMDTEE=y, the following error is seen while building call.c or core.c drivers/tee/amdtee/call.o: In function `handle_unload_ta': call.c:(.text+0x35f): undefined reference to `psp_tee_process_cmd' drivers/tee/amdtee/core.o: In function `amdtee_driver_init': core.c:(.init.text+0xf): undefined reference to `psp_check_tee_status Fix the config dependency for AMDTEE here. Reported-by: Hulk Robot <[email protected]> Fixes: 757cc3e9ff1d ("tee: add AMD-TEE driver") Signed-off-by: Hongbo Yao <[email protected]> Reviewed-by: Rijo Thomas <[email protected]> Acked-by: Jens Wiklander <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-02-05crypto: Kconfig - allow tests to be disabled when manager is disabledJason A. Donenfeld1-4/+0
The library code uses CRYPTO_MANAGER_DISABLE_TESTS to conditionalize its tests, but the library code can also exist without CRYPTO_MANAGER. That means on minimal configs, the test code winds up being built with no way to disable it. Signed-off-by: Jason A. Donenfeld <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: arm/chacha - fix build failured when kernel mode NEON is disabledArd Biesheuvel1-2/+2
When the ARM accelerated ChaCha driver is built as part of a configuration that has kernel mode NEON disabled, we expect the compiler to propagate the build time constant expression IS_ENABLED(CONFIG_KERNEL_MODE_NEON) in a way that eliminates all the cross-object references to the actual NEON routines, which allows the chacha-neon-core.o object to be omitted from the build entirely. Unfortunately, this fails to work as expected in some cases, and we may end up with a build error such as chacha-glue.c:(.text+0xc0): undefined reference to `chacha_4block_xor_neon' caused by the fact that chacha_doneon() has not been eliminated from the object code, even though it will never be called in practice. Let's fix this by adding some IS_ENABLED(CONFIG_KERNEL_MODE_NEON) tests that are not strictly needed from a logical point of view, but should help the compiler infer that the NEON code paths are unreachable in those cases. Fixes: b36d8c09e710c71f ("crypto: arm/chacha - remove dependency on generic ...") Reported-by: Russell King <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: caam - add support for i.MX8M PlusHoria Geantă1-2/+3
Add support for the crypto engine used in i.mx8mp (i.MX 8M "Plus"), which is very similar to the one used in i.mx8mq, i.mx8mm, i.mx8mn. Signed-off-by: Horia Geantă <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: x86/poly1305 - emit does base conversion itselfJason A. Donenfeld1-6/+2
The emit code does optional base conversion itself in assembly, so we don't need to do that here. Also, neither one of these functions uses simd instructions, so checking for that doesn't make sense either. Signed-off-by: Jason A. Donenfeld <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: hisilicon - fix spelling mistake "disgest" -> "digest"Colin Ian King1-1/+1
There is a spelling mistake in an error message. Fix it. Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: chacha20poly1305 - add back missing test vectors and test chunkingJason A. Donenfeld1-14/+1698
When this was originally ported, the 12-byte nonce vectors were left out to keep things simple. I agree that we don't need nor want a library interface for 12-byte nonces. But these test vectors were specially crafted to look at issues in the underlying primitives and related interactions. Therefore, we actually want to keep around all of the test vectors, and simply have a helper function to test them with. Secondly, the sglist-based chunking code in the library interface is rather complicated, so this adds a developer-only test for ensuring that all the book keeping is correct, across a wide array of possibilities. Signed-off-by: Jason A. Donenfeld <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: x86/poly1305 - fix .gitignore typoJason A. Donenfeld1-1/+1
Admist the kbuild robot induced changes, the .gitignore file for the generated file wasn't updated with the non-clashing filename. This commit adjusts that. Signed-off-by: Jason A. Donenfeld <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-22tee: fix memory allocation failure checks on drv_data and amdteeColin Ian King1-2/+2
Currently the memory allocation failure checks on drv_data and amdtee are using IS_ERR rather than checking for a null pointer. Fix these checks to use the conventional null pointer check. Addresses-Coverity: ("Dereference null return") Fixes: 757cc3e9ff1d ("tee: add AMD-TEE driver") Signed-off-by: Colin Ian King <[email protected]> Reviewed-by: Rijo Thomas <[email protected]> Acked-by: Jens Wiklander <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: ccree - erase unneeded inline funcsGilad Ben-Yossef1-10/+0
These inline versions of PM function for the case of CONFIG_PM is not set are never used. Erase them. Signed-off-by: Gilad Ben-Yossef <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: ccree - make cc_pm_put_suspend() voidGilad Ben-Yossef2-10/+4
cc_pm_put_suspend() return value was never checked and is not useful. Turn it into a void functions. Signed-off-by: Gilad Ben-Yossef <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: ccree - split overloaded usage of irq fieldGilad Ben-Yossef2-11/+9
We were using the irq field of the drvdata struct in an overloaded fahsion - saving the IRQ number during init and then storing the pending itnerrupt sources during interrupt in the same field. This worked because these usage are mutually exclusive but are confusing. So simplify the code and change the init use case to use a simple local variable. Signed-off-by: Gilad Ben-Yossef <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: ccree - fix PM race conditionGilad Ben-Yossef4-80/+7
The PM code was racy, possibly causing the driver to submit requests to a powered down device. Fix the race and while at it simplify the PM code. Signed-off-by: Gilad Ben-Yossef <[email protected]> Fixes: 1358c13a48c4 ("crypto: ccree - fix resume race condition on init") Cc: [email protected] # v4.20 Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: ccree - fix FDE descriptor sequenceOfir Drang1-3/+45
In FDE mode (xts, essiv and bitlocker) the cryptocell hardware requires that the the XEX key will be loaded after Key1. Signed-off-by: Ofir Drang <[email protected]> Cc: [email protected] Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: ccree - cc_do_send_request() is void funcGilad Ben-Yossef1-25/+11
cc_do_send_request() cannot fail and always returns -EINPROGRESS. Turn it into a void function and simplify code. Signed-off-by: Gilad Ben-Yossef <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: ccree - fix pm wrongful error reportingGilad Ben-Yossef1-1/+1
pm_runtime_get_sync() can return 1 as a valid (none error) return code. Treat it as such. Signed-off-by: Gilad Ben-Yossef <[email protected]> Cc: [email protected] # v4.19+ Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: ccree - turn errors to debug msgsGilad Ben-Yossef2-13/+13
We have several loud error log messages that are already reported via the normal return code mechanism and produce a lot of noise when the new testmgr extra test are enabled. Turn these into debug only messages Signed-off-by: Gilad Ben-Yossef <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: ccree - fix AEAD decrypt auth failGilad Ben-Yossef1-1/+1
On AEAD decryption authentication failure we are suppose to zero out the output plaintext buffer. However, we've missed skipping the optional associated data that may prefix the ciphertext. This commit fixes this issue. Signed-off-by: Gilad Ben-Yossef <[email protected]> Fixes: e88b27c8eaa8 ("crypto: ccree - use std api sg_zero_buffer") Cc: [email protected] Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: ccree - fix typo in commentHadar Gat1-1/+1
Fixed a typo in a commnet. Signed-off-by: Hadar Gat <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: ccree - fix typos in error msgsHadar Gat1-2/+2
Fixed typos in ccree error msgs. Signed-off-by: Hadar Gat <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: atmel-{aes,sha,tdes} - Retire crypto_platform_dataTudor Ambarus4-122/+3
These drivers no longer need it as they are only probed via DT. crypto_platform_data was allocated but unused, so remove it. This is a follow up for: commit 45a536e3a7e0 ("crypto: atmel-tdes - Retire dma_request_slave_channel_compat()") commit db28512f48e2 ("crypto: atmel-sha - Retire dma_request_slave_channel_compat()") commit 62f72cbdcf02 ("crypto: atmel-aes - Retire dma_request_slave_channel_compat()") Signed-off-by: Tudor Ambarus <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: x86/sha - Eliminate casts on asm implementationsKees Cook11-102/+102
In order to avoid CFI function prototype mismatches, this removes the casts on assembly implementations of sha1/256/512 accelerators. The safety checks from BUILD_BUG_ON() remain. Additionally, this renames various arguments for clarity, as suggested by Eric Biggers. Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: chtls - Fixed listen fail when max stid range reachedVinay Kumar Yadav1-3/+2
Do not return error when max stid reached, to Fallback to nic mode. Signed-off-by: Vinay Kumar Yadav <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: chtls - Corrected function call contextVinay Kumar Yadav1-15/+15
corrected function call context and moved t4_defer_reply to apropriate location. Signed-off-by: Vinay Kumar Yadav <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-22crypto: caam/qi2 - fix typo in algorithm's driver nameHoria Geantă1-1/+1
Fixes: 8d818c105501 ("crypto: caam/qi2 - add DPAA2-CAAM driver") Signed-off-by: Horia Geantă <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: essiv - fix AEAD capitalization and preposition use in help textGeert Uytterhoeven1-2/+2
"AEAD" is capitalized everywhere else. Use "an" when followed by a written or spoken vowel. Fixes: be1eb7f78aa8fbe3 ("crypto: essiv - create wrapper template for ESSIV generation") Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: hisilicon - add branch prediction macroZaibo Xu1-22/+22
This branch prediction macro on the hot path can improve small performance(about 2%) according to the test. Signed-off-by: Zaibo Xu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: hisilicon - adjust hpre_crt_para_getZaibo Xu1-14/+14
Reorder the input parameters of hpre_crt_para_get to make it cleaner. Signed-off-by: Zaibo Xu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: hisilicon - Fixed some tiny bugs of HPREZaibo Xu2-38/+32
1.Use memzero_explicit to clear key; 2.Fix some little endian writings; 3.Fix some other bugs and stuff of code style; Signed-off-by: Zaibo Xu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: hisilicon - Bugfixed tfm leakZaibo Xu2-13/+18
1.Fixed the bug of software tfm leakage. 2.Update HW error log message. Signed-off-by: Zaibo Xu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: hisilicon - Add aead support on SEC2Zaibo Xu4-24/+620
authenc(hmac(sha1),cbc(aes)), authenc(hmac(sha256),cbc(aes)), and authenc(hmac(sha512),cbc(aes)) support are added for SEC v2. Signed-off-by: Zaibo Xu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: hisilicon - redefine skcipher initiationZaibo Xu1-35/+61
1.Define base initiation of QP for context which can be reused. 2.Define cipher initiation for other algorithms. Signed-off-by: Zaibo Xu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: hisilicon - Add branch prediction macroZaibo Xu1-14/+14
After adding branch prediction for skcipher hot path, a little bit income of performance is gotten. Signed-off-by: Zaibo Xu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: hisilicon - Add callback error checkZaibo Xu2-6/+10
Add error type parameter for call back checking inside. Signed-off-by: Zaibo Xu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: hisilicon - Adjust some inner logicZaibo Xu1-26/+28
1.Adjust call back function. 2.Adjust parameter checking function. Signed-off-by: Zaibo Xu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: hisilicon - Update QP resources of SEC V2Zaibo Xu3-93/+59
1.Put resource including request and resource list into QP context structure to avoid allocate memory repeatedly. 2.Add max context queue number to void kcalloc large memory for QP context. 3.Remove the resource allocation operation. 4.Redefine resource allocation APIs to be shared by other algorithms. 5.Move resource allocation and free inner functions out of operations 'struct sec_req_op', and they are called directly. Signed-off-by: Zaibo Xu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: hisilicon - Update some names on SEC V2Zaibo Xu2-29/+36
1.Adjust dma map function to be reused by AEAD algorithms; 2.Update some names of internal functions and variables to support AEAD algorithms; 3.Rename 'sec_skcipher_exit' as 'sec_skcipher_uninit'; 4.Rename 'sec_get/put_queue_id' as 'sec_alloc/free_queue_id'; Signed-off-by: Zaibo Xu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: hisilicon - fix print/comment of SEC V2Zaibo Xu2-6/+6
Fixed some print, coding style and comments of HiSilicon SEC V2. Signed-off-by: Zaibo Xu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: hisilicon - Update debugfs usage of SEC V2Zaibo Xu3-14/+14
Applied some advices of Marco Elver on atomic usage of Debugfs, which is carried out by basing on Arnd Bergmann's fixing patch. Reported-by: Arnd Bergmann <[email protected]> Reported-by: Marco Elver <[email protected]> Signed-off-by: Zaibo Xu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16tee: amdtee: remove redundant NULL check for poolRijo Thomas1-2/+1
Remove NULL check for pool variable, since in the current code path it is guaranteed to be non-NULL. Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Rijo Thomas <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16tee: amdtee: rename err label to err_device_unregisterRijo Thomas1-2/+2
Rename err label to err_device_unregister for better readability. Suggested-by: Dan Carpenter <[email protected]> Signed-off-by: Rijo Thomas <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16tee: amdtee: skip tee_device_unregister if tee_device_alloc failsRijo Thomas1-1/+3
Currently, if tee_device_alloc() fails, then tee_device_unregister() is a no-op. Therefore, skip the function call to tee_device_unregister() by introducing a new goto label 'err_free_pool'. Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Rijo Thomas <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16tee: amdtee: print error message if tee not presentRijo Thomas1-3/+4
If there is no TEE with which the driver can communicate, then print an error message and return. Suggested-by: Dan Carpenter <[email protected]> Signed-off-by: Rijo Thomas <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16tee: amdtee: remove unused variable initializationRijo Thomas2-14/+14
Remove unused variable initialization from driver code. If enabled as a compiler option, compiler may throw warning for unused assignments. Reported-by: Dan Carpenter <[email protected]> Fixes: 757cc3e9ff1d ("tee: add AMD-TEE driver") Signed-off-by: Rijo Thomas <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: vmx - reject xts inputs that are too shortDaniel Axtens1-0/+3
When the kernel XTS implementation was extended to deal with ciphertext stealing in commit 8083b1bf8163 ("crypto: xts - add support for ciphertext stealing"), a check was added to reject inputs that were too short. However, in the vmx enablement - commit 239668419349 ("crypto: vmx/xts - use fallback for ciphertext stealing"), that check wasn't added to the vmx implementation. This disparity leads to errors like the following: alg: skcipher: p8_aes_xts encryption unexpectedly succeeded on test vector "random: len=0 klen=64"; expected_error=-22, cfg="random: inplace may_sleep use_finup src_divs=[<flush>66.99%@+10, 33.1%@alignmask+1155]" Return -EINVAL if asked to operate with a cryptlen smaller than the AES block size. This brings vmx in line with the generic implementation. Reported-by: Erhard Furtner <[email protected]> Link: https://bugzilla.kernel.org/show_bug.cgi?id=206049 Fixes: 239668419349 ("crypto: vmx/xts - use fallback for ciphertext stealing") Cc: Ard Biesheuvel <[email protected]> Cc: [email protected] # v5.4+ Signed-off-by: Michael Ellerman <[email protected]> [dja: commit message] Signed-off-by: Daniel Axtens <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: curve25519 - Fix selftest build errorHerbert Xu3-10/+30
If CRYPTO_CURVE25519 is y, CRYPTO_LIB_CURVE25519_GENERIC will be y, but CRYPTO_LIB_CURVE25519 may be set to m, this causes build errors: lib/crypto/curve25519-selftest.o: In function `curve25519': curve25519-selftest.c:(.text.unlikely+0xc): undefined reference to `curve25519_arch' lib/crypto/curve25519-selftest.o: In function `curve25519_selftest': curve25519-selftest.c:(.init.text+0x17e): undefined reference to `curve25519_base_arch' This is because the curve25519 self-test code is being controlled by the GENERIC option rather than the overall CURVE25519 option, as is the case with blake2s. To recap, the GENERIC and ARCH options for CURVE25519 are internal only and selected by users such as the Crypto API, or the externally visible CURVE25519 option which in turn is selected by wireguard. The self-test is specific to the the external CURVE25519 option and should not be enabled by the Crypto API. This patch fixes this by splitting the GENERIC module from the CURVE25519 module with the latter now containing just the self-test. Reported-by: Hulk Robot <[email protected]> Fixes: aa127963f1ca ("crypto: lib/curve25519 - re-add selftests") Signed-off-by: Herbert Xu <[email protected]> Reviewed-by: Jason A. Donenfeld <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: caam - add support for i.MX8M NanoHoria Geantă1-4/+4
Add support for the crypto engine used in i.mx8mn (i.MX 8M "Nano"), which is very similar to the one used in i.mx8mq, i.mx8mm. Since the clocks are identical for all members of i.MX 8M family, simplify the SoC <--> clock array mapping table. Signed-off-by: Horia Geantă <[email protected]> Tested-by: Iuliana Prodan <[email protected]> Reviewed-by: Iuliana Prodan <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: sun8i-ce - remove dead codeCorentin Labbe2-13/+0
Some code were left in the final driver but without any use. Signed-off-by: Corentin Labbe <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: sun8i-ce - fix removal of moduleCorentin Labbe1-2/+2
Removing the driver cause an oops due to the fact we clean an extra channel. Let's give the right index to the cleaning function. Fixes: 06f751b61329 ("crypto: allwinner - Add sun8i-ce Crypto Engine") Signed-off-by: Corentin Labbe <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2020-01-16crypto: amlogic - fix removal of moduleCorentin Labbe1-2/+2
Removing the driver cause an oops due to the fact we clean an extra channel. Let's give the right index to the cleaning function. Fixes: 48fe583fe541 ("crypto: amlogic - Add crypto accelerator for amlogic GXL") Signed-off-by: Corentin Labbe <[email protected]> Signed-off-by: Herbert Xu <[email protected]>