Pull Request #17543: review fixes
This commit is contained in:
@@ -206,11 +206,14 @@ error_code sys_ss_get_console_id(vm::ptr<u8> buf)
|
||||
return sys_ss_appliance_info_manager(0x19003, buf);
|
||||
}
|
||||
|
||||
error_code sys_ss_get_open_psid(vm::ptr<u128> psid)
|
||||
error_code sys_ss_get_open_psid(vm::ptr<CellSsOpenPSID> psid)
|
||||
{
|
||||
sys_ss.notice("sys_ss_get_open_psid(psid=*0x%x)", psid);
|
||||
|
||||
*psid = g_cfg.sys.console_psid.get();
|
||||
const u128 configured_psid = g_cfg.sys.console_psid.get();
|
||||
|
||||
psid->high = static_cast<u64>(configured_psid >> 64);
|
||||
psid->low = static_cast<u64>(configured_psid);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@@ -13,10 +13,16 @@ enum sys_ss_rng_error : u32
|
||||
SYS_SS_RTC_ERROR_UNK = 0x8001050f,
|
||||
};
|
||||
|
||||
struct CellSsOpenPSID
|
||||
{
|
||||
be_t<u64> high;
|
||||
be_t<u64> low;
|
||||
};
|
||||
|
||||
error_code sys_ss_random_number_generator(u64 pkg_id, vm::ptr<void> buf, u64 size);
|
||||
error_code sys_ss_access_control_engine(u64 pkg_id, u64 a2, u64 a3);
|
||||
error_code sys_ss_get_console_id(vm::ptr<u8> buf);
|
||||
error_code sys_ss_get_open_psid(vm::ptr<u128> psid);
|
||||
error_code sys_ss_get_open_psid(vm::ptr<CellSsOpenPSID> psid);
|
||||
error_code sys_ss_appliance_info_manager(u32 code, vm::ptr<u8> buffer);
|
||||
error_code sys_ss_get_cache_of_product_mode(vm::ptr<u8> ptr);
|
||||
error_code sys_ss_secure_rtc(u64 cmd, u64 a2, u64 a3, u64 a4);
|
||||
|
||||
@@ -21,10 +21,15 @@ std::string cfg_root::node_sys::get_random_system_name()
|
||||
|
||||
u128 cfg_root::node_sys::get_random_psid()
|
||||
{
|
||||
std::random_device rnd;
|
||||
std::mt19937_64 prng(rnd());
|
||||
std::uniform_int_distribution<u64> uniformDist;
|
||||
u128 result = uniformDist(prng);
|
||||
result += u128{uniformDist(prng)} << 64;
|
||||
// Generate seed for each 32-bits for maximum entropy using Standard Library
|
||||
std::uniform_int_distribution<u32> uniform_dist;
|
||||
std::mt19937 prng;
|
||||
|
||||
u128 result{};
|
||||
prng.seed(std::random_device()()), result += u128{uniform_dist(prng)} << 0;
|
||||
prng.seed(std::random_device()()), result += u128{uniform_dist(prng)} << 32;
|
||||
prng.seed(std::random_device()()), result += u128{uniform_dist(prng)} << 64;
|
||||
prng.seed(std::random_device()()), result += u128{uniform_dist(prng)} << 96;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user