Advertisement
Guest User

rng-tools entropy patch

a guest
Apr 26th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.81 KB | None | 0 0
  1.  
  2. --- rngd.c.orig 2016-06-26 09:20:49.794710463 -0500
  3. +++ rngd.c  2016-06-26 09:45:25.960046722 -0500
  4. @@ -57,6 +57,8 @@
  5.   * Globals
  6.   */
  7.  
  8. +#define KERNEL_INPUT_BYTES 8192
  9. +
  10.  /* Background/daemon mode */
  11.  bool am_daemon;                /* True if we went daemon */
  12.  
  13. @@ -90,10 +92,10 @@ static struct argp_option options[] = {
  14.       "File used for recording daemon PID, and multiple exclusion (default: /var/run/rngd.pid)" },
  15.  
  16.     { "random-step", 's', "nnn", 0,
  17. -     "Number of bytes written to random-device at a time (default: 64)" },
  18. +     "Number of bytes written to random-device at a time (default: 64, 0 <= n <= 8192)" },
  19.  
  20.     { "fill-watermark", 'W', "n", 0,
  21. -     "Do not stop feeding entropy to random-device until at least n bits of entropy are available in the pool (default: 2048), 0 <= n <= 4096" },
  22. +     "Do not stop feeding entropy to random-device until at least n bits of entropy are available in the pool (default: 2048), 0 <= n <= 65536" },
  23.  
  24.     { "quiet", 'q', 0, 0, "Suppress error messages" },
  25.  
  26. @@ -167,7 +169,7 @@ static error_t parse_opt (int key, char
  27.         break;
  28.     case 'W': {
  29.         int n;
  30. -       if ((sscanf(arg, "%i", &n) == 0) || (n < 0) || (n > 4096))
  31. +       if ((sscanf(arg, "%i", &n) == 0) || (n < 0) || (n > 65536))
  32.             argp_usage(state);
  33.         else
  34.             arguments->fill_watermark = n;
  35. @@ -216,7 +218,7 @@ static int update_kernel_random(int rand
  36.     if (fips)
  37.         return 1;
  38.  
  39. -   for (p = buf; p + random_step <= &buf[FIPS_RNG_BUFFER_SIZE];
  40. +   for (p = buf; p + random_step <= &buf[KERNEL_INPUT_BYTES];
  41.          p += random_step) {
  42.         random_add_entropy(p, random_step);
  43.         random_sleep();
  44. @@ -226,7 +228,7 @@ static int update_kernel_random(int rand
  45.  
  46.  static void do_loop(int random_step)
  47.  {
  48. -   unsigned char buf[FIPS_RNG_BUFFER_SIZE];
  49. +   unsigned char buf[KERNEL_INPUT_BYTES];
  50.     int retval = 0;
  51.     int no_work = 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement