In the RNGs of libgcrypt, process-fork detection is implemented for gcry_create_nonce and CSPRNG and DRBG.
But it's not only fork system call. When an application is notified by VM forking (or something), it may want to reseed or control RNG (of libgcrypt).
Application would use GCRYCTL_CLOSE_RANDOM_DEVICE control, but currently, it doesn't affect the buffer of gcry_create_nonce.
Possibly, it would be better do following changes:
- Add documentation to use GCRYCTL_CLOSE_RANDOM_DEVICE for an application to re-initialize random number generation, including gcry_create_nonce (under the situation, say, VM forking)
- Fix _gcry_create_nonce implementation to have nonce_buffer_initialized can be cleared by say, _gcry_nonce_buffer_fini
- Fix _gcry_random_close_fds to call _gcry_nonce_buffer_fini