--- /dev/null
+### rndaddtoentcnt
+
+Seeding the random number generator by writing to /dev/urandom does not update the entropy count.
+
+This utility makes the RNDADDTOENTCNT ioctl call needed to do this.
+
+Used in startup scripts after initializing /dev/urandom with a presaved seed.
+
+Example:
+
+ dd if=/path/to/some/random-seed-file of=/dev/urandom bs=512 count=1
+
+ /path/to/rdnaddtoentcnt <entropy-bit-count>
+
+where entropy-bit-count is a number between 1 and (8 * 512) depending on how much you trust the seed file.
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+
+#include <linux/random.h>
+
+
+int main(int argc, char **argv)
+{
+ int count, fd;
+
+ if (argc != 2) {
+ printf("Usage: rndaddtoentcnt <entropy-bit-count>\n");
+ exit(1);
+ }
+
+ count = strtoul(argv[1], NULL, 0);
+
+ if (count < 1 || count > 4096) {
+ printf("Count range is 1 to 4096\n");
+ exit(1);
+ }
+
+ fd = open("/dev/urandom", O_WRONLY);
+
+ if (fd < 0) {
+ perror("open(/dev/urandom)");
+ exit(1);
+ }
+
+
+ if (ioctl(fd, RNDADDTOENTCNT, &count) < 0) {
+ perror("ioctl(RNDADDTOENTCNT)");
+ close(fd);
+ exit(1);
+ }
+
+ close(fd);
+
+ return 0;
+}