Race condition in key manager
tzubcic-tolar opened this issue · comments
aleth/libethcore/KeyManager.cpp
Line 357 in a3b9320
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, thep
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
.
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.