Re: [RFC] frandom - fast random generator module

From: Nick Piggin
Date: Thu Oct 16 2003 - 05:56:20 EST




Eli Billauer wrote:



Frandom is the faster version of the well-known /dev/urandom random number generator. Not instead of, but rather as a supplement, when pseudorandom data is needed at high rate. Few tests so far show that frandom is 10-50 times faster than urandom.


Without looking at the code, why should this be done in the kernel?


I suppose you're asking why having a /dev/frandom device at all. Why not let everyone write their own little random generator (based upon well-known C functions) whenever random data is needed.


Yes, a userspace solution that makes use of the existing kernel random
number source if needed.


There are plenty of handy things in the kernel, that could be done in userspace. /dev/zero is my favourite example, but I'm sure there are other cases where things were put in the kernel simply because people found them handy. Which is a good reason, if you ask me.


There is probably a lot in the kernel that can (and a lot that should) be
done in userspace (although I'm not sure /dev/zero is one of them).

This doesn't mean having them in the kernel is a good idea because they are
handy. I'm not passing judgement on your module though - I was just wondering
why it is in kernel.


Besides, it's quite easy to do something wrong with random numbers. By having a good source of random data, I suppose we can spare a lot of people the headache of getting their own user-space application right for the one-off thing they want to do.


Although we do have 2 types of random number sources in the kernel. I'm not
sure we'd want to keep adding them as the need arises. Maybe if it were a very
general and configurable one, but AFAIKS frandom is not.

Cheers,
Nick


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