Skip to content
  • Thomas Haller's avatar
    core: add nm_utils_random_bytes() and use getrandom() · b01a453c
    Thomas Haller authored
    Add a new function nm_utils_random_bytes().
    
    This function now preferably uses getrandom() syscall if it is
    available.
    
    As fallback, it always tries to fill the buffer from /dev/urandom.
    If it cannot, as last fallback it uses GRand, which cannot fail.
    Hence, the function always sets some (pseudo) random bytes.
    
    It also returns FALSE if the obtained bytes are possibly not good
    randomness.
    b01a453c