<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/include/crypto/hash.h, branch linux-4.15.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-4.15.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-4.15.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2018-02-16T19:06:48Z</updated>
<entry>
<title>crypto: hash - prevent using keyed hashes without setting key</title>
<updated>2018-02-16T19:06:48Z</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2018-01-03T19:16:27Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=46e8d06e423c4f35eac7a8b677b713b3ec9b0684'/>
<id>urn:sha1:46e8d06e423c4f35eac7a8b677b713b3ec9b0684</id>
<content type='text'>
commit 9fa68f620041be04720d0cbfb1bd3ddfc6310b24 upstream.

Currently, almost none of the keyed hash algorithms check whether a key
has been set before proceeding.  Some algorithms are okay with this and
will effectively just use a key of all 0's or some other bogus default.
However, others will severely break, as demonstrated using
"hmac(sha3-512-generic)", the unkeyed use of which causes a kernel crash
via a (potentially exploitable) stack buffer overflow.

A while ago, this problem was solved for AF_ALG by pairing each hash
transform with a 'has_key' bool.  However, there are still other places
in the kernel where userspace can specify an arbitrary hash algorithm by
name, and the kernel uses it as unkeyed hash without checking whether it
is really unkeyed.  Examples of this include:

    - KEYCTL_DH_COMPUTE, via the KDF extension
    - dm-verity
    - dm-crypt, via the ESSIV support
    - dm-integrity, via the "internal hash" mode with no key given
    - drbd (Distributed Replicated Block Device)

This bug is especially bad for KEYCTL_DH_COMPUTE as that requires no
privileges to call.

Fix the bug for all users by adding a flag CRYPTO_TFM_NEED_KEY to the
-&gt;crt_flags of each hash transform that indicates whether the transform
still needs to be keyed or not.  Then, make the hash init, import, and
digest functions return -ENOKEY if the key is still needed.

The new flag also replaces the 'has_key' bool which algif_hash was
previously using, thereby simplifying the algif_hash implementation.

Reported-by: syzbot &lt;syzkaller@googlegroups.com&gt;
Signed-off-by: Eric Biggers &lt;ebiggers@google.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: doc - clarify return values for async hash methods</title>
<updated>2017-09-22T09:43:03Z</updated>
<author>
<name>Kamil Konieczny</name>
<email>k.konieczny@partner.samsung.com</email>
</author>
<published>2017-08-17T10:11:36Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=560b1a82ee87288c18aca31ee3053272c3737fe5'/>
<id>urn:sha1:560b1a82ee87288c18aca31ee3053272c3737fe5</id>
<content type='text'>
* fix documentation of return values for crypto_ahash_init(),
  crypto_ahash_finup(), crypto_ahash_final(),
  crypto_ahash_digest() and crypto_ahash_update()

Also while at it:

* add notes for device driver developers in struct ahash_alg
  description

* fix description of @final method in struct ahash_alg

* fix typo in crypto_ahash_finup() description

Signed-off-by: Kamil Konieczny &lt;k.konieczny@partner.samsung.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: doc - Fix hash export state information</title>
<updated>2017-02-03T10:16:11Z</updated>
<author>
<name>Rabin Vincent</name>
<email>rabinv@axis.com</email>
</author>
<published>2017-01-26T15:33:00Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=379d972b81151b811ab769db5ab8da9c71bbfb00'/>
<id>urn:sha1:379d972b81151b811ab769db5ab8da9c71bbfb00</id>
<content type='text'>
The documentation states that crypto_ahash_reqsize() provides the size
of the state structure used by crypto_ahash_export().  But it's actually
crypto_ahash_statesize() which provides this size.

Signed-off-by: Rabin Vincent &lt;rabinv@axis.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: doc - fix source comments for Sphinx</title>
<updated>2016-12-13T23:38:05Z</updated>
<author>
<name>Stephan Mueller</name>
<email>smueller@chronox.de</email>
</author>
<published>2016-10-21T02:57:27Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=0184cfe72d2f139c4feed7f3820ba2269f5de322'/>
<id>urn:sha1:0184cfe72d2f139c4feed7f3820ba2269f5de322</id>
<content type='text'>
Update comments to avoid any complaints from Sphinx during compilation.

Signed-off-by: Stephan Mueller &lt;smueller@chronox.de&gt;
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
</entry>
<entry>
<title>crypto: doc - document correct return value for request allocation</title>
<updated>2016-04-15T14:35:44Z</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers3@gmail.com</email>
</author>
<published>2016-04-02T15:54:56Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=6eae29e7e7144d01a6d6af111d232b36cdd30f51'/>
<id>urn:sha1:6eae29e7e7144d01a6d6af111d232b36cdd30f51</id>
<content type='text'>
Signed-off-by: Eric Biggers &lt;ebiggers3@gmail.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: hash - Add helpers to return alg and driver names</title>
<updated>2016-02-06T07:33:13Z</updated>
<author>
<name>Herbert Xu</name>
<email>herbert@gondor.apana.org.au</email>
</author>
<published>2016-02-01T13:36:52Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=d12481bc58fba89427565f8592e88446ec084a24'/>
<id>urn:sha1:d12481bc58fba89427565f8592e88446ec084a24</id>
<content type='text'>
This patch adds helpers to retrieve the alg name and driver name
of crypto_shash and crypto_ahash objects.

Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: hash - Add crypto_has_ahash helper</title>
<updated>2016-01-25T14:42:13Z</updated>
<author>
<name>Herbert Xu</name>
<email>herbert@gondor.apana.org.au</email>
</author>
<published>2016-01-23T05:52:40Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=8d18e34c1fe22418ae0b5475ab0d1956d69ad195'/>
<id>urn:sha1:8d18e34c1fe22418ae0b5475ab0d1956d69ad195</id>
<content type='text'>
This patch adds the helper crypto_has_ahash which should replace
crypto_has_hash.

Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: hash - Add helpers to zero stack request/descriptor</title>
<updated>2016-01-25T14:42:11Z</updated>
<author>
<name>Herbert Xu</name>
<email>herbert@gondor.apana.org.au</email>
</author>
<published>2016-01-22T15:17:58Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=e67ffe0af4d450e95e5f9bb7d081500e30777857'/>
<id>urn:sha1:e67ffe0af4d450e95e5f9bb7d081500e30777857</id>
<content type='text'>
As the size of an ahash_request or shash_desc is variable, it's
awkward to zero them explicitly.  This patch adds helpers to do
that which should be used when they are created on the stack.

Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: hash - Add crypto_ahash_has_setkey</title>
<updated>2016-01-18T10:16:11Z</updated>
<author>
<name>Herbert Xu</name>
<email>herbert@gondor.apana.org.au</email>
</author>
<published>2016-01-08T13:28:26Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=a5596d6332787fd383b3b5427b41f94254430827'/>
<id>urn:sha1:a5596d6332787fd383b3b5427b41f94254430827</id>
<content type='text'>
This patch adds a way for ahash users to determine whether a key
is required by a crypto_ahash transform.

Cc: stable@vger.kernel.org
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: ahash - Add crypto_ahash_blocksize</title>
<updated>2015-10-20T14:10:48Z</updated>
<author>
<name>Herbert Xu</name>
<email>herbert@gondor.apana.org.au</email>
</author>
<published>2015-10-19T01:37:41Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=524e56c31a6fe21e6f6f543360359e7a97dfabfb'/>
<id>urn:sha1:524e56c31a6fe21e6f6f543360359e7a97dfabfb</id>
<content type='text'>
This patch adds the missing helper crypto_ahash_blocksize which
returns the block size of an ahash algorithm.

Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
</feed>
