Commit 90ed1e67 authored by Jason A. Donenfeld's avatar Jason A. Donenfeld

random: rather than entropy_store abstraction, use global

Originally, the RNG used several pools, so having things abstracted out
over a generic entropy_store object made sense. These days, there's only
one input pool, and then an uneven mix of usage via the abstraction and
usage via &input_pool. Rather than this uneasy mixture, just get rid of
the abstraction entirely and have things always use the global. This
simplifies the code and makes reading it a bit easier.
Reviewed-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
parent 8b2d953b
This diff is collapsed.
...@@ -28,80 +28,71 @@ TRACE_EVENT(add_device_randomness, ...@@ -28,80 +28,71 @@ TRACE_EVENT(add_device_randomness,
); );
DECLARE_EVENT_CLASS(random__mix_pool_bytes, DECLARE_EVENT_CLASS(random__mix_pool_bytes,
TP_PROTO(const char *pool_name, int bytes, unsigned long IP), TP_PROTO(int bytes, unsigned long IP),
TP_ARGS(pool_name, bytes, IP), TP_ARGS(bytes, IP),
TP_STRUCT__entry( TP_STRUCT__entry(
__field( const char *, pool_name )
__field( int, bytes ) __field( int, bytes )
__field(unsigned long, IP ) __field(unsigned long, IP )
), ),
TP_fast_assign( TP_fast_assign(
__entry->pool_name = pool_name;
__entry->bytes = bytes; __entry->bytes = bytes;
__entry->IP = IP; __entry->IP = IP;
), ),
TP_printk("%s pool: bytes %d caller %pS", TP_printk("input pool: bytes %d caller %pS",
__entry->pool_name, __entry->bytes, (void *)__entry->IP) __entry->bytes, (void *)__entry->IP)
); );
DEFINE_EVENT(random__mix_pool_bytes, mix_pool_bytes, DEFINE_EVENT(random__mix_pool_bytes, mix_pool_bytes,
TP_PROTO(const char *pool_name, int bytes, unsigned long IP), TP_PROTO(int bytes, unsigned long IP),
TP_ARGS(pool_name, bytes, IP) TP_ARGS(bytes, IP)
); );
DEFINE_EVENT(random__mix_pool_bytes, mix_pool_bytes_nolock, DEFINE_EVENT(random__mix_pool_bytes, mix_pool_bytes_nolock,
TP_PROTO(const char *pool_name, int bytes, unsigned long IP), TP_PROTO(int bytes, unsigned long IP),
TP_ARGS(pool_name, bytes, IP) TP_ARGS(bytes, IP)
); );
TRACE_EVENT(credit_entropy_bits, TRACE_EVENT(credit_entropy_bits,
TP_PROTO(const char *pool_name, int bits, int entropy_count, TP_PROTO(int bits, int entropy_count, unsigned long IP),
unsigned long IP),
TP_ARGS(pool_name, bits, entropy_count, IP), TP_ARGS(bits, entropy_count, IP),
TP_STRUCT__entry( TP_STRUCT__entry(
__field( const char *, pool_name )
__field( int, bits ) __field( int, bits )
__field( int, entropy_count ) __field( int, entropy_count )
__field(unsigned long, IP ) __field(unsigned long, IP )
), ),
TP_fast_assign( TP_fast_assign(
__entry->pool_name = pool_name;
__entry->bits = bits; __entry->bits = bits;
__entry->entropy_count = entropy_count; __entry->entropy_count = entropy_count;
__entry->IP = IP; __entry->IP = IP;
), ),
TP_printk("%s pool: bits %d entropy_count %d caller %pS", TP_printk("input pool: bits %d entropy_count %d caller %pS",
__entry->pool_name, __entry->bits, __entry->bits, __entry->entropy_count, (void *)__entry->IP)
__entry->entropy_count, (void *)__entry->IP)
); );
TRACE_EVENT(debit_entropy, TRACE_EVENT(debit_entropy,
TP_PROTO(const char *pool_name, int debit_bits), TP_PROTO(int debit_bits),
TP_ARGS(pool_name, debit_bits), TP_ARGS( debit_bits),
TP_STRUCT__entry( TP_STRUCT__entry(
__field( const char *, pool_name )
__field( int, debit_bits ) __field( int, debit_bits )
), ),
TP_fast_assign( TP_fast_assign(
__entry->pool_name = pool_name;
__entry->debit_bits = debit_bits; __entry->debit_bits = debit_bits;
), ),
TP_printk("%s: debit_bits %d", __entry->pool_name, TP_printk("input pool: debit_bits %d", __entry->debit_bits)
__entry->debit_bits)
); );
TRACE_EVENT(add_input_randomness, TRACE_EVENT(add_input_randomness,
...@@ -170,36 +161,31 @@ DEFINE_EVENT(random__get_random_bytes, get_random_bytes_arch, ...@@ -170,36 +161,31 @@ DEFINE_EVENT(random__get_random_bytes, get_random_bytes_arch,
); );
DECLARE_EVENT_CLASS(random__extract_entropy, DECLARE_EVENT_CLASS(random__extract_entropy,
TP_PROTO(const char *pool_name, int nbytes, int entropy_count, TP_PROTO(int nbytes, int entropy_count, unsigned long IP),
unsigned long IP),
TP_ARGS(pool_name, nbytes, entropy_count, IP), TP_ARGS(nbytes, entropy_count, IP),
TP_STRUCT__entry( TP_STRUCT__entry(
__field( const char *, pool_name )
__field( int, nbytes ) __field( int, nbytes )
__field( int, entropy_count ) __field( int, entropy_count )
__field(unsigned long, IP ) __field(unsigned long, IP )
), ),
TP_fast_assign( TP_fast_assign(
__entry->pool_name = pool_name;
__entry->nbytes = nbytes; __entry->nbytes = nbytes;
__entry->entropy_count = entropy_count; __entry->entropy_count = entropy_count;
__entry->IP = IP; __entry->IP = IP;
), ),
TP_printk("%s pool: nbytes %d entropy_count %d caller %pS", TP_printk("input pool: nbytes %d entropy_count %d caller %pS",
__entry->pool_name, __entry->nbytes, __entry->entropy_count, __entry->nbytes, __entry->entropy_count, (void *)__entry->IP)
(void *)__entry->IP)
); );
DEFINE_EVENT(random__extract_entropy, extract_entropy, DEFINE_EVENT(random__extract_entropy, extract_entropy,
TP_PROTO(const char *pool_name, int nbytes, int entropy_count, TP_PROTO(int nbytes, int entropy_count, unsigned long IP),
unsigned long IP),
TP_ARGS(pool_name, nbytes, entropy_count, IP) TP_ARGS(nbytes, entropy_count, IP)
); );
TRACE_EVENT(urandom_read, TRACE_EVENT(urandom_read,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment