Re: /dev/random in 2.4.6

Alex Bligh - linux-kernel (linux-kernel@alex.org.uk)
Wed, 15 Aug 2001 22:27:55 +0100


Robert,

> Method one, your idea, would have us add SA_SAMPLE_NET_RANDOM to each
> NIC's request_irq call. The random gatherer would then need to be made
> aware of the sysctl and check and add/remove interripts derived from
> NICs as needed. This would require a bit of recoding (take a look at
> request_irq and random.c)

Hardly any - apart from adding a (new) SA_SAMPLE_NET_RANDOM to request_irq
in each drivers/net/*.c, you just need (manual diff) in handle_IRQ_event:

} while (action);
- if (status & SA_SAMPLE_RANDOM)
+ if ((status & SA_SAMPLE_RANDOM) ||
+ (entropy_from_net &&
+ (status & SA_SAMPLE_NET_RANDOM)))
add_interrupt_randomness(irq);
__cli();

and then the completely trivial /proc (and/or sysctl if that's
really necessary) code for twiddling
/proc/driver/entropy_from_net (or whatever it's called).

+ int sysctl_entropy_from_net
...
+ {DR_RANDOM_ENTROPYNET, "entropy_from_net",
+ &sysctl_entropy_from_net,
+ sizeof(sysctl_entropy_from_net), 0644, NULL, &proc_dointvec},

in somewhere where it gets into dev_table in sysctl.c -
and that's about it.

Given distributions normally have installers with 'hints' as
to whether they are running headless or not, this could
via some rc script write a '1' here if the machine was
perceived as headless, or leave it default (0) otherwise.

--
Alex Bligh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/