* [PATCH 1/1] shared/ecc: Allow pre-composed Private Keys
@ 2018-04-23 22:20 Brian Gix
0 siblings, 0 replies; only message in thread
From: Brian Gix @ 2018-04-23 22:20 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Brian Gix
If a non-Zero private_key is passed as input to ecc_make_key(),
the incoming private_key is attempted, before falling back
to an ephemeral key. We need to be able to use non-ephemeral
keys in Mesh.
---
src/shared/ecc.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/shared/ecc.c b/src/shared/ecc.c
index eb2cc005d..ee592b91b 100644
--- a/src/shared/ecc.c
+++ b/src/shared/ecc.c
@@ -863,8 +863,12 @@ bool ecc_make_key(uint8_t public_key[64], uint8_t private_key[32])
unsigned tries = 0;
do {
- if (!get_random_number(priv) || (tries++ >= MAX_TRIES))
- return false;
+ if (tries++ == 0)
+ ecc_bytes2native(private_key, priv);
+ else {
+ if (!get_random_number(priv) || (tries >= MAX_TRIES))
+ return false;
+ }
if (vli_is_zero(priv))
continue;
--
2.14.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-04-23 22:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-23 22:20 [PATCH 1/1] shared/ecc: Allow pre-composed Private Keys Brian Gix
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).