gcry_create_nonce after a snapshot or checkpoint restore

NIIBE Yutaka gniibe at fsij.org
Fri Oct 30 08:25:56 CET 2026


Hello,

Currently, my focus is how we can fix/modify libgcrypt to be friendly to
your use case.

Yuxiang Ji <kurath0307 at icloud.com> wrote:
> 2. On GCRYCTL_CLOSE_RANDOM_DEVICE: extending it would keep the API as it
> is, and an application that already calls it before a fork would only
> get an extra reseed. Its manual entry speaks of fork without exec, so
> the new use would need a sentence there, or a control whose name says
> reseed.

Yes, if we can add another one, something like GCRYCTL_RESEED_RANDOM is
better.  If we really want to keep existing API with no change,
extending the semantics and use of GCRYCTL_CLOSE_RANDOM_DEVICE would be
an option.

> 3. The fork that keeps the pid (unshare(CLONE_NEWPID) and fork() in a
> process that is pid 1 of its namespace) needs no restore signal. If a
> pthread_atfork child handler is acceptable in libgcrypt, one that marks
> the nonce buffer for re-randomisation would cover it without a call from
> the application.

I think it would not be a library job to do something with
pthread_atfork, but it's an application to do that.
-- 


More information about the Gcrypt-devel mailing list