Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 196745
b: refs/heads/master
c: e954bc9
h: refs/heads/master
i:
  196743: 7bf52e3
v: v3
  • Loading branch information
Matt Mackall authored and Herbert Xu committed May 20, 2010
1 parent 94b4b86 commit ea2e5c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 921bae54693f26d01fb8e10ee6968b5cd8184551
refs/heads/master: e954bc91bdd4bb08b8325478c5004b24a23a3522
10 changes: 3 additions & 7 deletions trunk/drivers/char/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@
#define INPUT_POOL_WORDS 128
#define OUTPUT_POOL_WORDS 32
#define SEC_XFER_SIZE 512
#define EXTRACT_SIZE 10

/*
* The minimum number of bits of entropy before we wake up a read on
Expand Down Expand Up @@ -414,7 +415,7 @@ struct entropy_store {
unsigned add_ptr;
int entropy_count;
int input_rotate;
__u8 *last_data;
__u8 last_data[EXTRACT_SIZE];
};

static __u32 input_pool_data[INPUT_POOL_WORDS];
Expand Down Expand Up @@ -714,8 +715,6 @@ void add_disk_randomness(struct gendisk *disk)
}
#endif

#define EXTRACT_SIZE 10

/*********************************************************************
*
* Entropy extraction routines
Expand Down Expand Up @@ -862,7 +861,7 @@ static ssize_t extract_entropy(struct entropy_store *r, void *buf,
while (nbytes) {
extract_buf(r, tmp);

if (r->last_data) {
if (fips_enabled) {
spin_lock_irqsave(&r->lock, flags);
if (!memcmp(tmp, r->last_data, EXTRACT_SIZE))
panic("Hardware RNG duplicated output!\n");
Expand Down Expand Up @@ -951,9 +950,6 @@ static void init_std_data(struct entropy_store *r)
now = ktime_get_real();
mix_pool_bytes(r, &now, sizeof(now));
mix_pool_bytes(r, utsname(), sizeof(*(utsname())));
/* Enable continuous test in fips mode */
if (fips_enabled)
r->last_data = kmalloc(EXTRACT_SIZE, GFP_KERNEL);
}

static int rand_initialize(void)
Expand Down

0 comments on commit ea2e5c8

Please sign in to comment.