summaryrefslogtreecommitdiff
path: root/drivers/crypto
AgeCommit message (Collapse)Author
2018-11-23MLK-20314: drivers: crypto: caam: alg: Enable GCM for newer LP CAAMFranck LENORMAND
The iMX6 platform does not support fardware GCM, more recent iMX does so we enable it. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com> (cherry picked from commit 2a4e35399f37caff111d420866a9d4beb494e2e9)
2018-11-23MLK-19801: Add support of tagged keys in caamalgFranck LENORMAND
A tagged key is a key which has been tagged with metadata using tag_object.h API. We add the support for these keys to caamalg. For each algo of caamalg which supports tagged keys , it is done by: - Creating a modified version of the algo - Registering the modified version - When the modified transform is used, it gets the load parameter of the key. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com> (cherry picked from commit 88dee97d985890dbf37cafa7934c476d0ecfd0b3)
2018-11-23MLK-19801: Add tag functionalityFranck LENORMAND
Add functions to tag an object with metadata(configuration). It is possible to: - create metadata: - init_tag_object_header - init_blackey_conf - set_tag_object_conf - retrieve metadata: - get_tag_object_conf - get_blackey_conf The API expects an object to be a space a memory with an address and a size. The implementation of the tag is currently exposed but users shouldn't access it directly, they should use the functions provided. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com> (cherry picked from commit ebbb132da8e7f9de7f3d375eff8d87f684feb1eb)
2018-11-02MLK-20109: drivers: crypto: Do not register ARC4 for imx8qxp and imx8qmFranck LENORMAND
The alogrithm ecb(arc4) was registered by the CAAM for all the platforms however the hardware capability for this algo is no more present (No CHA). So we skip its registration. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-19656: crypto: dcp: Copy IV for CBC chainingFranck LENORMAND
Properly copy the IV for external chaining if we are performing a CBC operation. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-19365: drivers: crypto: caamalg: ecb(aes) does not use IVFranck LENORMAND
The crypto template lrw(crypto/lrw.c) and xts(crypto/xts.c) require an ecb(aes) algo as base which ivsize must be zero as ecb(aes) doesn't need an IV. The patch 84f5e22194 "MA-9807: Fix ecb(aes) use without an IV" add support in caamalg for ecb(aes) without iv. The ecb(aes) implementation of the CAAM declare an ivsize which is against specification. So remove it to be usable with cryto templates. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-19053: crypto: caam: RNG4 TRNG errataAymen Sghaier
The TRNG as used in RNG4, used in CAAM has a documentation issue. The effect is that it is possible that the entropy used to instantiate the DRBG may be old entropy, rather than newly generated entropy. There is proper programming guidance, but it is not in the documentation. Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
2018-10-29MLK-19055: driver: crypto: caam: Add build of driver on ARCH_MXC_ARM64 configFranck LENORMAND
The driver is currently built because ARCH_LAYERSCAPE is defined however this config should not be set for other platforms such as iMX8 family. This patch add the built of the driver if ARCH_MXC_ARM64 is selected. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-18082: crypto: caam: Change handling of error in probeFranck LENORMAND
Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-18082: crypto: caam: Fix error handling flowFranck LENORMAND
Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-18082: crypto: caam: Minimal fix for QX panicFranck LENORMAND
Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-18082: crypto: caam: Check ret value of dma_set_mask_and_coherentFranck LENORMAND
Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-18082: crypto: caam: sm: Fix descriptor running functionsFranck LENORMAND
In case of error when runnign descriptor, there was no indication of the root cause with the appropriate existing function. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-18082: crypto: caam: sm: Fix encap/decap function to handle errorsFranck LENORMAND
Explicit the use of the ring device to manage the operations related to DMA. Some values from DMA functions were not tested hence the issues were making the descriptor to fail later and make it harder to debug. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-17304-3: crypto: caam: Avoid dma_map call with empty bufferAymen Sghaier
While testing CONFIG_CRYPTO_MANAGER_DISABLE_TESTS, a Kernel panic occurred at caamhash module. The cause was the call of dma_map with empty buffer. This fix the issue by checking for size before dma_map. Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
2018-10-29MLK-17302: crypto: caam: Move RNG instantiation to SECOAymen Sghaier
On i.MX8 platforms with SECO/SCU the RNG is not anymore instantiated by the Kernel driver but by SECO. This is true for B0 revision and later. A0 revision is not supported. Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
2018-10-29MLK-17304-2: crypto: caam: Avoid dma_unmap call with empty bufferAymen Sghaier
This patch adds a check for the buffer size that is not empty before the dma_unmap function call. Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
2018-10-29MLK-17227: crypto: caam: Update CAAM driver verbosity while RNG initAymen Sghaier
Move to debug level rather than error level the RNG init traces while increasing entropy delays. Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
2018-10-29MLK-18082: crypto: caam: fix index when setting ctrlpriv->jr[]Franck LENORMAND
In case index == 00001000, the resulting index used to access ctrlpriv->jr[] was 15 instead of the expected value of 0. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-17233: Fix CAAM pointer size error for i.MX8Aymen Sghaier
While crypto manager tests some descriptors are malformed due to pointer size not coherent with CAAM specific dma address size Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
2018-10-29MLK-17304: crypto: caam: Fix error swiotlb buffer is full for caamhashAymen Sghaier
During caamhash tests the error "swiotlb buffer is full" occurred. This was due to dma mapping without unmapping later. This patch adds the unmap call to avoid the loss of dma memory. Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com> Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-17841: crypto: caam: Correct bugs in Secure MemoryFranck LENORMAND
This patch perform following modifications: - Send and receive SM command regrouped in 1 function - Verify that the JR device to use is valid - Modification of the error handling in the probe Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-18345: drivers: caam: add support for i.mx8mmSilvano di Ninno
Signed-off-by: Silvano di Ninno <silvano.dininno@nxp.com> Reviewed-by: Franck Lenormand <franck.lenormand@nxp.com>
2018-10-29MLK-17909 RNG Instantation done in Secure FirmwareCedric Neveux
- For i.MX 6 and 7 check if the Secure Firmware (OPTEE) is present. If present don't do the RNG instantation in the CAAM driver Reviewed-by: Silvano Di Ninno <silvano.dininno@nxp.com> Signed-off-by: Cedric Neveux <cedric.neveux@nxp.com>
2018-10-29MLK-17992: caam: sm: Fix compilation warningsFranck LENORMAND
Fix the following warnings in CAAM SM: drivers/crypto/caam/sm_store.c: In function 'blacken_key_jobdesc': drivers/crypto/caam/sm_store.c:141:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] tmpdesc[idx++] = (u32)key; ^ drivers/crypto/caam/sm_store.c:153:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] tmpdesc[idx++] = (u32)key; ^ drivers/crypto/caam/sm_store.c: In function 'blob_encap_jobdesc': drivers/crypto/caam/sm_store.c:274:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] tmpdesc[idx++] = (u32)secretbuf; ^ drivers/crypto/caam/sm_store.c: In function 'blob_decap_jobdesc': drivers/crypto/caam/sm_store.c:390:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] tmpdesc[idx++] = (u32)outbuf; ^ drivers/crypto/caam/sm_store.c: In function 'slot_get_base': drivers/crypto/caam/sm_store.c:569:9: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] return (u32)(ksdata->base_address); ^ drivers/crypto/caam/sm_store.c: In function 'sm_keystore_slot_load': drivers/crypto/caam/sm_store.c:789:6: warning: unused variable 'i' [-Wunused-variable] u32 i; Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-17674-2: CAAM SM : get base address from device treeSilvano di Ninno
Remove hard coded value for base physical address. Use device tree to get this value. i.MX8 with seco is still not address since CAAM uses a private bus to access secure memory Signed-off-by: Silvano di Ninno <silvano.dininno@nxp.com>
2018-10-29MLK-17674-1: sm_store remove CONFIG_OFSilvano di Ninno
I.MX linux only works with device tree support No need to keep code without CONFIG_OF Signed-off-by: Silvano di Ninno <silvano.dininno@nxp.com>
2018-10-29MLK-17732-2: SM store: Support iMX8QX and iMX8QMFranck LENORMAND
The iMX8 QX and QM have SECO/SCU enabled and the access to SM registers is different as long as the addresses of the pages. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-17253-2: crypto: caam: Use correct memory function for Secure MemoryFranck LENORMAND
The Secure Memory is a hardware memory whose address was retrieved using of_iomap, hence the memory manipulation shall use the set of functions: memset_io/memcpy_fromio/memcpy_toio in order to works correctly. Not using these functions can result in kernel panic. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-17253-1: crypto: caam: Fix computation of SM pages addressesFranck LENORMAND
The computation of the base address of the physical and virtual need to be the same depending on the architecture. The addresses are computed using a pointer on u8 so the additions always works as expected. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-17111-4: crypto: caam: Fix RNG Kernel oops on i.MX8QXPAymen Sghaier
Seen on i.MX8QXP board by reboot test, that Kernel oops occurs due to failing RNG instantiation with default entropy delay. The fix is to disable all job rings if RNG failed to prevent Kernel crash. And print an error message saying that this is a known limitation on REV A0 SoC. Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
2018-10-29MLK-17111-1: crypto: caam: Fix RNG instantiation retryAymen Sghaier
Seen on i.MX8MQ EVK board revision B0 that the RNG instantiation fail with default entropy delay. Retry process is fixed here to be able to instantiate RNG successfully. Reviewed-by: Silvano Di Ninno <silvano.dininno@nxp.com> Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
2018-10-29MLK-16950 crypto: caam: Fix failed to flush job ring 0Aymen Sghaier
This error occurred on MX8M-EVK while initializing the first job ring. If the job ring was used before Kernel level, then connecting it to the irq handler could generate error due to its (unknown) previous state. This patch calls the hardware reset function before connecting the irq handler. Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
2018-10-29MLK-18082: drivers: crypto: caam: Update copyrights to 2018Franck LENORMAND
Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-17019 Correct CopyrightPeng Fan
Correct Copyright Signed-off-by: Peng Fan <peng.fan@nxp.com>
2018-10-29MLK-15473-8: crypto: caam: Disable CAAM JR1 according to SCFW updateAymen Sghaier
After CAAM JR1 has been moved to SECO, imx-sc-firmware commit 36ff24f36b56 ("Move CAAM JR1 to SECO FW."), Linux no longer boots and rises a kernel panic at "caam_probe". So the CAAM JR1 should be disabled in the device-tree. Tested-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Silvano Di Ninno <silvano.dininno@nxp.com> Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
2018-10-29MLK-18082: crypto: caam: Fix DMA coherency configurationFranck LENORMAND
The DMA configuration of the CAAM for imx8 boards is not strictly related to the architecture of the kernel. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-18082: Reduce code diff with last commitFranck LENORMAND
The organization of functions of the CAAM driver changed between 4.9 and 4.14 so this arrangement allow to see more clearly the changes later in the tree. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-15473-1: crypto: caam: Add CAAM driver support for iMX8 soc familyFranck LENORMAND
Enable CAAM driver for i.MX8 family: - Use a Job ring for RNG instantiation rather than DECO, even for i.MX6/7 families. - Use of aliased CAAM registers instead of original registers in page 0 since page 0 is no more accessible in i.MX8 family except mScale. Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
2018-10-29MLK-18082: crypto: caam: Move RNG instantationFranck LENORMAND
Move the code related to RNG instanciation to another file to ease comprehension. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-11020: arm: imx: caam: imx7d caam_aclk clock dependencyAdrian Alonso
* Add caam_aclk clock root dependency, imx7d caam ip module needs caam_aclk and caam_ipg clock signals to operate add additional clock signal. Signed-off-by: Adrian Alonso <aalonso@freescale.com> Signed-off-by: Dan Douglass <dan.douglass@freescale.com> [Octavian: since the clk API skips NULL args use a single disable label] Signed-off-by: Octavian Purdila <octavian.purdila@nxp.com> Conflicts: drivers/crypto/caam/ctrl.c
2018-10-29MLK-10978-1 ARM: imx6ul: Add CAAM support for i.mx6ulDan Douglass
There are only 3 CAAM clocks that are required for i.mx6ul. Adding logic to enable only the required clocks based on the device tree compatibility node. Signed-off-by: Dan Douglass <dan.douglass@freescale.com> Conflicts: drivers/crypto/caam/ctrl.c
2018-10-29MLK-17992: caam: sm: Fix compilation warningsFranck LENORMAND
Fix the following warnings in CAAM SM: drivers/crypto/caam/sm_store.c: In function 'blacken_key_jobdesc': drivers/crypto/caam/sm_store.c:141:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] tmpdesc[idx++] = (u32)key; ^ drivers/crypto/caam/sm_store.c:153:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] tmpdesc[idx++] = (u32)key; ^ drivers/crypto/caam/sm_store.c: In function 'blob_encap_jobdesc': drivers/crypto/caam/sm_store.c:274:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] tmpdesc[idx++] = (u32)secretbuf; ^ drivers/crypto/caam/sm_store.c: In function 'blob_decap_jobdesc': drivers/crypto/caam/sm_store.c:390:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] tmpdesc[idx++] = (u32)outbuf; ^ drivers/crypto/caam/sm_store.c: In function 'slot_get_base': drivers/crypto/caam/sm_store.c:569:9: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] return (u32)(ksdata->base_address); ^ drivers/crypto/caam/sm_store.c: In function 'sm_keystore_slot_load': drivers/crypto/caam/sm_store.c:789:6: warning: unused variable 'i' [-Wunused-variable] u32 i; Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-17412-01: Fix secvio driver to have same driver name as DTSFranck LENORMAND
The name of the driver was "snvs-secvio" which doesn't corresponds to its use in the differents dts files. This patch change the driver name to "caam-snvs" to corresponds to the dts files. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2018-10-29MLK-14765: Enable DCP SHA workaround on all platformsRadu Solea
Remove variant restriction for DCP SHA workaround. All integrations of DCP seem affected. Signed-off-by: Radu Solea <radu.solea@nxp.com>
2018-10-29MA-9807: Fix ecb(aes) use without an IVRadu Solea
CAAM aes modes share descriptors, because of this CAAM requires an IV for ECB. ECB does not need an IV and users do not have to pass valid IV vectors. To allow correct usage with minimum impact to the driver a zero IV is provided by the driver for ECB operations that need it. Signed-off-by: Radu Solea <radu.solea@nxp.com>
2018-10-29MLK-14765: Fix DCP Aes timeout issues when used with CTSRadu Solea
The DCP driver does not obey cryptlen, when doing CTS this results in passing to hardware input stream lengths which are not multiple of block size. This causes the hw to misbehave. Also not honoring cryptlen makes CTS fail. A check was introduced to prevent future erroneous stream lengths from reaching the hardware. Code which is splitting the input stream in internal DCP pages was changed to obey cryptlen. Signed-off-by: Radu Solea <radu.solea@nxp.com>
2018-10-29MLK-14765: Fix DCP SHA null hashes and output lengthRadu Solea
On imx6sl and imx6ull DCP writes at least 32 bytes in the output buffer instead of hash length as documented. Add intermediate buffer to prevent write out of bounds. When requested to produce null hashes DCP fails to produce valid output. Add software workaround to bypass hardware and return valid output. Signed-off-by: Radu Solea <radu.solea@nxp.com>
2018-10-29MLK-14611 Fix xcbc unkeyed registrationRadu Solea
AES is a keyed algorithm, XCBC-AES needs a key for operation, this patch prevents the registration of AES-based transforms as unkeyed operations. Signed-off-by: Radu Solea <radu.solea@nxp.com>
2018-10-29MLK-14284 Fix CAAM Errata err005766 handlingRadu Solea
* Update ERA detection code to check 3 sources CCBVID, CAAMVID and the device tree. * Fix bit handling of CAAMVID data to obtain correct results. * Remove default device tree values. * Update errata handling to target known affected platforms. Signed-off-by: Radu Solea <radu.solea@nxp.com>