1
0

patch-arc4random_c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --- rdate.orig/arc4random.c 2007-05-15 00:15:12.000000000 +0200
  2. +++ rdate/arc4random.c 2014-03-03 07:27:38.000000000 +0100
  3. @@ -30,7 +30,6 @@
  4. #include <sys/param.h>
  5. #include <sys/types.h>
  6. #include <sys/time.h>
  7. -#include <sys/sysctl.h>
  8. #include <fcntl.h>
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. @@ -97,30 +96,6 @@ arc4_stir(struct arc4_stream *as)
  12. if (fd != -1) {
  13. read(fd, rdat.rnd, sizeof(rdat.rnd));
  14. close(fd);
  15. - } else {
  16. - /* /dev/urandom failed? Maybe we're in a chroot. */
  17. -//#if defined(CTL_KERN) && defined(KERN_RANDOM) && defined(RANDOM_UUID)
  18. -#ifdef _LINUX_SYSCTL_H
  19. - /* XXX this is for Linux, which uses enums */
  20. -
  21. - int mib[3];
  22. - size_t i, len;
  23. -
  24. - mib[0] = CTL_KERN;
  25. - mib[1] = KERN_RANDOM;
  26. - mib[2] = RANDOM_UUID;
  27. -
  28. - for (i = 0; i < sizeof(rdat.rnd) / sizeof(u_int); i ++) {
  29. - len = sizeof(u_int);
  30. - if (sysctl(mib, 3, &rdat.rnd[i], &len, NULL, 0) == -1) {
  31. - fprintf(stderr, "warning: no entropy source\n");
  32. - break;
  33. - }
  34. - }
  35. -#else
  36. - /* XXX kFreeBSD doesn't seem to have KERN_ARND or so */
  37. - ;
  38. -#endif
  39. }
  40. arc4_stir_pid = getpid();