[fpc-devel] I get duplicate GUIDs under Linux

Mattias Gärtner nc-gaertnma at netcologne.de
Thu May 29 13:57:17 CEST 2008


Zitat von Graeme Geldenhuys <graemeg.lists at gmail.com>:

> 2008/5/29 Mattias Gärtner <nc-gaertnma at netcologne.de>:
> >
> > Sounds like the Debian openssl key fiasko.
>
> I saw Ubuntu had some updates to resolve this issue on my system. Got
> the updates, rebooted, recompiled my application and still 1021 is my
> limit before I get duplicates.

Sorry. Openssl has *nothing* to do with the CreateGUID function.
But the CreateGUID calls the kernel function and if this does not work it calls
Randomize and calls 16 times random(256).
But Randomize only work from time to time, so don't call it often - Bug in
GetRandomBytes.
IMO GetRandomBytes needs to check if Randomize has been called. Or even better:
Randomize should not reset the sequence if no random number is available.


> What is really weird is that once I hit the 1021 limit, I can't run
> that method again. I get a duplicate after 1 add!  It seems to behave
> exactly like random() without calling randomize().  It seems to
> remember the last "position" it it's seed or something and tries to
> continue where it left off. The same pattern, over and over.

Maybe the 1021 is the limit of /dev/random.

Mattias




More information about the fpc-devel mailing list