Messages in this thread | | | Subject | Re: (Small) bias in generation of random passkeys for pairing | From | Stefan Seyfried <> | Date | Thu, 20 Jun 2019 14:00:38 +0200 |
| |
Hi Pavel,
Am 19.06.19 um 18:24 schrieb Pavel Machek: > 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.
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.
> Do we care?
I, personally, don't (yet). But then, I'm not a real security expert.
Have fun, -- Stefan Seyfried
"For a successful technology, reality must take precedence over public relations, for nature cannot be fooled." -- Richard Feynman
| |