<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/crypto/caam/caamalg.c, branch linux-4.13.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.13.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.13.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2017-09-09T15:39:22Z</updated>
<entry>
<title>crypto: caam/qi - fix compilation with DEBUG enabled</title>
<updated>2017-09-09T15:39:22Z</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=9808d1a5e20575b07620fcdbadc93ebedf1a593f'/>
<id>urn:sha1:9808d1a5e20575b07620fcdbadc93ebedf1a593f</id>
<content type='text'>
commit 972b812bd1e17cb0a9112f565951795f886fcc94 upstream.

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_*)

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;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&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>
<entry>
<title>crypto: caam - fix DMA API leaks for multiple setkey() calls</title>
<updated>2017-02-15T05:23:41Z</updated>
<author>
<name>Horia Geantă</name>
</author>
<published>2017-02-10T12:07:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bbf2234494afd14a720d61a233c21b95e4261326'/>
<id>urn:sha1:bbf2234494afd14a720d61a233c21b95e4261326</id>
<content type='text'>
setkey() callback may be invoked multiple times for the same tfm.
In this case, DMA API leaks are caused by shared descriptors
(and key for caamalg) being mapped several times and unmapped only once.
Fix this by performing mapping / unmapping only in crypto algorithm's
cra_init() / cra_exit() callbacks and sync_for_device in the setkey()
tfm callback.

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 dma_map_sg() return code</title>
<updated>2017-02-15T05:23:40Z</updated>
<author>
<name>Horia Geantă</name>
</author>
<published>2017-02-10T12:07:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=838e0a89e33a6e15492b8e4d700fc64c21ca3587'/>
<id>urn:sha1:838e0a89e33a6e15492b8e4d700fc64c21ca3587</id>
<content type='text'>
dma_map_sg() might coalesce S/G entries, so use the number of S/G
entries returned by it instead of what sg_nents_for_len() initially
returns.

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 - replace sg_count() with sg_nents_for_len()</title>
<updated>2017-02-15T05:23:39Z</updated>
<author>
<name>Horia Geantă</name>
</author>
<published>2017-02-10T12:07:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fa0c92db1eb818a36c1b837b5f6da7e95b181247'/>
<id>urn:sha1:fa0c92db1eb818a36c1b837b5f6da7e95b181247</id>
<content type='text'>
Replace internal sg_count() function and the convoluted logic
around it with the standard sg_nents_for_len() function.
src_nents, dst_nents now hold the number of SW S/G entries,
instead of the HW S/G table entries.

With this change, null (zero length) input data for AEAD case
needs to be handled in a visible way. req-&gt;src is no longer
(un)mapped, pointer address is set to 0 in SEQ IN PTR command.

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 - check sg_count() return value</title>
<updated>2017-02-15T05:23:39Z</updated>
<author>
<name>Horia Geantă</name>
</author>
<published>2017-02-10T12:07:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fd144d83cc42cfe6c82cba76bc0113dacd53a4d4'/>
<id>urn:sha1:fd144d83cc42cfe6c82cba76bc0113dacd53a4d4</id>
<content type='text'>
sg_count() internally calls sg_nents_for_len(), which could fail
in case the required number of bytes is larger than the total
bytes in the S/G.

Thus, add checks to validate the input.

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 HW S/G in ablkcipher_giv_edesc_alloc()</title>
<updated>2017-02-15T05:23:38Z</updated>
<author>
<name>Horia Geantă</name>
</author>
<published>2017-02-10T12:07:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fd88aac93e4dc7810940e854be1c3dc5adb20120'/>
<id>urn:sha1:fd88aac93e4dc7810940e854be1c3dc5adb20120</id>
<content type='text'>
HW S/G generation does not work properly when the following conditions
are met:
-src == dst
-src/dst is S/G
-IV is right before (contiguous with) the first src/dst S/G entry
since "iv_contig" is set to true (iv_contig is a misnomer here and
it actually refers to the whole output being contiguous)

Fix this by setting dst S/G nents equal to src S/G nents, instead of
leaving it set to init value (0).

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>
