diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2009-05-22 14:25:34 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-05-22 14:25:34 -0400 |
commit | e4b636366c00738b9609cda307014d71b1225b7f (patch) | |
tree | 760b67b3624eda62e943e48ce93635c30a5b47bf /drivers/char/random.c | |
parent | b9ed7252d219c1c663944bf03846eabb515dbe75 (diff) | |
parent | 279e677faa775ad16e75c32e1bf4a37f8158bc61 (diff) |
Merge branch 'master' into for-2.6.31
Conflicts:
drivers/block/hd.c
drivers/block/mg_disk.c
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/char/random.c')
-rw-r--r-- | drivers/char/random.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index f824ef8a9273..8c7444857a4b 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -1665,15 +1665,20 @@ EXPORT_SYMBOL(secure_dccp_sequence_number); | |||
1665 | * value is not cryptographically secure but for several uses the cost of | 1665 | * value is not cryptographically secure but for several uses the cost of |
1666 | * depleting entropy is too high | 1666 | * depleting entropy is too high |
1667 | */ | 1667 | */ |
1668 | DEFINE_PER_CPU(__u32 [4], get_random_int_hash); | ||
1668 | unsigned int get_random_int(void) | 1669 | unsigned int get_random_int(void) |
1669 | { | 1670 | { |
1670 | /* | 1671 | struct keydata *keyptr; |
1671 | * Use IP's RNG. It suits our purpose perfectly: it re-keys itself | 1672 | __u32 *hash = get_cpu_var(get_random_int_hash); |
1672 | * every second, from the entropy pool (and thus creates a limited | 1673 | int ret; |
1673 | * drain on it), and uses halfMD4Transform within the second. We | 1674 | |
1674 | * also mix it with jiffies and the PID: | 1675 | keyptr = get_keyptr(); |
1675 | */ | 1676 | hash[0] += current->pid + jiffies + get_cycles(); |
1676 | return secure_ip_id((__force __be32)(current->pid + jiffies)); | 1677 | |
1678 | ret = half_md4_transform(hash, keyptr->secret); | ||
1679 | put_cpu_var(get_random_int_hash); | ||
1680 | |||
1681 | return ret; | ||
1677 | } | 1682 | } |
1678 | 1683 | ||
1679 | /* | 1684 | /* |