lundi 5 août 2019

Sharing the seed between kernel and userspace to generate the same random number

I'm trying to generate a random number in my user and kernel space application. The resultant number must be the same in both the user space and the kernel space.

Can I access the CSPRNG of kernel side in user space? Or can I make sure my access from /dev/urandom from both the user space and the kernel space yields the same result?

So far I looked at get_random_bytes in the kernel and getrandom system call but what I exactly need is the following idea (not necessarily the code) to work both in kernel and user space.

   printf/printk(" %d ", rand()); // values must be the same

Thank you in advance




Aucun commentaire:

Enregistrer un commentaire