<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/crypto/ahash.c, branch linux-3.15.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.15.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.15.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2014-03-21T13:54:22Z</updated>
<entry>
<title>crypto: hash - Simplify the ahash_finup implementation</title>
<updated>2014-03-21T13:54:22Z</updated>
<author>
<name>Marek Vasut</name>
</author>
<published>2014-03-14T01:37:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d4a7a0fbe959e12bdd071b79b50ed34853a6db8f'/>
<id>urn:sha1:d4a7a0fbe959e12bdd071b79b50ed34853a6db8f</id>
<content type='text'>
The ahash_def_finup() can make use of the request save/restore functions,
thus make it so. This simplifies the code a little and unifies the code
paths.

Note that the same remark about free()ing the req-&gt;priv applies here, the
req-&gt;priv can only be free()'d after the original request was restored.

Finally, squash a bug in the invocation of completion in the ASYNC path.
In both ahash_def_finup_done{1,2}, the function areq-&gt;base.complete(X, err);
was called with X=areq-&gt;base.data . This is incorrect , as X=&amp;areq-&gt;base
is the correct value. By analysis of the data structures, we see the areq is
of type 'struct ahash_request' , areq-&gt;base is of type 'struct crypto_async_request'
and areq-&gt;base.completion is of type crypto_completion_t, which is defined in
include/linux/crypto.h as:

  typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err);

