Ensure return value of secure_random_init is always checked

This commit is contained in:
Robert Müller 2024-05-26 11:59:24 +02:00
parent 9bd5aacc2b
commit 583845fc60
3 changed files with 11 additions and 3 deletions

View file

@ -2637,7 +2637,7 @@ void generate_password(char *buffer, unsigned length, const unsigned short *rand
*
* @return `0` on success.
*/
int secure_random_init();
[[nodiscard]] int secure_random_init();
/**
* Uninitializes the secure random module.

View file

@ -6,8 +6,12 @@ int main(int argc, const char **argv)
{
CCmdlineFix CmdlineFix(&argc, &argv);
secure_random_init();
log_set_global_logger_default();
if(secure_random_init() != 0)
{
log_error("stun", "could not initialize secure RNG");
return -1;
}
if(argc < 2)
{

View file

@ -11,8 +11,12 @@ int main(int argc, const char **argv)
{
CCmdlineFix CmdlineFix(&argc, &argv);
secure_random_init();
log_set_global_logger_default();
if(secure_random_init() != 0)
{
log_error("twping", "could not initialize secure RNG");
return -1;
}
net_init();
NETADDR BindAddr;