<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/crypto/ecdh.c, branch v6.12.80</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2024-04-26T09:26:09+00:00</updated>
<entry>
<title>crypto: ecdh - Initialize ctx-&gt;private_key in proper byte order</title>
<updated>2024-04-26T09:26:09+00:00</updated>
<author>
<name>Stefan Berger</name>
<email>stefanb@linux.ibm.com</email>
</author>
<published>2024-04-18T15:24:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=01474b70a779319db6d3d2d67a7232a7b4202029'/>
<id>urn:sha1:01474b70a779319db6d3d2d67a7232a7b4202029</id>
<content type='text'>
The private key in ctx-&gt;private_key is currently initialized in reverse
byte order in ecdh_set_secret and whenever the key is needed in proper
byte order the variable priv is introduced and the bytes from
ctx-&gt;private_key are copied into priv while being byte-swapped
(ecc_swap_digits). To get rid of the unnecessary byte swapping initialize
ctx-&gt;private_key in proper byte order and clean up all functions that were
previously using priv or were called with ctx-&gt;private_key:

- ecc_gen_privkey: Directly initialize the passed ctx-&gt;private_key with
  random bytes filling all the digits of the private key. Get rid of the
  priv variable. This function only has ecdh_set_secret as a caller to
  create NIST P192/256/384 private keys.

- crypto_ecdh_shared_secret: Called only from ecdh_compute_value with
  ctx-&gt;private_key. Get rid of the priv variable and work with the passed
  private_key directly.

- ecc_make_pub_key: Called only from ecdh_compute_value with
  ctx-&gt;private_key. Get rid of the priv variable and work with the passed
  private_key directly.

Cc: Salvatore Benedetto &lt;salvatore.benedetto@intel.com&gt;
Signed-off-by: Stefan Berger &lt;stefanb@linux.ibm.com&gt;
Acked-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: ecdh - Pass private key in proper byte order to check valid key</title>
<updated>2024-04-26T09:26:09+00:00</updated>
<author>
<name>Stefan Berger</name>
<email>stefanb@linux.ibm.com</email>
</author>
<published>2024-04-18T15:24:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bd955a4e928f4b3a5b5eb983df1726300c90201c'/>
<id>urn:sha1:bd955a4e928f4b3a5b5eb983df1726300c90201c</id>
<content type='text'>
ecc_is_key_valid expects a key with the most significant digit in the last
entry of the digit array. Currently ecdh_set_secret passes a reversed key
to ecc_is_key_valid that then passes the rather simple test checking
whether the private key is in range [2, n-3]. For all current ecdh-
supported curves (NIST P192/256/384) the 'n' parameter is a rather large
number, therefore easily passing this test.

Throughout the ecdh and ecc codebase the variable 'priv' is used for a
private_key holding the bytes in proper byte order. Therefore, introduce
priv in ecdh_set_secret and copy the bytes from ctx-&gt;private_key into
priv in proper byte order by using ecc_swap_digits. Pass priv to
ecc_is_valid_key.

Cc: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Cc: Salvatore Benedetto &lt;salvatore.benedetto@intel.com&gt;
Signed-off-by: Stefan Berger &lt;stefanb@linux.ibm.com&gt;
Acked-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: ecdh - explicitly zeroize private_key</title>
<updated>2024-04-05T07:46:33+00:00</updated>
<author>
<name>Joachim Vandersmissen</name>
<email>git@jvdsn.com</email>
</author>
<published>2024-03-28T16:24:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=73e5984e540a76a2ee1868b91590c922da8c24c9'/>
<id>urn:sha1:73e5984e540a76a2ee1868b91590c922da8c24c9</id>
<content type='text'>
private_key is overwritten with the key parameter passed in by the
caller (if present), or alternatively a newly generated private key.
However, it is possible that the caller provides a key (or the newly
generated key) which is shorter than the previous key. In that
scenario, some key material from the previous key would not be
overwritten. The easiest solution is to explicitly zeroize the entire
private_key array first.

Note that this patch slightly changes the behavior of this function:
previously, if the ecc_gen_privkey failed, the old private_key would
remain. Now, the private_key is always zeroized. This behavior is
consistent with the case where params.key is set and ecc_is_key_valid
fails.

Signed-off-by: Joachim Vandersmissen &lt;git@jvdsn.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: add __init/__exit annotations to init/exit funcs</title>
<updated>2022-09-24T08:14:43+00:00</updated>
<author>
<name>Xiu Jianfeng</name>
<email>xiujianfeng@huawei.com</email>
</author>
<published>2022-09-15T03:36:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=33837be33367172d66d1f2bd6964cc41448e6e7c'/>
<id>urn:sha1:33837be33367172d66d1f2bd6964cc41448e6e7c</id>
<content type='text'>
Add missing __init/__exit annotations to init/exit funcs.

Signed-off-by: Xiu Jianfeng &lt;xiujianfeng@huawei.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: ecc - Move ecc.h to include/crypto/internal</title>
<updated>2021-10-29T13:04:03+00:00</updated>
<author>
<name>Daniele Alessandrelli</name>
<email>daniele.alessandrelli@intel.com</email>
</author>
<published>2021-10-20T10:35:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a745d3ace3fd65ada44d61dafa64a2a69679ac35'/>
<id>urn:sha1:a745d3ace3fd65ada44d61dafa64a2a69679ac35</id>
<content type='text'>
Move ecc.h header file to 'include/crypto/internal' so that it can be
easily imported from everywhere in the kernel tree.

This change is done to allow crypto device drivers to re-use the symbols
exported by 'crypto/ecc.c', thus avoiding code duplication.

Signed-off-by: Daniele Alessandrelli &lt;daniele.alessandrelli@intel.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: ecdh - register NIST P384 tfm</title>
<updated>2021-05-28T07:11:47+00:00</updated>
<author>
<name>Hui Tang</name>
<email>tanghui20@huawei.com</email>
</author>
<published>2021-05-22T02:44:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8154132521e9cd6d28a7e9778c4ae23b716994bf'/>
<id>urn:sha1:8154132521e9cd6d28a7e9778c4ae23b716994bf</id>
<content type='text'>
Add ecdh_nist_p384_init_tfm and register and unregister P384 tfm.

Signed-off-by: Hui Tang &lt;tanghui20@huawei.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: ecdh - fix 'ecdh_init'</title>
<updated>2021-05-28T07:11:47+00:00</updated>
<author>
<name>Hui Tang</name>
<email>tanghui20@huawei.com</email>
</author>
<published>2021-05-22T02:44:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8fd28fa5046b377039d5bbc0ab2f625dec703980'/>
<id>urn:sha1:8fd28fa5046b377039d5bbc0ab2f625dec703980</id>
<content type='text'>
NIST P192 is not unregistered if failed to register NIST P256,
actually it need to unregister the algorithms already registered.

Signed-off-by: Hui Tang &lt;tanghui20@huawei.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: ecdh - fix ecdh-nist-p192's entry in testmgr</title>
<updated>2021-05-28T07:11:47+00:00</updated>
<author>
<name>Hui Tang</name>
<email>tanghui20@huawei.com</email>
</author>
<published>2021-05-22T02:44:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6889fc2104e5d20899b91e61daf07a7524b2010d'/>
<id>urn:sha1:6889fc2104e5d20899b91e61daf07a7524b2010d</id>
<content type='text'>
Add a comment that p192 will fail to register in FIPS mode.

Fix ecdh-nist-p192's entry in testmgr by removing the ifdefs
and not setting fips_allowed.

Signed-off-by: Hui Tang &lt;tanghui20@huawei.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: ecdh - extend 'cra_driver_name' with curve name</title>
<updated>2021-05-21T08:17:29+00:00</updated>
<author>
<name>Hui Tang</name>
<email>tanghui20@huawei.com</email>
</author>
<published>2021-05-10T08:59:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c5ae16f5c6b91dc78a08885a753489d608de4abd'/>
<id>urn:sha1:c5ae16f5c6b91dc78a08885a753489d608de4abd</id>
<content type='text'>
Currently, 'cra_driver_name' cannot be used to specify ecdh algorithm
with a special curve, so extending it with curve name.

Although using 'cra_name' can also specify a special curve, but ecdh
generic driver cannot be specified when vendor hardware accelerator
has registered.

Fixes: 6763f5ea2d9a ("crypto: ecdh - move curve_id of ECDH from ...")
Signed-off-by: Hui Tang &lt;tanghui20@huawei.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: ecdh - move curve_id of ECDH from the key to algorithm name</title>
<updated>2021-03-12T13:04:03+00:00</updated>
<author>
<name>Meng Yu</name>
<email>yumeng18@huawei.com</email>
</author>
<published>2021-03-04T06:35:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6763f5ea2d9ac9b5a34a374ee637b5e4f1f525dd'/>
<id>urn:sha1:6763f5ea2d9ac9b5a34a374ee637b5e4f1f525dd</id>
<content type='text'>
1. crypto and crypto/atmel-ecc:
   Move curve id of ECDH from the key into the algorithm name instead
   in crypto and atmel-ecc, so ECDH algorithm name change form 'ecdh'
   to 'ecdh-nist-pxxx', and we cannot use 'curve_id' in 'struct ecdh';
2. crypto/testmgr and net/bluetooth:
   Modify 'testmgr.c', 'testmgr.h' and 'net/bluetooth' to adapt
   the modification.

Signed-off-by: Meng Yu &lt;yumeng18@huawei.com&gt;
Reviewed-by: Zaibo Xu &lt;xuzaibo@huawei.com&gt;
Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
</feed>
