Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp881954ybi; Wed, 19 Jun 2019 09:25:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzSOMCrcGgBgewk5EqfW/uEFfT/m+YgK+SahfEaCfm57X4r5u5H71Hr3Z39EN/b/4z1pE4k X-Received: by 2002:a17:90a:3787:: with SMTP id v7mr12083921pjb.33.1560961534193; Wed, 19 Jun 2019 09:25:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560961534; cv=none; d=google.com; s=arc-20160816; b=KTIMTODahC+sdc8NDeYadHkjRZ3ipNajTPJdJAkbNnA0D40ta4ShI+6/sGtLhlr3LT +kAHKPt5V/AyVlpIL4z835APvwBZeBmpQVOkYlEby9TTF9GA4n36Dw2PWu1sNg7KlVco lHHGW23uuQm4zPaPhtZlh8A8g8yeV4+F1Lp5Y43pDUtLX/tTXKIjYLczZ0lPsnAGTUB9 slHbEWxFd4Eqfnta1cxmH4/E4BkoGzLKW/hbXkJO7iHeBwwvuYCdaVAFNxoIACRh4lFe /4fSF4OgkFb6SJB4WO1eSnYazHkPc7ZsF6td1V17AY2pUb+Ce/stZEuMPcPiRGBqd9Bf JsZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:to:from:date; bh=T6REPSSGPyn7hIHh5hKOFg3WcQ2eHEbPQD8seQ1MuyU=; b=b/sXpjD7MMBz1h0tISqqMoyrq14XKz4PyMYLiovNNwdH9eSPrplwssPx7pwcyQoF6R UfnVrDhLnFCdAZ1Mbe2+kQqHPxH1HGembCK+xxDKOZYEpdRTeryfbfBGMGwXSR4RwatQ vWR2dZc9VlGd4bGSqXtDola4EoY1h3c1rVVJeXXhGhJYk1A9Bu6MWmalIXg5PPzLIS1t 2yZIGTkmq6pkUCDV+7ZsOkO8TJgR3naV0rsd5q1YnHm5Cmw4jJTJ7OhEbjU/V+Ix6zYA YfZPHOk2ScPY/sypZ2iHcz0kCAr8eFQYl2mnS42wwzzOT96CcYTH96w5SnxjD62PPzfz uaJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si15015690plk.225.2019.06.19.09.25.08; Wed, 19 Jun 2019 09:25:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726628AbfFSQY6 (ORCPT + 99 others); Wed, 19 Jun 2019 12:24:58 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:39083 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726479AbfFSQY6 (ORCPT ); Wed, 19 Jun 2019 12:24:58 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id B2F5C804A3; Wed, 19 Jun 2019 18:24:45 +0200 (CEST) Date: Wed, 19 Jun 2019 18:24:56 +0200 From: Pavel Machek To: kernel list , security@kernel.org, linux-bluetooth@vger.kernel.org, johan.hedberg@gmail.com, marcel@holtmann.org Subject: (Small) bias in generation of random passkeys for pairing Message-ID: <20190619162456.GA9096@amd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="TB36FDmn/VVEgNH/" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org --TB36FDmn/VVEgNH/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! There's a (small) bias in passkey generation in bluetooth: get_random_bytes(&passkey, sizeof(passkey)); passkey %=3D 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 --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --TB36FDmn/VVEgNH/ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl0KYdgACgkQMOfwapXb+vIpbACdESrG2uX8VrOmg0/hD77A6bpQ 75YAniV2BHuvjLcaxwks3pCJVyNcOrjC =9pXo -----END PGP SIGNATURE----- --TB36FDmn/VVEgNH/--