summaryrefslogtreecommitdiff
path: root/net/bluetooth/ecdh_helper.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2017-04-30 06:51:41 -0700
committerJohan Hedberg <johan.hedberg@intel.com>2017-04-30 16:52:43 +0300
commit71653eb64bcca6110c42aadfd50b8d54d3a88079 (patch)
treeb74aeafc0a4d4d68129c01a037ef58f5b8563603 /net/bluetooth/ecdh_helper.c
parentf958315358bc37aede49dc3cd7e27e037994ae84 (diff)
Bluetooth: Add selftest for ECDH key generation
Since the ECDH key generation takes a different path, it needs to be tested as well. For this generate the public debug key from the private debug key and compare both. This also moves the seeding of the private key into the SMP calling code to allow for easier re-use of the ECDH key generation helper. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/ecdh_helper.c')
-rw-r--r--net/bluetooth/ecdh_helper.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/net/bluetooth/ecdh_helper.c b/net/bluetooth/ecdh_helper.c
index 2a65ca3fa8fa..24d4e60f8c48 100644
--- a/net/bluetooth/ecdh_helper.c
+++ b/net/bluetooth/ecdh_helper.c
@@ -22,7 +22,6 @@
*/
#include "ecdh_helper.h"
-#include <linux/random.h>
#include <linux/scatterlist.h>
#include <crypto/kpp.h>
#include <crypto/ecdh.h>
@@ -181,8 +180,6 @@ bool generate_ecdh_keys(u8 public_key[64], u8 private_key[32])
if (tries++ >= max_tries)
goto free_all;
- get_random_bytes(private_key, 32);
-
/* Set private Key */
p.key = (char *)private_key;
crypto_ecdh_encode_key(buf, buf_len, &p);