linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gustavo F. Padovan" <padovan@profusion.mobi>
To: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [bluetooth-next 13/15] Bluetooth: Add support for Pairing features exchange
Date: Wed, 6 Apr 2011 16:18:56 -0300	[thread overview]
Message-ID: <20110406191856.GB2228@joana> (raw)
In-Reply-To: <1302054716-24534-14-git-send-email-vinicius.gomes@openbossa.org>

Hi Vinícius,

* Vinicius Costa Gomes <vinicius.gomes@openbossa.org> [2011-04-05 22:51:54 -0300]:

> This patch implements a simple version of the SMP Pairing Features
> exchange procedure (Vol. 3 Part H, Section 2.3.5.1).
> 
> For now, everything that would cause a Pairing Method different of
> Just Works to be chosen is rejected.
> 
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
> ---
>  net/bluetooth/hci_event.c |    1 +
>  net/bluetooth/smp.c       |  117 ++++++++++++++++++++++++--------------------
>  2 files changed, 65 insertions(+), 53 deletions(-)
> 
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index aa0d013..e40ce9a 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -1555,6 +1555,7 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
>  				/* Encryption implies authentication */
>  				conn->link_mode |= HCI_LM_AUTH;
>  				conn->link_mode |= HCI_LM_ENCRYPT;
> +				conn->sec_level = conn->pending_sec_level;
>  			} else
>  				conn->link_mode &= ~HCI_LM_ENCRYPT;
>  		}
> diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
> index 2724b70..b6f52ab 100644
> --- a/net/bluetooth/smp.c
> +++ b/net/bluetooth/smp.c
> @@ -186,7 +186,30 @@ static void smp_send_cmd(struct l2cap_conn *conn, u8 code, u16 len, void *data)
>  	hci_send_acl(conn->hcon, skb, 0);
>  }
>  
> -static void smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
> +static __u8 seclevel_to_authreq(__u8 level)
> +{
> +	switch (level) {
> +	case BT_SECURITY_HIGH:
> +		/* Right now we don't support bonding */
> +		return SMP_AUTH_MITM;
> +
> +	default:
> +		return SMP_AUTH_NONE;
> +	}
> +}
> +
> +static void build_pairing_cmd(struct l2cap_conn *conn,
> +				struct smp_cmd_pairing *cmd, __u8 authreq)
> +{
> +	cmd->io_capability = SMP_IO_NO_INPUT_OUTPUT;
> +	cmd->oob_flag = SMP_OOB_NOT_PRESENT;
> +	cmd->max_key_size = 16;
> +	cmd->init_key_dist = 0x00;
> +	cmd->resp_key_dist = 0x00;
> +	cmd->auth_req = authreq;
> +}
> +

Separate the creation of build_pairing_cmd() in a new commit.

-- 
Gustavo F. Padovan
http://profusion.mobi

  reply	other threads:[~2011-04-06 19:18 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-06  1:51 [bluetooth-next 00/15] SM Just Works Implementation Vinicius Costa Gomes
2011-04-06  1:51 ` [bluetooth-next 01/15] Bluetooth: Implement the first SMP commands Vinicius Costa Gomes
2011-04-06  1:51 ` [bluetooth-next 02/15] Bluetooth: Start SMP procedure Vinicius Costa Gomes
2011-04-06  1:51 ` [bluetooth-next 03/15] Bluetooth: simple SMP pairing negotiation Vinicius Costa Gomes
2011-04-06  1:51 ` [bluetooth-next 04/15] Bluetooth: Add support for using the crypto subsystem Vinicius Costa Gomes
2011-04-06  1:51 ` [bluetooth-next 05/15] Bluetooth: LE SMP Cryptoolbox functions Vinicius Costa Gomes
2011-04-06 23:26   ` Gustavo F. Padovan
2011-04-06  1:51 ` [bluetooth-next 06/15] Bluetooth: Add SMP confirmation structs Vinicius Costa Gomes
2011-04-06 23:36   ` Gustavo F. Padovan
2011-04-08 21:55     ` Vinicius Costa Gomes
2011-04-06  1:51 ` [bluetooth-next 07/15] Bluetooth: Add SMP confirmation checks methods Vinicius Costa Gomes
2011-04-06  1:51 ` [bluetooth-next 08/15] Bluetooth: Minor fix in SMP methods Vinicius Costa Gomes
2011-04-06 19:09   ` Gustavo F. Padovan
2011-04-06  1:51 ` [bluetooth-next 09/15] Bluetooth: Add support for LE Start Encryption Vinicius Costa Gomes
2011-04-06  1:51 ` [bluetooth-next 10/15] Bluetooth: Add support for resuming socket when SMP is finished Vinicius Costa Gomes
2011-04-07  0:11   ` Gustavo F. Padovan
2011-04-07 14:48     ` Vinicius Costa Gomes
2011-04-08 16:34     ` Marcel Holtmann
2011-04-06  1:51 ` [bluetooth-next 11/15] Bluetooth: Fix initial security level of LE links Vinicius Costa Gomes
2011-04-06  1:51 ` [bluetooth-next 12/15] Bluetooth: Update the security level when link is encrypted Vinicius Costa Gomes
2011-04-06  1:51 ` [bluetooth-next 13/15] Bluetooth: Add support for Pairing features exchange Vinicius Costa Gomes
2011-04-06 19:18   ` Gustavo F. Padovan [this message]
2011-04-06  1:51 ` [bluetooth-next 14/15] Bluetooth: Add support for SMP timeout Vinicius Costa Gomes
2011-04-07  0:14   ` Gustavo F. Padovan
2011-04-07  0:32     ` Vinicius Costa Gomes
2011-04-06  1:51 ` [bluetooth-next 15/15] Bluetooth: Add key size checks for SMP Vinicius Costa Gomes
  -- strict thread matches above, loose matches on Subject: below --
2011-02-21 17:23 [bluetooth-next 00/15] SMP Just Works Implementation Vinicius Costa Gomes
2011-02-21 17:24 ` [bluetooth-next 13/15] Bluetooth: Add support for Pairing features exchange Vinicius Costa Gomes

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=20110406191856.GB2228@joana \
    --to=padovan@profusion.mobi \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=vinicius.gomes@openbossa.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;
as well as URLs for NNTP newsgroup(s).