Skip to content

urandom is never closed #33

@marco-palumbi

Description

@marco-palumbi

Hi Daan, I found a little issue here:

fd = open("/dev/urandom", O_RDONLY);

/dev/urandom is opened at each call of the randombytes_linux_randombytes_urandom() but never closed.
I would suggest ether:

  • close at the exit of the function
  • use for fd a static variable initialized to -1 test it and if equal to -1 open the device and assign the descriptor to fd

the last could save some time if the function is called repeatedly

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions