[BACK]Return to kern_entropy.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / kern

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/kern/kern_entropy.c between version 1.13 and 1.14

version 1.13, 2020/05/07 19:05:51 version 1.14, 2020/05/07 19:07:29
Line 172  struct {
Line 172  struct {
 } entropy_global __cacheline_aligned = {  } entropy_global __cacheline_aligned = {
         /* Fields that must be initialized when the kernel is loaded.  */          /* Fields that must be initialized when the kernel is loaded.  */
         .needed = ENTROPY_CAPACITY*NBBY,          .needed = ENTROPY_CAPACITY*NBBY,
         .epoch = (unsigned)-1,  /* -1 means not yet full entropy */          .epoch = (unsigned)-1,  /* -1 means entropy never consolidated */
         .sources = LIST_HEAD_INITIALIZER(entropy_global.sources),          .sources = LIST_HEAD_INITIALIZER(entropy_global.sources),
         .stage = ENTROPY_COLD,          .stage = ENTROPY_COLD,
 };  };
Line 596  entropy_bootrequest(void)
Line 596  entropy_bootrequest(void)
  * entropy_epoch()   * entropy_epoch()
  *   *
  *      Returns the current entropy epoch.  If this changes, you should   *      Returns the current entropy epoch.  If this changes, you should
  *      reseed.  If -1, means the system has not yet reached full   *      reseed.  If -1, means system entropy has not yet reached full
  *      entropy; never reverts back to -1 after full entropy has been   *      entropy or been explicitly consolidated; never reverts back to
  *      reached.  Never zero, so you can always use zero as an   *      -1.  Never zero, so you can always use zero as an uninitialized
  *      uninitialized sentinel value meaning `reseed ASAP'.   *      sentinel value meaning `reseed ASAP'.
  *   *
  *      Usage model:   *      Usage model:
  *   *
Line 1118  entropy_notify(void)
Line 1118  entropy_notify(void)
          * that we're ready so operators can compare it to the timing           * that we're ready so operators can compare it to the timing
          * of other events.           * of other events.
          */           */
         if (E->epoch == (unsigned)-1)          if (__predict_false(!rnd_initial_entropy) && E->needed == 0) {
                 printf("entropy: ready\n");                  printf("entropy: ready\n");
                   rnd_initial_entropy = 1;
           }
   
         /* Set the epoch; roll over from UINTMAX-1 to 1.  */          /* Set the epoch; roll over from UINTMAX-1 to 1.  */
         rnd_initial_entropy = 1; /* XXX legacy */  
         if (__predict_true(!atomic_load_relaxed(&entropy_depletion)) ||          if (__predict_true(!atomic_load_relaxed(&entropy_depletion)) ||
             ratecheck(&lasttime, &interval)) {              ratecheck(&lasttime, &interval)) {
                 epoch = E->epoch + 1;                  epoch = E->epoch + 1;

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

CVSweb <webmaster@jp.NetBSD.org>