mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-24 13:05:53 +00:00
Emit 256 bits of random on RPC server subscribe.
This commit is contained in:
@@ -1307,8 +1307,24 @@ bool NetworkOPs::unsubLedger(InfoSub* ispListener)
|
||||
// <-- bool: true=added, false=already there
|
||||
bool NetworkOPs::subServer(InfoSub* ispListener, Json::Value& jvResult)
|
||||
{
|
||||
uint256 uRandom;
|
||||
|
||||
jvResult["stand_alone"] = theConfig.RUN_STANDALONE;
|
||||
|
||||
switch (RAND_bytes(uRandom.begin(), uRandom.size()))
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
jvResult["random"] = uRandom.ToString();
|
||||
break;
|
||||
|
||||
case -1:
|
||||
default:
|
||||
// XXX Should probably stop running.
|
||||
cLog(lsFATAL) << "Internal error: unable to generate secure random.";
|
||||
break;
|
||||
}
|
||||
|
||||
return mSubServer.insert(ispListener).second;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user