gcry_create_nonce after a snapshot or checkpoint restore

Yuxiang Ji kurath0307 at icloud.com
Wed Nov 4 14:50:21 CET 2026


Hello,

Thank you for the patch. The existing control is fine for our case;
we do not need a new one.

We applied the patch to 1.12.2 and ran the unshare-then-fork
reproducer, in which parent and child are both pid 1. In 32 runs of
each case, this is how often the child's nonce equalled the parent's:

  without the patch, no call                         32 of 32
  without the patch, the control in the child        32 of 32
  with the patch, no call                            32 of 32
  with the patch, the control in the child            0 of 32
  with the patch, the control in both processes       0 of 32

make check passes with the patch.

One suggestion for the manual. Its entry for GCRYCTL_CLOSE_RANDOM_DEVICE
says only that the control closes the random device after fork(), so
an application looking for a way to reseed would not find it there.
Once the patch is in, a sentence could say that the control also makes
gcry_create_nonce re-initialise its state, and that an application
should call it in a child that keeps its parent's pid, and after its
process or virtual machine is restored from a snapshot or checkpoint.
We are glad to send that as a patch to doc/gcrypt.texi.

Best regards,
Yuxiang Ji


More information about the Gcrypt-devel mailing list