summaryrefslogtreecommitdiff
path: root/drivers/crypto
AgeCommit message (Collapse)Author
2015-11-03crypto: caam - Change kmalloc to kzalloc to avoid residual dataVictoria Milhoan
Since fields must be ORed in to operate correctly using any order of operations, changed allocations of the combination of extended descriptor structs + hardware scatterlists to use kzalloc() instead of kmalloc(), so as to ensure that residue data would not be ORed in with the correct data. Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com> Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com> Tested-by: Horia Geantă <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit dde20ae9d63835178ef4ba9655f530e052c08ab9) Conflicts: drivers/crypto/caam/caamalg.c
2015-11-03crypto: caam - fix memory corruption in ahash_final_ctxHoria Geant?
When doing pointer operation for accessing the HW S/G table, a value representing number of entries (and not number of bytes) must be used. Cc: <stable@vger.kernel.org> # 3.6+ Fixes: 045e36780f115 ("crypto: caam - ahash hmac support") Signed-off-by: Horia Geant? <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit b310c178e6d897f82abb9da3af1cd7c02b09f592)
2015-11-03crypto: caam - Fix incorrect size when DMA unmapping bufferVictoria Milhoan
The CAAM driver uses two data buffers to store data for a hashing operation, with one buffer defined as active. This change forces switching of the active buffer when executing a hashing operation to avoid a later DMA unmap using the length of the opposite buffer. Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 8af7b0f809a3d34657433ec545d64dff9808ce34)
2015-11-03crypto: caam - improve initalization for context state savesSteve Cornelius
Multiple function in asynchronous hashing use a saved-state block, a.k.a. struct caam_hash_state, which holds a stash of information between requests (init/update/final). Certain values in this state block are loaded for processing using an inline-if, and when this is done, the potential for uninitialized data can pose conflicts. Therefore, this patch improves initialization of state data to prevent false assignments using uninitialized data in the state block. This patch addresses the following traceback, originating in ahash_final_ctx(), although a problem like this could certainly exhibit other symptoms: kernel BUG at arch/arm/mm/dma-mapping.c:465! Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = 80004000 [00000000] *pgd=00000000 Internal error: Oops: 805 [#1] PREEMPT SMP Modules linked in: CPU: 0 Not tainted (3.0.15-01752-gdd441b9-dirty #40) PC is at __bug+0x1c/0x28 LR is at __bug+0x18/0x28 pc : [<80043240>] lr : [<8004323c>] psr: 60000013 sp : e423fd98 ip : 60000013 fp : 0000001c r10: e4191b84 r9 : 00000020 r8 : 00000009 r7 : 88005038 r6 : 00000001 r5 : 2d676572 r4 : e4191a60 r3 : 00000000 r2 : 00000001 r1 : 60000093 r0 : 00000033 Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 10c53c7d Table: 1000404a DAC: 00000015 Process cryptomgr_test (pid: 1306, stack limit = 0xe423e2f0) Stack: (0xe423fd98 to 0xe4240000) fd80: 11807fd1 80048544 fda0: 88005000 e4191a00 e5178040 8039dda0 00000000 00000014 2d676572 e4191008 fdc0: 88005018 e4191a60 00100100 e4191a00 00000000 8039ce0c e423fea8 00000007 fde0: e4191a00 e4227000 e5178000 8039ce18 e419183c 80203808 80a94a44 00000006 fe00: 00000000 80207180 00000000 00000006 e423ff08 00000000 00000007 e5178000 fe20: e41918a4 80a949b4 8c4844e2 00000000 00000049 74227000 8c4844e2 00000e90 fe40: 0000000e 74227e90 ffff8c58 80ac29e0 e423fed4 8006a350 8c81625c e423ff5c fe60: 00008576 e4002500 00000003 00030010 e4002500 00000003 e5180000 e4002500 fe80: e5178000 800e6d24 007fffff 00000000 00000010 e4001280 e4002500 60000013 fea0: 000000d0 804df078 00000000 00000000 00000000 00000000 00000000 00000000 fec0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 fee0: 00000000 00000000 e4227000 e4226000 e4753000 e4752000 e40a5000 e40a4000 ff00: e41e7000 e41e6000 00000000 00000000 00000000 e423ff14 e423ff14 00000000 ff20: 00000400 804f9080 e5178000 e4db0b40 00000000 e4db0b80 0000047c 00000400 ff40: 00000000 8020758c 00000400 ffffffff 0000008a 00000000 e4db0b40 80206e00 ff60: e4049dbc 00000000 00000000 00000003 e423ffa4 80062978 e41a8bfc 00000000 ff80: 00000000 e4049db4 00000013 e4049db0 00000013 00000000 00000000 00000000 ffa0: e4db0b40 e4db0b40 80204cbc 00000013 00000000 00000000 00000000 80204cfc ffc0: e4049da0 80089544 80040a40 00000000 e4db0b40 00000000 00000000 00000000 ffe0: e423ffe0 e423ffe0 e4049da0 800894c4 80040a40 80040a40 00000000 00000000 [<80043240>] (__bug+0x1c/0x28) from [<80048544>] (___dma_single_dev_to_cpu+0x84) [<80048544>] (___dma_single_dev_to_cpu+0x84/0x94) from [<8039dda0>] (ahash_fina) [<8039dda0>] (ahash_final_ctx+0x180/0x428) from [<8039ce18>] (ahash_final+0xc/0) [<8039ce18>] (ahash_final+0xc/0x10) from [<80203808>] (crypto_ahash_op+0x28/0xc) [<80203808>] (crypto_ahash_op+0x28/0xc0) from [<80207180>] (test_hash+0x214/0x5) [<80207180>] (test_hash+0x214/0x5b8) from [<8020758c>] (alg_test_hash+0x68/0x8c) [<8020758c>] (alg_test_hash+0x68/0x8c) from [<80206e00>] (alg_test+0x7c/0x1b8) [<80206e00>] (alg_test+0x7c/0x1b8) from [<80204cfc>] (cryptomgr_test+0x40/0x48) [<80204cfc>] (cryptomgr_test+0x40/0x48) from [<80089544>] (kthread+0x80/0x88) [<80089544>] (kthread+0x80/0x88) from [<80040a40>] (kernel_thread_exit+0x0/0x8) Code: e59f0010 e1a01003 eb126a8d e3a03000 (e5833000) ---[ end trace d52a403a1d1eaa86 ]--- Cc: stable@vger.kernel.org Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com> Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 6fd4b15603124c1b56e03db29b41ec39d8a077b9)
2015-11-03crypto: caam - enable LARGE_BURST for enhancing DMA transactions sizeHoria Geantă
Increasing CAAM DMA engine transaction size either -reduces the number of required transactions or -adds the ability to transfer more data with same transaction count Signed-off-by: Horia Geantă <horia.geanta@freescale.com>
2015-11-03crypto: caam - make write transactions bufferable on PPC platformsHoria Geantă
Previous change (see "Fixes" tag) to the MCFGR register clears AWCACHE[0] (which is "1" at POR). For PPC-based platforms, this makes all writes non-bufferable, causing a performance drop. Rework previous change such that MCFGR[AWCACHE] is set to: -4'b0001 (default value at POR) for PPC-based platforms -4'b0011 (default value at POR + AWCACHE[1]) for ARM-based platforms Fixes: bcd586241449 ("crypto: caam - fix snooping for write transactions") Signed-off-by: Horia Geantă <horia.geanta@freescale.com>
2015-07-20Merge branch 'qoriq-sdk' into LS1-SDK-Rev2.0jason
2015-07-09crypto: caam - fix SEC ERA readingAlex Porosanu
In order to ensure that the SEC ERA property is properly read from DTS, of_property_read* functions need to be used. Signed-off-by: Alex Porosanu <alexandru.porosanu@freescale.com> Signed-off-by: Horia Geantă <horia.geanta@freescale.com> Change-Id: I3fe958ca9b0ab91c2dbd089d1b2f090042cc3fd0 Reviewed-on: http://git.am.freescale.net:8181/39374 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
2015-07-09crypto: caam - fix snooping for write transactionsHoria Geantă
HW coherency won't work properly for CAAM write transactions if AWCACHE is left to default (POR) value - 4'b0001. It has to be programmed to 4'b0010. For platforms that have HW coherency support: -PPC-based: the update has no effect; CAAM coherency already works due to the IOMMU (PAMU) driver setting the correct memory coherency attributes -ARM-based: the update fixes cache coherency issues, since IOMMU (SMMU) driver is not programmed to behave similar to PAMU Change-Id: I1f91a526c0bdf28b799d19cab9599b115cad55b3 Signed-off-by: Horia Geantă <horia.geanta@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/39256 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com> Tested-by: Zhengxiong Jin <Jason.Jin@freescale.com>
2015-06-04crypto: caam - remove SEC pool channelAlex Porosanu
For improved performance in case of unbalanced flows, all FQs from SEC to cores were added into a pool channel. Adverse effects have been observed for e5500 platforms. This patch removes the creation and subsequent usage of the pool channel. Change-Id: I49dbb93bfede16985fa2ed451cde17e7c2658648 Signed-off-by: Alex Porosanu <alexandru.porosanu@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/37366 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Mircea Pop <mircea.pop@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-06-01crypto: caam - fix size_t print formatHoria Geantă
ARRAY_SIZE() returns a size_t value. Thus, when printing these values, %zu or %zx must be used, or else warnings show up: CC drivers/crypto/caam//caamalg.o In file included from include/linux/thread_info.h:11:0, from include/linux/preempt.h:9, from include/linux/spinlock.h:50, from include/linux/seqlock.h:35, from include/linux/time.h:5, from include/linux/stat.h:18, from include/linux/module.h:10, from drivers/crypto/caam//compat.h:9, from drivers/crypto/caam//caamalg.c:47: drivers/crypto/caam//caamalg.c: In function 'caam_cra_init': include/linux/bug.h:33:45: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=] #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) ^ include/linux/compiler-gcc.h:47:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO' #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) ^ include/linux/kernel.h:41:59: note: in expansion of macro '__must_be_array' #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) ^ drivers/crypto/caam//caamalg.c:4396:13: note: in expansion of macro 'ARRAY_SIZE' op_id, ARRAY_SIZE(digest_size)); ^ CC drivers/crypto/caam//caamhash.o In file included from include/linux/thread_info.h:11:0, from include/linux/preempt.h:9, from include/linux/spinlock.h:50, from include/linux/seqlock.h:35, from include/linux/time.h:5, from include/linux/stat.h:18, from include/linux/module.h:10, from drivers/crypto/caam//compat.h:9, from drivers/crypto/caam//caamhash.c:56: drivers/crypto/caam//caamhash.c: In function 'caam_hash_cra_init': include/linux/bug.h:33:45: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=] #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) ^ include/linux/compiler-gcc.h:47:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO' #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) ^ include/linux/kernel.h:41:59: note: in expansion of macro '__must_be_array' #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) ^ drivers/crypto/caam//caamhash.c:1782:12: note: in expansion of macro 'ARRAY_SIZE' op_id, ARRAY_SIZE(runninglen)); ^ Signed-off-by: Horia Geantă <horia.geanta@freescale.com> Change-Id: Ica005a337d654f7d55eea6f5e5aee911cbd016b2 Reviewed-on: http://git.am.freescale.net:8181/37071 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Tudor-Dan Ambarus <tudor.ambarus@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-05-22crypto: caam/qi - tls10 support for 32bit platformsTudor Ambarus
Tested with tcrypt on p1023rdb platform. Change-Id: Ic19a8d2ed5ce3603d2d9f893736b68eea03d480b Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/36220 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-05-21crypto: caampkc - workaround for erratum A-006899Tudor Ambarus
The problem will occur only in T1040R1. A workaround has been verified; set a Scatter Gather (SG) flag on the Q or G Pointers on KPG, which will give the PKHA unload time to complete. It's sufficient to have the SG flag set for only one of these. Change-Id: I5a403576c6e995110227872c84de7e74da0144c5 Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/36617 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-05-19crypto: caam - fix TLS processing for SEC in LE modeAlex Porosanu
In order to process TLS data that is received in network byte order, a swap is needed for a SEC block working in little endian mode. This is done by using the MOVEB command. Change-Id: I8290ad7348d9e66169c05eff8bda71e587beb0a9 Signed-off-by: Alex Porosanu <alexandru.porosanu@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/36369 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Tudor-Dan Ambarus <tudor.ambarus@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-05-19crypto: caam - add support for MOVEB commandAlex Porosanu
CHAs of SEC work natively in BE mode. When moving data to the alignment blocks, swapping is needed for LE platforms. This is done by means of the MOVEB command (introduced in ERA 7). This patch adds support to DCL for this command. Change-Id: Ie74f2d8a1cf101acd5a23686ff8eb835d1a1f047 Signed-off-by: Alex Porosanu <alexandru.porosanu@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/36365 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Tudor-Dan Ambarus <tudor.ambarus@freescale.com> Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-05-19crypto: caam - tls10 support for 32bit ppc platformsTudor Ambarus
Tested with tcrypt on bsc9132qds platform. Change-Id: Ia8a58b786779e00b267ad3cd2fa05b30d5e17bfb Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/36219 Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com> Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-05-19crypto: caam - fix warning in APPEND_MATH_IMM_u64Tudor Ambarus
An implicit truncation is done when using a variable of 64 bits in MATH command: warning: large integer implicitly truncated to unsigned type [-Woverflow] Silence the compiler by feeding it with an explicit truncated value. Change-Id: I95e3f397f62f9b850c0c7f26e7079b9d9688b87e Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/36218 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-05-13crypto: talitos - avoid memleak in talitos_alg_alloc()Horia Geanta
Change-Id: I0e1cbb1d09eef65fedf75d7c3787898fc5b67f50 Signed-off-by: Horia Geanta <horia.geanta@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/36121 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Tudor-Dan Ambarus <tudor.ambarus@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-05-13crypto: talitos - static code checker fixesHoria Geanta
-change req_ctx->nbuf from u64 to unsigned int to silence checker warnings; this is safe since nbuf value is <= HASH_MAX_BLOCK_SIZE -remove unused value read from TALITOS_CCPSR; there is no requirement to read upper 32b before reading lower 32b of a 64b register; SEC RM mentions: "reads can always be done by byte, word, or dword" -remove unused return value of sg_to_link_tbl() -change "len" parameter of map_single_talitos_ptr(); cpu_to_be16 will __force downcast the value to unsigned short without any checker warning Change-Id: I2245e6a7f5e7d60d3a86b3b68a76a104ba372530 Signed-off-by: Horia Geanta <horia.geanta@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/36124 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Tudor-Dan Ambarus <tudor.ambarus@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-05-13Revert "crypto: talitos - convert to use be16_add_cpu()"Horia Geanta
This reverts commit 7291a932c6e27d9768e374e9d648086636daf61c. The conversion to be16_add_cpu() is incorrect in case cryptlen is negative due to premature (i.e. before addition / subtraction) implicit conversion of cryptlen (int -> u16) leading to sign loss. Change-Id: Iee27eb0881df6f1134f977cbe471cd23479752ce Signed-off-by: Horia Geanta <horia.geanta@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/36123 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Tudor-Dan Ambarus <tudor.ambarus@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-05-13crypto: talitos - avoid out of bound scatterlist iteratorHoria Geanta
Check return value of scatterlist_sg_next(), i.e. don't rely solely on number of bytes to be processed or number of scatterlist entries. Change-Id: I6c10ed15e9a456b87828ebb21cc1121c7041be7d Signed-off-by: Horia Geanta <horia.geanta@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/36122 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Tudor-Dan Ambarus <tudor.ambarus@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-04-30crypto: caam - don't emit ICV check failures to dmesgKim Phillips
ICV check failures are part of normal operation; leave user notification up to the higher levels, as is done in s/w algorithm implementations. Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Tested-by: Cristian Stoica <cristian.stoica@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 3f80be023900790d029a63e27440f1e33c048b73) Change-Id: I6b181dd09e915cf639691cb3d696ddc22ac5f195 Reviewed-on: http://git.am.freescale.net:8181/31647 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com> Reviewed-by: Mircea Pop <mircea.pop@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-04-16caam: remove dependencies on QI when it is disabledCristian Stoica
The dependency on CAAM-QI was incorrectly set on FSL_QMAN and resulted in an always-enabled CAAM-QI on DPAA platforms. This patch fixes the dependency and allows CAAM-QI interface to be freely disabled on DPAA platforms. Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com> Change-Id: Iaf752ae8774a7b03383244a6c9fbbadd9959f3d4 Reviewed-on: http://git.am.freescale.net:8181/34732 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-04-01crypto: caam - change QI memory allocation on hotpathAlex Porosanu
This patch changes the allocation of memory on the hotpath, by replacing the malloc allocation with a kmem_cache backed allocation. Change-Id: I55a21bb7cbd022f6b86bd784988491b551a0f81e Signed-off-by: Alex Porosanu <alexandru.porosanu@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/31371 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Mircea Pop <mircea.pop@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-04-01crypto: caam - cleanup caamalg_qiAlex Porosanu
This patch synchronizez the QI shared descriptors creation with the corresponding JR ones, as well as cleaning up the unused parameters of the *edesc_alloc() functions. While here, also fix a formatting error in cra_init(). Change-Id: Ic5bae734e4a6e6dcb329f7e9530422b9f8cc0377 Signed-off-by: Alex Porosanu <alexandru.porosanu@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/31370 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Mircea Pop <mircea.pop@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-03-31crypto: caam - add useful prints for debuggingAlex Porosanu
This patch adds some output from the CAAM QI driver so the engineer can gain some insight on some of the internals of the driver. Normally, this information should reside in debug fs, but for now it's guarded by the DEBUG define. Change-Id: Ic6b7e570bc8fcedd758fb4163e15c94544e47130 Signed-off-by: Alex Porosanu <alexandru.porosanu@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/31369 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-03-31crypto: caam - remove list lookup of requestsAlex Porosanu
This patch removes the per-packet lookup of a completed request by adding an opaque after the SG entries in the FD. While here, also the software congestion control is removed and replaced with a proper CGR with a sensible threshold. While here, some very likely branches are decorated. Change-Id: I48f2c71b6ac0d537843a44f8c0627c9b70c77592 Signed-off-by: Alex Porosanu <alexandru.porosanu@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/31368 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Alexandru Marginean <Alexandru.Marginean@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-03-20fsl: Use ccflags-y instead of deprecated EXTRA_CFLAGSWang Dongsheng
This allows users to pass in additional compiler flags through the environment variable EXTRA_CFLAGS, e.g. make EXTRA_CFLAGS=-Wno-error Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com> Change-Id: I36513506ee1671c31bb076e9b73c2e8e2442cf4f Reviewed-on: http://git.am.freescale.net:8181/33146 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-02-13Merge branch 'rtmerge'Scott Wood
Signed-off-by: Scott Wood <scottwood@freescale.com> Conflicts: arch/arm/kvm/mmu.c arch/arm/mm/proc-v7-3level.S arch/powerpc/kernel/vdso32/getcpu.S drivers/crypto/caam/error.c drivers/crypto/caam/sg_sw_sec4.h drivers/usb/host/ehci-fsl.c
2015-02-13Reset to 3.12.37Scott Wood
2014-12-11crypto: caam - fix contiguous case for tls with gcmTudor Ambarus
GCM's expected input sequence is: IV, AAD, text. Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com> Change-Id: I35d03818ec559e607182470f0c78097fa6c63f78 Reviewed-on: http://git.am.freescale.net:8181/25434 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com> Reviewed-by: Mircea Pop <mircea.pop@freescale.com> Reviewed-by: Matthew Weigel <Matthew.Weigel@freescale.com>
2014-12-11crypto: caam: fix encryption with null assoc dataCristian Stoica
This is a fix for caam gcm offloading failure through cryptodev. If assoc data is null, the driver crashes: Modules linked in: cryptodev CPU: 3 PID: 1930 Comm: openssl Not tainted 3.12.19-rt30-QorIQ-SDK-V1.7+gcebf692 #4 task: e9061070 ti: ebe72000 task.ti: ebe72000 NIP: c04ea360 LR: c04eed54 CTR: c04ef530 REGS: ebe73ba0 TRAP: 0300 Not tainted (3.12.19-rt30-QorIQ-SDK-V1.7+gcebf692) MSR: 00029002 <CE,EE,ME> CR: 44242484 XER: 00000000 DEAR: 00000000, ESR: 00000000 GPR00: c04eed54 ebe73c50 e9061070 eb41ea10 00000000 00000001 00000001 00000000 GPR08: 00000020 00000000 00000000 00000002 44242482 10089738 10081750 100633f8 GPR16: 100813fc 00000000 000000d1 ebe73cd8 0000000c bfc8e9c4 bfc8de54 eb41ea10 GPR24: eb896a00 c087dbe0 00000001 00000000 eb41ea10 00000001 00000000 00000000 NIP [c04ea360] dma_map_sg_chained+0x50/0x180 LR [c04eed54] aead_edesc_alloc.constprop.19+0x164/0x940 Call Trace: [ebe73c50] [84244482] 0x84244482 (unreliable) [ebe73c80] [c04eed54] aead_edesc_alloc.constprop.19+0x164/0x940 [ebe73cd0] [c04ef55c] aead_encrypt+0x2c/0xd0 [ebe73d00] [f9523c2c] cryptodev_cipher_encrypt+0xcc/0x140 [cryptodev] [ebe73d10] [f952561c] crypto_auth_run+0x2ec/0xbd0 [cryptodev] [ebe73d80] [f95227a0] cryptodev_ioctl+0x500/0xa10 [cryptodev] [ebe73eb0] [c0107a40] do_vfs_ioctl+0x4d0/0x780 [ebe73f10] [c0107d30] SyS_ioctl+0x40/0x80 [ebe73f40] [c000fbcc] ret_from_syscall+0x0/0x3c --- Exception: c01 at 0xfcc308c LR = 0xfd5f064 Instruction dump: 91810010 7cbd2b78 7cda3378 40de0098 2f830000 41de0138 832300b0 2f9d0000 7f7edb78 3be00000 40dd002c 60000000 <807e0000> 3bff0001 5463003a 4bbe2855 ---[ end trace 08c4f2b427249be6 ]--- Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com> Change-Id: I6554d83dbc9acb089f2dce5ff4f1044642262b03 Reviewed-on: http://git.am.freescale.net:8181/25433 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com> Reviewed-by: Matthew Weigel <Matthew.Weigel@freescale.com>
2014-12-11crypto: caam - add support for rfc4543(gcm(aes))Tudor Ambarus
Add AES-GMAC as an IPSec ESP mechanism to provide data origin authentication, but not confidentiality. This method is referred as ENCR_NULL_AUTH_AES_GMAC. Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 5d0429a30f06845af78a696de59e3e8d21252846) Specify the lowest (compatible) SEC Era on which the descriptors can run. Change-Id: If17a51a41c06dedf5b3589311d2677d522b4a209 Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/23481 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com> Reviewed-by: Richard Schmitt <richard.schmitt@freescale.com>
2014-12-11crypto: caam - fix output sequence contiguity checkTudor Ambarus
This patch fixes the assumption that output sequence is not contiguous when input sequence is not contiguous and in-place encryption is done. Output sequence does not need to be contiguous with associated data. Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 19167bfd8ae72ceeb41930343227bf8f5fb19a66) Change-Id: I55797558a79c8113c7e299198f94caea6a0d10b5 Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/23480 Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com> Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Richard Schmitt <richard.schmitt@freescale.com>
2014-12-11crypto: caam - add support for rfc4106(gcm(aes))Tudor Ambarus
Add Advanced Encryption Standard (AES) in Galois/Counter Mode (GCM) as an IPsec Encapsulating Security Payload (ESP) mechanism to provide confidentiality and data origin authentication. Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit bac68f2c9a43e60a70e27c0c75aaca7128b6271d) Specify the lowest (compatible) SEC Era on which the descriptors can run. Change-Id: I9054cb203f3f3acad5853ba973bb549ff1d2e10c Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/23479 Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com> Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Richard Schmitt <richard.schmitt@freescale.com>
2014-12-11crypto: caam - add support for gcm(aes)Tudor Ambarus
Add support for AES working in Galois Counter Mode. There is a limitation related to IV size, similar to the one present in SW implementation (crypto/gcm.c): The only IV size allowed is 12 bytes. It will be padded by HW to the right with 0x0000_0001 (up to 16 bytes - AES block size), according to the GCM specification. Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com> Signed-off-by: Horia Geanta <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 3ef8d945d0dafd272e77c01099bc4975c5297a5a) Conflicts: drivers/crypto/caam/caamalg.c Specify the lowest (compatible) SEC Era on which the descriptors can run. Change-Id: Ic6e0695192a4b9cfcc388e0ce31ec50741f5e339 Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/23478 Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com> Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Richard Schmitt <richard.schmitt@freescale.com>
2014-12-11Revert "crypto: caam - add support for gcm(aes)"Tudor Ambarus
This reverts commit 8901a6c015c66cecd70b301f58bab9fc68a11d69. The upstream version of gcm support contains some fixes that current version does not include. The removal of gcm support from caam driver will be followed by the cherry-pick of upstream's gcm patch. Change-Id: Ic8de49a977beae9cd15eb860e9f6e18695886d98 Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/23477 Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com> Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Richard Schmitt <richard.schmitt@freescale.com>
2014-12-11Revert "crypto: caam - fix key typo in gcm descriptors"Tudor Ambarus
This reverts commit 47a0ea3dc8b50056f8dd39afb438d362d5f5ea45. The upstream version of gcm support contains some fixes that current version does not include. The removal of gcm support from caam driver will be followed by the cherry-pick of upstream's gcm patch. Change-Id: I1fcd770e7f15326a18a2fb18bc8efb40abbe5246 Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/23476 Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com> Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Richard Schmitt <richard.schmitt@freescale.com>
2014-12-11crypto: caampkc: remove inclusion of unused headerCristian Stoica
Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com> Change-Id: I7983c1cdc0d19fd738b251de3c0374e9e67cf617 Reviewed-on: http://git.am.freescale.net:8181/19800 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Richard Schmitt <richard.schmitt@freescale.com>
2014-12-11crypto: caam: remove dead codeCristian Stoica
- assoc_nents and src_nents are never zero when all_contig is false - iv_contig is zero on the else branch Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com> Change-Id: Iccd420733cac736e92c1f9b0cb8fb83fd39b40e4 Reviewed-on: http://git.am.freescale.net:8181/19799 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Richard Schmitt <richard.schmitt@freescale.com>
2014-12-11crypto: caam: remove unused local variablesCristian Stoica
Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com> Change-Id: I7cd10343879e4b51c50b2c4058aad76374831e91 Reviewed-on: http://git.am.freescale.net:8181/19797 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Richard Schmitt <richard.schmitt@freescale.com>
2014-12-11Merge remote-tracking branch 'b18196/fix_error_reporting'Rich Schmitt
2014-12-11crypto: caam - fix error reportingCristian Stoica
The error code returned by hardware is four bits wide with an expected zero MSB. A hardware error condition where the error code can get between 0x8 and 0xf will trigger an out of bound array access on the error message table. This patch fixes the invalid array access following such an error and reports the condition. Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 49783d0f54219e1c68eac738fdd3244b7a6cbda7)
2014-12-11crypto: caam - Fix the 'quoted string split across lines'Marek Vasut
Fix the checkpatch warnings that the strings were split across multiple lines. Checkpatch now complains about lines over 80, but this is better, since we can actually grep the source code for these strings now. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Horia Geanta <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit da37503d37bb6ae72cca0b4d729c153f04b9f0cc)
2014-12-11crypto: caam - Sweep the remnantsMarek Vasut
Clean up the remnants from the rework. Constify function arguments. Note that checkpatch again complains about this space before newline, but this is the original code behavior, so I'm keeping it. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Horia Geanta <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit e397ee0f2242a5f316906e1ff05f8669791b4e2c)
2014-12-11crypto: caam - Kill SPRINTFCAT() with fireMarek Vasut
This macro is just like an encyclopedia of string handling done wrong. This must die. This is so wrong on so many levels. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Horia Geanta <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit e22cdcfa13d9799ea46245946ae09b4a328ff27d)
2014-12-11crypto: caam - Clean up report_deco_status()Marek Vasut
Clean this function up and rework it into sensible shape. This function now contains one single dev_err() instead of the previous insanity full of memory allocation, chaotic string handling and use of SPRINTFCAT(). Signed-off-by: Marek Vasut <marex@denx.de> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Horia Geanta <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 4f0fa52a5d89d763423cb9b428e988ea824fd95a)
2014-12-11crypto: caam - Clean up report_ccb_status()Marek Vasut
Clean this function up and rework it into sensible shape. This function now contains one single dev_err() instead of the previous insanity full of memory allocation, possible stack overwriting, chaotic string handling and use of SPRINTFCAT(). Signed-off-by: Marek Vasut <marex@denx.de> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Horia Geanta <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 1e16322da45b747c753162e421b7a1b25259377a)
2014-12-11crypto: caam - Dissolve report_jump_idx()Marek Vasut
Just dissolve this function so it's not in the way of applying further white magic cleanup down the line. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Horia Geanta <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 526243cc872398ed8139a52ee0bf7715a3abcf31)
2014-12-11crypto: caam - Kill the easy targetsMarek Vasut
Fix the functions which can be obviously done right with a simple dev_err() now. While at it, further press the on-stack allocation of buffer for sprintf() voodoo down into the abominated functions. This patch cleans up most of the functions and leaves just two remaining functions, report_ccb_status() and report_deco_status() ugly and unhappy. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Horia Geanta <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit e75880dd9afb60ff59efe079ac50ccc16daffe54)