Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Race condition in key manager #5892

Open
tzubcic-tolar opened this issue Feb 21, 2020 · 1 comment
Open

Race condition in key manager #5892

tzubcic-tolar opened this issue Feb 21, 2020 · 1 comment

Comments

@tzubcic-tolar
Copy link

tzubcic-tolar commented Feb 21, 2020

KeyPair KeyManager::newKeyPair(KeyManager::NewKeyType _type)

There are multiple issues with this method:

  • KeyPair p = KeyPair::create(); -- this value is completely ignored
  • If NewKeyType::NoVanity is set, starting threads is pointless and a waste of resources, the p mentioned above can be simply returned immediately.
  • Last, but most important: this is not thread safe. You can end up returning an invalid KeyPair (i.e. where public key does not match private key).

Until this is fixed, I suggest using KeyPair::create() directly instead of KeyManager::newKeyPair.

@chfast
Copy link
Member

chfast commented Mar 26, 2020

Personally, I would not use the key related code for anything. This is barely maintained for long time.
We can integrate a fix if you want to propose one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants