<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/crypto/ecdh.c, branch linux-4.14.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.14.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.14.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2021-01-12T19:09:09Z</updated>
<entry>
<title>crypto: ecdh - avoid buffer overflow in ecdh_set_secret()</title>
<updated>2021-01-12T19:09:09Z</updated>
<author>
<name>Ard Biesheuvel</name>
</author>
<published>2021-01-02T13:59:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fde4c844a5a5f1c35ecc4c3ef18bdbcce7152e2f'/>
<id>urn:sha1:fde4c844a5a5f1c35ecc4c3ef18bdbcce7152e2f</id>
<content type='text'>
commit 0aa171e9b267ce7c52d3a3df7bc9c1fc0203dec5 upstream.

Pavel reports that commit 17858b140bf4 ("crypto: ecdh - avoid unaligned
accesses in ecdh_set_secret()") fixes one problem but introduces another:
the unconditional memcpy() introduced by that commit may overflow the
target buffer if the source data is invalid, which could be the result of
intentional tampering.

So check params.key_size explicitly against the size of the target buffer
before validating the key further.

Fixes: 17858b140bf4 ("crypto: ecdh - avoid unaligned accesses in ecdh_set_secret()")
Reported-by: Pavel Machek &lt;pavel@denx.de&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Ard Biesheuvel &lt;ardb@kernel.org&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: ecdh - avoid unaligned accesses in ecdh_set_secret()</title>
<updated>2020-12-29T12:47:06Z</updated>
<author>
<name>Ard Biesheuvel</name>
</author>
<published>2020-11-24T10:47:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a27249e80348f4be1b94de0e2189ffeecf879392'/>
<id>urn:sha1:a27249e80348f4be1b94de0e2189ffeecf879392</id>
<content type='text'>
commit 17858b140bf49961b71d4e73f1c3ea9bc8e7dda0 upstream.

ecdh_set_secret() casts a void* pointer to a const u64* in order to
feed it into ecc_is_key_valid(). This is not generally permitted by
the C standard, and leads to actual misalignment faults on ARMv6
cores. In some cases, these are fixed up in software, but this still
leads to performance hits that are entirely avoidable.

So let's copy the key into the ctx buffer first, which we will do
anyway in the common case, and which guarantees correct alignment.

Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Ard Biesheuvel &lt;ardb@kernel.org&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: ecdh - fix concurrency on shared secret and pubkey</title>
<updated>2017-08-03T05:47:22Z</updated>
<author>
<name>Tudor-Dan Ambarus</name>
</author>
<published>2017-07-20T07:37:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=952035baedb15d956d5f25b34287d728c751cac9'/>
<id>urn:sha1:952035baedb15d956d5f25b34287d728c751cac9</id>
<content type='text'>
ecdh_ctx contained static allocated data for the shared secret
and public key.

The shared secret and the public key were doomed to concurrency
issues because they could be shared by multiple crypto requests.

The concurrency is fixed by replacing per-tfm shared secret and
public key with per-request dynamically allocated shared secret
and public key.

Signed-off-by: Tudor Ambarus &lt;tudor.ambarus@microchip.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: ecdh - add privkey generation support</title>
<updated>2017-06-10T04:04:35Z</updated>
<author>
<name>Tudor-Dan Ambarus</name>
</author>
<published>2017-05-30T14:52:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6755fd269d5c100b0eca420db501ae58435efd6e'/>
<id>urn:sha1:6755fd269d5c100b0eca420db501ae58435efd6e</id>
<content type='text'>
Add support for generating ecc private keys.

Generation of ecc private keys is helpful in a user-space to kernel
ecdh offload because the keys are not revealed to user-space. Private
key generation is also helpful to implement forward secrecy.

If the user provides a NULL ecc private key, the kernel will generate it
and further use it for ecdh.

Move ecdh's object files below drbg's. drbg must be present in the kernel
at the time of calling.

Signed-off-by: Tudor Ambarus &lt;tudor.ambarus@microchip.com&gt;
Reviewed-by: Stephan Müller &lt;smueller@chronox.de&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: ecdh - comply with crypto_kpp_maxsize()</title>
<updated>2017-06-10T04:04:28Z</updated>
<author>
<name>Tudor-Dan Ambarus</name>
</author>
<published>2017-05-25T07:18:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d0efb48b8615292e05373caa27854e36e732668b'/>
<id>urn:sha1:d0efb48b8615292e05373caa27854e36e732668b</id>
<content type='text'>
crypto_kpp_maxsize() asks for the output buffer size without
caring for errors. It allways assume that will be called after
a valid setkey. Comply with it and return what he wants.

nbytes has no sense now, remove it and directly return the maxsize.

Signed-off-by: Tudor Ambarus &lt;tudor.ambarus@microchip.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: ecc - rename ecdh_make_pub_key()</title>
<updated>2017-06-10T04:04:26Z</updated>
<author>
<name>Tudor-Dan Ambarus</name>
</author>
<published>2017-05-30T12:37:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7380c56d2fcaa882a0809aad075c3f9fdc3b3c50'/>
<id>urn:sha1:7380c56d2fcaa882a0809aad075c3f9fdc3b3c50</id>
<content type='text'>
Rename ecdh_make_pub_key() to ecc_make_pub_key().
ecdh_make_pub_key() is not dh specific and the reference
to dh is wrong.

Signed-off-by: Tudor Ambarus &lt;tudor.ambarus@microchip.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: ecc - remove unnecessary casts</title>
<updated>2017-06-10T04:04:26Z</updated>
<author>
<name>Tudor-Dan Ambarus</name>
</author>
<published>2017-05-25T07:18:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ad269597107e6dde4810987eebbd075778d0262c'/>
<id>urn:sha1:ad269597107e6dde4810987eebbd075778d0262c</id>
<content type='text'>
ecc software implementation works with chunks of u64 data. There were some
unnecessary casts to u8 and then back to u64 for the ecc keys. This patch
removes the unnecessary casts.

Signed-off-by: Tudor Ambarus &lt;tudor.ambarus@microchip.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: ecc - remove unused function arguments</title>
<updated>2017-06-10T04:04:25Z</updated>
<author>
<name>Tudor-Dan Ambarus</name>
</author>
<published>2017-05-25T07:18:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=099054d735a5e4cfc8e90b03b7422c9b48209d8b'/>
<id>urn:sha1:099054d735a5e4cfc8e90b03b7422c9b48209d8b</id>
<content type='text'>
Signed-off-by: Tudor Ambarus &lt;tudor.ambarus@microchip.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: kpp, (ec)dh - fix typos</title>
<updated>2017-06-10T04:04:25Z</updated>
<author>
<name>Tudor-Dan Ambarus</name>
</author>
<published>2017-05-25T07:18:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c0ca1215dc92ee6a0f975c95a92fb7f9fb31e9e1'/>
<id>urn:sha1:c0ca1215dc92ee6a0f975c95a92fb7f9fb31e9e1</id>
<content type='text'>
While here, add missing argument description (ndigits).

Signed-off-by: Tudor Ambarus &lt;tudor.ambarus@microchip.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: kpp - constify buffer passed to crypto_kpp_set_secret()</title>
<updated>2017-03-09T10:34:27Z</updated>
<author>
<name>Eric Biggers</name>
</author>
<published>2017-02-24T23:46:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5527dfb6ddac2aac98c2939f27840cb47abd5693'/>
<id>urn:sha1:5527dfb6ddac2aac98c2939f27840cb47abd5693</id>
<content type='text'>
Constify the buffer passed to crypto_kpp_set_secret() and
kpp_alg.set_secret, since it is never modified.

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