UI: Add mutex to reading public key file
This commit is contained in:
parent
2c48e61207
commit
5dd1d00a03
1 changed files with 4 additions and 1 deletions
|
|
@ -176,12 +176,15 @@ static void LoadPublicKey(std::string &pubkey)
|
|||
static bool CheckDataSignature(const char *name, const std::string &data,
|
||||
const std::string &hexSig)
|
||||
try {
|
||||
static std::mutex pubkey_mutex;
|
||||
static std::string obsPubKey;
|
||||
|
||||
if (hexSig.empty() || hexSig.length() > 0xFFFF ||
|
||||
(hexSig.length() & 1) != 0)
|
||||
throw strprintf("Missing or invalid signature for %s: %s", name,
|
||||
hexSig.c_str());
|
||||
|
||||
static std::string obsPubKey;
|
||||
std::scoped_lock lock(pubkey_mutex);
|
||||
if (obsPubKey.empty())
|
||||
LoadPublicKey(obsPubKey);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue