<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/crypto/caam/caamalg.c, branch linux-4.16.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.16.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.16.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2018-06-16T07:43:45Z</updated>
<entry>
<title>crypto: caam - fix IV DMA mapping and updating</title>
<updated>2018-06-16T07:43:45Z</updated>
<author>
<name>Horia Geantă</name>
</author>
<published>2018-03-28T12:39:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=139cfd6df3470f80b61cda0a1e6eaa26643ff1b3'/>
<id>urn:sha1:139cfd6df3470f80b61cda0a1e6eaa26643ff1b3</id>
<content type='text'>
commit 115957bb3e59fcb226ce76b97af14533f239e0ac upstream.

There are two IV-related issues:
(1) crypto API does not guarantee to provide an IV buffer that is DMAable,
thus it's incorrect to DMA map it
(2) for in-place decryption, since ciphertext is overwritten with
plaintext, updated req-&gt;info will contain the last block of plaintext
(instead of the last block of ciphertext)

While these two issues could be fixed separately, it's straightforward
to fix both in the same time - by allocating extra space in the
ablkcipher_edesc for the IV that will be fed to the crypto engine;
this allows for fixing (2) by saving req-&gt;src[last_block] in req-&gt;info
directly, i.e. without allocating another temporary buffer.

A side effect of the fix is that it's no longer possible to have the IV
and req-&gt;src contiguous. Code checking for this case is removed.

Cc: &lt;stable@vger.kernel.org&gt; # 4.13+
Fixes: 854b06f76879 ("crypto: caam - properly set IV after {en,de}crypt")
Link: http://lkml.kernel.org/r/20170113084620.GF22022@gondor.apana.org.au
Reported-by: Gilad Ben-Yossef &lt;gilad@benyossef.com&gt;
Signed-off-by: Horia Geantă &lt;horia.geanta@nxp.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>crypto: caam - fix DMA mapping dir for generated IV</title>
<updated>2018-06-16T07:43:45Z</updated>
<author>
<name>Horia Geantă</name>
</author>
<published>2018-03-28T12:39:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e7a076f2fdd03955737a979aa918f177b33e2685'/>
<id>urn:sha1:e7a076f2fdd03955737a979aa918f177b33e2685</id>
<content type='text'>
commit a38acd236cac914aafffd80af79b9556fc2c3934 upstream.

In case of GIVCIPHER, IV is generated by the device.
Fix the DMA mapping direction.

Cc: &lt;stable@vger.kernel.org&gt; # 3.19+
Fixes: 7222d1a34103 ("crypto: caam - add support for givencrypt cbc(aes) and rfc3686(ctr(aes))")
Signed-off-by: Horia Geantă &lt;horia.geanta@nxp.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>crypto: caam - add Derived Key Protocol (DKP) support</title>
<updated>2017-12-28T06:56:48Z</updated>
<author>
<name>Horia Geantă</name>
</author>
<published>2017-12-19T10:16:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7e0880b9fbbe7d21e29347020bef0b7329cb0e9d'/>
<id>urn:sha1:7e0880b9fbbe7d21e29347020bef0b7329cb0e9d</id>
<content type='text'>
Offload split key generation in CAAM engine, using DKP.
DKP is supported starting with Era 6.

Note that the way assoclen is transmitted from the job descriptor
to the shared descriptor changes - DPOVRD register is used instead
of MATH3 (where available), since DKP protocol thrashes the MATH
registers.

The replacement of MDHA split key generation with DKP has the side
effect of the crypto engine writing the authentication key, and thus
the DMA mapping direction for the buffer holding the key has to change
from DMA_TO_DEVICE to DMA_BIDIRECTIONAL.
There are two cases:
-key is inlined in descriptor - descriptor buffer mapping changes
-key is referenced - key buffer mapping changes

Signed-off-by: Horia Geantă &lt;horia.geanta@nxp.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: caam - remove needless ablkcipher key copy</title>
<updated>2017-12-28T06:56:47Z</updated>
<author>
<name>Horia Geantă</name>
</author>
<published>2017-12-19T10:16:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=662f70ede5975ce68a1c3524c9fa080c44a38b44'/>
<id>urn:sha1:662f70ede5975ce68a1c3524c9fa080c44a38b44</id>
<content type='text'>
ablkcipher shared descriptors are relatively small, thus there is enough
space for the key to be inlined.
Accordingly, there is no need to copy the key in ctx-&gt;key.

Signed-off-by: Horia Geantă &lt;horia.geanta@nxp.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: caam - Use GCM IV size constant</title>
<updated>2017-09-22T09:43:09Z</updated>
<author>
<name>Corentin LABBE</name>
</author>
<published>2017-08-22T08:08:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7545e166535b349cc4dadea19cf9ee9494563182'/>
<id>urn:sha1:7545e166535b349cc4dadea19cf9ee9494563182</id>
<content type='text'>
This patch replace GCM IV size value by their constant name.

Signed-off-by: Corentin Labbe &lt;clabbe.montjoie@gmail.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: caam/qi - fix compilation with DEBUG enabled</title>
<updated>2017-07-18T10:16:00Z</updated>
<author>
<name>Horia Geantă</name>
</author>
<published>2017-07-10T05:40:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=972b812bd1e17cb0a9112f565951795f886fcc94'/>
<id>urn:sha1:972b812bd1e17cb0a9112f565951795f886fcc94</id>
<content type='text'>
caam/qi driver does not compile when DEBUG is enabled
(CRYPTO_DEV_FSL_CAAM_DEBUG=y):

drivers/crypto/caam/caamalg_qi.c: In function 'ablkcipher_done':
drivers/crypto/caam/caamalg_qi.c:794:2: error: implicit declaration of function 'dbg_dump_sg' [-Werror=implicit-function-declaration]
  dbg_dump_sg(KERN_ERR, "dst    @" __stringify(__LINE__)": ",

Since dbg_dump_sg() is shared between caam/jr and caam/qi, move it
in a shared location and export it.

At the same time:
-reduce ifdeferry by providing a no-op implementation for !DEBUG case
-rename it to caam_dump_sg() to be consistent in terms of
exported symbols namespace (caam_*)

Cc: &lt;stable@vger.kernel.org&gt;
Fixes: b189817cf789 ("crypto: caam/qi - add ablkcipher and authenc algorithms")
Signed-off-by: Horia Geantă &lt;horia.geanta@nxp.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: caam - properly set IV after {en,de}crypt</title>
<updated>2017-07-12T10:38:07Z</updated>
<author>
<name>David Gstir</name>
</author>
<published>2017-06-28T13:27:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=854b06f768794cd664886ec3ba3a5b1c58d42167'/>
<id>urn:sha1:854b06f768794cd664886ec3ba3a5b1c58d42167</id>
<content type='text'>
Certain cipher modes like CTS expect the IV (req-&gt;info) of
ablkcipher_request (or equivalently req-&gt;iv of skcipher_request) to
contain the last ciphertext block when the {en,de}crypt operation is done.
This is currently not the case for the CAAM driver which in turn breaks
e.g. cts(cbc(aes)) when the CAAM driver is enabled.

This patch fixes the CAAM driver to properly set the IV after the
{en,de}crypt operation of ablkcipher finishes.

This issue was revealed by the changes in the SW CTS mode in commit
0605c41cc53ca ("crypto: cts - Convert to skcipher")

Cc: &lt;stable@vger.kernel.org&gt; # 4.8+
Signed-off-by: David Gstir &lt;david@sigma-star.at&gt;
Reviewed-by: Horia Geantă &lt;horia.geanta@nxp.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: caam - fix gfp allocation flags (part II)</title>
<updated>2017-06-22T08:47:23Z</updated>
<author>
<name>Horia Geantă</name>
</author>
<published>2017-06-19T08:44:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=019d62db54017f4639fd7d4f6592f5a116a16695'/>
<id>urn:sha1:019d62db54017f4639fd7d4f6592f5a116a16695</id>
<content type='text'>
This is the 2nd part of fixing the usage of GFP_KERNEL for memory
allocations, taking care off all the places that haven't caused a real
problem / failure.
Again, the issue being fixed is that GFP_KERNEL should be used only when
MAY_SLEEP flag is set, i.e. MAY_BACKLOG flag usage is orthogonal.

Signed-off-by: Horia Geantă &lt;horia.geanta@nxp.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: caam - fix gfp allocation flags (part I)</title>
<updated>2017-06-22T08:47:22Z</updated>
<author>
<name>Horia Geantă</name>
</author>
<published>2017-06-19T08:44:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=42cfcafb91dabb0f9d9e08396c39824535948c67'/>
<id>urn:sha1:42cfcafb91dabb0f9d9e08396c39824535948c67</id>
<content type='text'>
Changes in the SW cts (ciphertext stealing) code in
commit 0605c41cc53ca ("crypto: cts - Convert to skcipher")
revealed a problem in the CAAM driver:
when cts(cbc(aes)) is executed and cts runs in SW,
cbc(aes) is offloaded in CAAM; cts encrypts the last block
in atomic context and CAAM incorrectly decides to use GFP_KERNEL
for memory allocation.

Fix this by allowing GFP_KERNEL (sleeping) only when MAY_SLEEP flag is
set, i.e. remove MAY_BACKLOG flag.

We split the fix in two parts - first is sent to -stable, while the
second is not (since there is no known failure case).

Link: http://lkml.kernel.org/g/20170602122446.2427-1-david@sigma-star.at
Cc: &lt;stable@vger.kernel.org&gt; # 4.8+
Reported-by: David Gstir &lt;david@sigma-star.at&gt;
Signed-off-by: Horia Geantă &lt;horia.geanta@nxp.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: caam/qi - add ablkcipher and authenc algorithms</title>
<updated>2017-03-24T14:02:59Z</updated>
<author>
<name>Horia Geantă</name>
</author>
<published>2017-03-17T10:06:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b189817cf7894e03fd3700acd923221d3007259e'/>
<id>urn:sha1:b189817cf7894e03fd3700acd923221d3007259e</id>
<content type='text'>
Add support to submit ablkcipher and authenc algorithms
via the QI backend:
-ablkcipher:
cbc({aes,des,des3_ede})
ctr(aes), rfc3686(ctr(aes))
xts(aes)
-authenc:
authenc(hmac(md5),cbc({aes,des,des3_ede}))
authenc(hmac(sha*),cbc({aes,des,des3_ede}))

caam/qi being a new driver, let's wait some time to settle down without
interfering with existing caam/jr driver.
Accordingly, for now all caam/qi algorithms (caamalg_qi module) are
marked to be of lower priority than caam/jr ones (caamalg module).

Signed-off-by: Vakul Garg &lt;vakul.garg@nxp.com&gt;
Signed-off-by: Alex Porosanu &lt;alexandru.porosanu@nxp.com&gt;
Signed-off-by: Horia Geantă &lt;horia.geanta@nxp.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
</feed>
