(Small) bias in generation of random passkeys for pairing
Hi!
There's a (small) bias in passkey generation in bluetooth:
get_random_bytes(&passkey, sizeof(passkey)); passkey %= 1000000; put_unaligned_le32(passkey, smp->tk);
(there are at least two places doing this).
All passkeys are not of same probability, passkey "000000" is more probable than "999999", but difference is small.
Do we care?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi Pavel,
Am 19.06.19 um 18:24 schrieb Pavel Machek:
Quoted 4 lines
Hi!
There's a (small) bias in passkey generation in bluetooth:
Quoted 8 lines
get_random_bytes(&passkey, sizeof(passkey)); passkey %= 1000000; put_unaligned_le32(passkey, smp->tk);(there are at least two places doing this).
All passkeys are not of same probability, passkey "000000" is more probable than "999999", but difference is small.
It is slightly different IMHO.
Unsigned 32bits passkey assumed (and all users I found were u32), the passkeys "000000" to "967295" are slightly more probable than "967296" to "999999".
If my math is right (which I doubt), the difference in probability for both entities is 4294:4293.
Quoted 1 line
Do we care?
I, personally, don't (yet).
But then, I'm not a real security expert.
Have fun,
Signature · 4 lines
Stefan Seyfried "For a successful technology, reality must take precedence over public relations, for nature cannot be fooled." -- Richard Feynman