Hi Sven, > > 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? Possibly because the author didn't think the caller should have to know whether the routine processed `char *' or something else internally. Or maybe because they didn't want every caller to add the appropriate cast. > 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); No, not at all. This suggests C isn't a language you feel confident in. I'd stop doing any kernel stuff until the answer to this question is second nature. Kernighan and Ritchie's _The C Programming Language_, 2nd Ed., is what you need to read. int i; int *ip; ip = &i; get_random_bytes(&i, sizeof i); get_random_bytes(ip, sizeof *ip); Ralph. - 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/