[Cryptography] Use process ID in mixing?
Rob Kendrick
rjek at rjek.com
Tue Apr 1 06:37:55 EDT 2014
On Tue, Apr 01, 2014 at 06:01:02PM +1100, Dave Horsfall wrote:
> On Tue, 18 Mar 2014, Sandy Harris wrote:
>
> > On Linux, you can get the caller's pid from kernel code with #include
> > <linux/sched.h> then look at current->pid. Probably there is something
> > similar for other systems and quite possibly there is other usable data
> > in the struct; I haven't looked.
>
> On other systems such as *BSD (and I include the Mac in that), there is
> the getpid() call (get process ID) and getppid() (get parent's process
> ID). I have no idea why Linux abandoned them.
Linux has both of them, but they're user-land calls. Sandy is refering
to what happens in kernel land.
> Just goes to show, if you're cutting important code (such as using the PID
> for various reasons) then you'd better be familiar with that platform,
> and try to program for other platforms as well. A common trick to seed
> a low-quality PRNG (for non-critical use) is to add the PID to the time;
> that way, each process seeding at the same time gets a different one.
Hopefully not the monotonic clock, but the wall clock!
B.
More information about the cryptography
mailing list