This is one lead that the X should be &amp;areq-&gt;base . Next up, we can inspect
other code which calls the completion callback to give us kind-of statistical
idea of how this callback is used. We can try:

  $ git grep base\.complete\( drivers/crypto/

Finally, by inspecting ahash_request_set_callback() implementation defined
in include/crypto/hash.h , we observe that the .data entry of 'struct
crypto_async_request' is intended for arbitrary data, not for completion
argument.

Signed-off-by: Marek Vasut &lt;marex@denx.de&gt;
Cc: David S. Miller &lt;davem@davemloft.net&gt;
Cc: Fabio Estevam &lt;fabio.estevam@freescale.com&gt;
Cc: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Cc: Shawn Guo &lt;shawn.guo@linaro.org&gt;
Cc: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: hash - Pull out the functions to save/restore request</title>
<updated>2014-03-21T13:54:21Z</updated>
<author>
<name>Marek Vasut</name>
</author>
<published>2014-03-14T01:37:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1ffc9fbd1e5071948b6d48f9a27d845738ee890f'/>
<id>urn:sha1:1ffc9fbd1e5071948b6d48f9a27d845738ee890f</id>
<content type='text'>
The functions to save original request within a newly adjusted request
and it's counterpart to restore the original request can be re-used by
more code in the crypto/ahash.c file. Pull these functions out from the
code so they're available.

Signed-off-by: Marek Vasut &lt;marex@denx.de&gt;
Cc: David S. Miller &lt;davem@davemloft.net&gt;
Cc: Fabio Estevam &lt;fabio.estevam@freescale.com&gt;
Cc: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Cc: Shawn Guo &lt;shawn.guo@linaro.org&gt;
Cc: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: hash - Fix the pointer voodoo in unaligned ahash</title>
<updated>2014-03-21T13:54:20Z</updated>
<author>
<name>Marek Vasut</name>
</author>
<published>2014-03-14T01:37:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ab6bf4e5e5e4298e8649e635bee25542cccbfd97'/>
<id>urn:sha1:ab6bf4e5e5e4298e8649e635bee25542cccbfd97</id>
<content type='text'>
Add documentation for the pointer voodoo that is happening in crypto/ahash.c
in ahash_op_unaligned(). This code is quite confusing, so add a beefy chunk
of documentation.

Moreover, make sure the mangled request is completely restored after finishing
this unaligned operation. This means restoring all of .result, .base.data
and .base.complete .

Also, remove the crypto_completion_t complete = ... line present in the
ahash_op_unaligned_done() function. This type actually declares a function
pointer, which is very confusing.

Finally, yet very important nonetheless, make sure the req-&gt;priv is free()'d
only after the original request is restored in ahash_op_unaligned_done().
The req-&gt;priv data must not be free()'d before that in ahash_op_unaligned_finish(),
since we would be accessing previously free()'d data in ahash_op_unaligned_done()
and cause corruption.

Signed-off-by: Marek Vasut &lt;marex@denx.de&gt;
Cc: David S. Miller &lt;davem@davemloft.net&gt;
Cc: Fabio Estevam &lt;fabio.estevam@freescale.com&gt;
Cc: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Cc: Shawn Guo &lt;shawn.guo@linaro.org&gt;
Cc: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: ahash - Fully restore ahash request before completing</title>
<updated>2014-01-05T12:49:51Z</updated>
<author>
<name>Marek Vasut</name>
</author>
<published>2013-12-10T19:26:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1d9a394b97b833d3ab37f49caf12d0be3c88050b'/>
<id>urn:sha1:1d9a394b97b833d3ab37f49caf12d0be3c88050b</id>
<content type='text'>
When finishing the ahash request, the ahash_op_unaligned_done() will
call complete() on the request. Yet, this will not call the correct
complete callback. The correct complete callback was previously stored
in the requests' private data, as seen in ahash_op_unaligned(). This
patch restores the correct complete callback and .data field of the
request before calling complete() on it.

Signed-off-by: Marek Vasut &lt;marex@denx.de&gt;
Cc: David S. Miller &lt;davem@davemloft.net&gt;
Cc: Fabio Estevam &lt;fabio.estevam@freescale.com&gt;
Cc: Shawn Guo &lt;shawn.guo@linaro.org&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: user - fix info leaks in report API</title>
<updated>2013-02-19T12:27:03Z</updated>
<author>
<name>Mathias Krause</name>
</author>
<published>2013-02-05T17:19:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9a5467bf7b6e9e02ec9c3da4e23747c05faeaac6'/>
<id>urn:sha1:9a5467bf7b6e9e02ec9c3da4e23747c05faeaac6</id>
<content type='text'>
Three errors resulting in kernel memory disclosure:

1/ The structures used for the netlink based crypto algorithm report API
are located on the stack. As snprintf() does not fill the remainder of
the buffer with null bytes, those stack bytes will be disclosed to users
of the API. Switch to strncpy() to fix this.

2/ crypto_report_one() does not initialize all field of struct
crypto_user_alg. Fix this to fix the heap info leak.

3/ For the module name we should copy only as many bytes as
module_name() returns -- not as much as the destination buffer could
hold. But the current code does not and therefore copies random data
from behind the end of the module name, as the module name is always
shorter than CRYPTO_MAX_ALG_NAME.

Also switch to use strncpy() to copy the algorithm's name and
driver_name. They are strings, after all.

Signed-off-by: Mathias Krause &lt;minipli@googlemail.com&gt;
Cc: Steffen Klassert &lt;steffen.klassert@secunet.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: Stop using NLA_PUT*().</title>
<updated>2012-04-02T08:33:42Z</updated>
<author>
<name>David S. Miller</name>
</author>
<published>2012-04-02T00:19:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6662df33f85b87bb29f2ecad124efe7bb2c08e05'/>
<id>urn:sha1:6662df33f85b87bb29f2ecad124efe7bb2c08e05</id>
<content type='text'>
These macros contain a hidden goto, and are thus extremely error
prone and make code hard to audit.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>crypto: remove the second argument of k[un]map_atomic()</title>
<updated>2012-03-20T13:48:16Z</updated>
<author>
<name>Cong Wang</name>
</author>
<published>2011-11-25T15:14:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f0dfc0b0b7f3d961da8a98bcfccc8be9107a848b'/>
<id>urn:sha1:f0dfc0b0b7f3d961da8a98bcfccc8be9107a848b</id>
<content type='text'>
Signed-off-by: Cong Wang &lt;amwang@redhat.com&gt;
</content>
</entry>
<entry>
<title>crypto: algapi - Fix build problem with NET disabled</title>
<updated>2011-11-10T22:57:06Z</updated>
<author>
<name>Herbert Xu</name>
</author>
<published>2011-11-03T12:46:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3acc84739dd5d746840f881ad4d60bd2a428f1dd'/>
<id>urn:sha1:3acc84739dd5d746840f881ad4d60bd2a428f1dd</id>
<content type='text'>
The report functions use NLA_PUT so we need to ensure that NET
is enabled.

Reported-by: Luis Henriques &lt;henrix@camandro.org&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: Add userspace report for ahash type algorithms</title>
<updated>2011-10-21T12:24:04Z</updated>
<author>
<name>Steffen Klassert</name>
</author>
<published>2011-09-27T05:41:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6238cbaec429c98d1a280014839c934107c7c8f6'/>
<id>urn:sha1:6238cbaec429c98d1a280014839c934107c7c8f6</id>
<content type='text'>
Signed-off-by: Steffen Klassert &lt;steffen.klassert@secunet.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: hash - Fix handling of small unaligned buffers</title>
<updated>2010-08-06T01:26:38Z</updated>
<author>
<name>Szilveszter Ördög</name>
</author>
<published>2010-08-06T01:26:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=23a75eee070f1370bee803a34f285cf81eb5f331'/>
<id>urn:sha1:23a75eee070f1370bee803a34f285cf81eb5f331</id>
<content type='text'>
If a scatterwalk chain contains an entry with an unaligned offset then
hash_walk_next() will cut off the next step at the next alignment point.

However, if the entry ends before the next alignment point then we a loop,
which leads to a kernel oops.

Fix this by checking whether the next aligment point is before the end of the
current entry.

Signed-off-by: Szilveszter Ördög &lt;slipszi@gmail.com&gt;
Acked-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
</feed>
