Re: How to use 'get_random_bytes'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Hi Sven,

Hi Ralph,
Thank you for your fast response!

>> [...]
> Does looking at existing uses of it help?
>
>     http://lxr.linux.no/ident?i=get_random_bytes

Yes, it did. If I understand things correctly,  'void
get_random_bytes(void *buf, int nbytes)' is the exported kernel
interface of  'extract_entropy'. It fills '*buf' with numbers from a
pool of random numbers. The number of the numbers (I know, it sounds
stupid...) that are put into '*buf' is defined by 'nbytes'.
I'm a little bit confused about the fact that '*buf' is defined as
'void *buf'. If '*buf' is filled up with numbers why isn't it defined
as 'int' or something like that?
For being sure I use 'get_random_bytes' in a correct way, I would like
to ask if somebody could post which parameters I have to fill in if I
want to get an integer 'x' with random numbers and let's say the whole
thing 3 bytes long.
Is it really
    int x;
    get_random_bytes(x, 3);
?

Thanks in advance
Sven

-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux