Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: Limit OOB to P-256 values for Secure Connection Only mode
Date: Tue, 27 Jan 2015 21:13:01 +0100	[thread overview]
Message-ID: <2080375.GZdINHllEn@leonov> (raw)
In-Reply-To: <1422386512-15819-1-git-send-email-marcel@holtmann.org>

Hi Marcel,

On Tuesday 27 of January 2015 11:21:52 Marcel Holtmann wrote:
> When using Secure Connection Only mode, the P-192 hash and rand values
> for BR/EDR and the TK value for LE are not valid. The Secure Connections
> Only mode limits the encryption keys to P-256 derived values for both
> transports. To avoid accidentally loading weak values for pairing just
> restrict it to P-256 values.

If so, shouldn't enabling Secure Connection Only mode result in clearing OOB 
data (or at least removing legacy ones)?

> 
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
>  net/bluetooth/mgmt.c | 30 ++++++++++++++++++++++++++----
>  1 file changed, 26 insertions(+), 4 deletions(-)
> 
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 8417ab387d1a..5c7340b1cd66 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -3660,6 +3660,21 @@ static int add_remote_oob_data(struct sock *sk,
> struct hci_dev *hdev, goto unlock;
>  		}
> 
> +		/* In case Secure Connections Only made has been enabled,

typo:  made -> mode

> +		 * do not allow providing P-192 hash and rand values.
> +		 *
> +		 * This actually means that in Secure Connections Only
> +		 * mode this command with the legacy parameter list
> +		 * is not supported at all.
> +		 */
> +		if (test_bit(HCI_SC_ONLY, &hdev->dev_flags)) {
> +			err = cmd_complete(sk, hdev->id,
> +					   MGMT_OP_ADD_REMOTE_OOB_DATA,
> +					   MGMT_STATUS_INVALID_PARAMS,
> +					   addr, sizeof(*addr));
> +			goto unlock;
> +		}
> +
>  		err = hci_add_remote_oob_data(hdev, &cp->addr.bdaddr,
>  					      cp->addr.type, cp->hash,
>  					      cp->rand, NULL, NULL);
> @@ -3675,10 +3690,17 @@ static int add_remote_oob_data(struct sock *sk,
> struct hci_dev *hdev, u8 *rand192, *hash192;
>  		u8 status;
> 
> -		if (bdaddr_type_is_le(cp->addr.type)) {
> -			/* Enforce zero-valued 192-bit parameters as
> -			 * long as legacy SMP OOB isn't implemented.
> -			 */
> +		/* For Bluetooth LE, currently only P-256 hash and rand
> +		 * values are allowed. The P-192 hash and rand values
> +		 * are required to be zero. This is required since Legacy
> +		 * Pairing for LE with OOB is not implemented yet.
> +		 *
> +		 * In case Secure Connections Only made has been enabled,

same typo

> +		 * do not allow providing P-192 hash and rand values. It
> +		 * is required that the values are zero here as well.
> +		 */
> +		if (bdaddr_type_is_le(cp->addr.type) ||
> +		    test_bit(HCI_SC_ONLY, &hdev->dev_flags)) {
>  			if (memcmp(cp->rand192, ZERO_KEY, 16) ||
>  			    memcmp(cp->hash192, ZERO_KEY, 16)) {
>  				err = cmd_complete(sk, hdev->id,

-- 
BR
Szymon Janc

  reply	other threads:[~2015-01-27 20:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-27 19:21 [PATCH] Bluetooth: Limit OOB to P-256 values for Secure Connection Only mode Marcel Holtmann
2015-01-27 20:13 ` Szymon Janc [this message]
2015-01-27 20:39   ` Marcel Holtmann
2015-01-27 21:08   ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2080375.GZdINHllEn@leonov \
    --to=szymon.janc@tieto.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox