From: "Gustavo F. Padovan" <padovan@profusion.mobi>
To: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [RFC 17/20] Bluetooth: Add support for using the crypto subsystem
Date: Tue, 23 Nov 2010 21:02:18 -0200 [thread overview]
Message-ID: <20101123230218.GE11860@vigoh> (raw)
In-Reply-To: <1290524796-32246-18-git-send-email-vinicius.gomes@openbossa.org>
Hi Vinicius,
* Vinicius Costa Gomes <vinicius.gomes@openbossa.org> [2010-11-23 12:06:33 -0300]:
> This will allow using the crypto subsystem for encrypting data. As SMP
> (Security Manager Protocol) is implemented almost entirely on the host
> side and the crypto module already implements the needed methods
> (AES-128), it makes sense to use it.
>
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
> ---
> include/net/bluetooth/hci_core.h | 2 ++
> net/bluetooth/hci_core.c | 10 ++++++++++
> net/bluetooth/smp.c | 1 -
> 3 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index e2d857a..ee5efa8 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -135,6 +135,8 @@ struct hci_dev {
> __u32 req_status;
> __u32 req_result;
>
> + struct crypto_blkcipher *tfm;
> +
> struct inquiry_cache inq_cache;
> struct hci_conn_hash conn_hash;
> struct list_head blacklist;
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 5750b80..0e98ffb 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -41,6 +41,7 @@
> #include <linux/interrupt.h>
> #include <linux/notifier.h>
> #include <linux/rfkill.h>
> +#include <linux/crypto.h>
> #include <net/sock.h>
>
> #include <asm/system.h>
> @@ -947,6 +948,13 @@ int hci_register_dev(struct hci_dev *hdev)
> if (!hdev->workqueue)
> goto nomem;
>
> + hdev->tfm = crypto_alloc_blkcipher("ecb(aes)", 0, CRYPTO_ALG_ASYNC);
> + if (IS_ERR(hdev->tfm)) {
> + BT_ERR("Failed to load transform for ecb(aes): %ld",
> + PTR_ERR(hdev->tfm));
> + goto nomem;
> + }
> +
> hci_register_sysfs(hdev);
>
> hdev->rfkill = rfkill_alloc(hdev->name, &hdev->dev,
> @@ -987,6 +995,8 @@ int hci_unregister_dev(struct hci_dev *hdev)
> for (i = 0; i < NUM_REASSEMBLY; i++)
> kfree_skb(hdev->reassembly[i]);
>
> + crypto_free_blkcipher(hdev->tfm);
> +
> hci_notify(hdev, HCI_DEV_UNREG);
>
> if (hdev->rfkill) {
> diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
> index 7997978..8e8be47 100644
> --- a/net/bluetooth/smp.c
> +++ b/net/bluetooth/smp.c
> @@ -227,7 +227,6 @@ static void smp_cmd_pairing_confirm(struct l2cap_conn *conn, struct sk_buff *skb
> BT_DBG("");
>
> if (conn->hcon->out) {
> -
Change not related to your patch here.
--
Gustavo F. Padovan
http://profusion.mobi
next prev parent reply other threads:[~2010-11-23 23:02 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-23 15:06 [RFC 00/20] Simple SMP Just Works implementation Vinicius Costa Gomes
2010-11-23 15:06 ` [RFC 01/20] Bluetooth: Add low energy commands and events Vinicius Costa Gomes
2010-11-23 15:06 ` [RFC 02/20] Bluetooth: Add LE connect support Vinicius Costa Gomes
2010-11-23 17:57 ` Gustavo F. Padovan
2010-11-24 5:03 ` Ville Tervo
2010-11-23 15:06 ` [RFC 03/20] Bluetooth: Use LE buffers for LE traffic Vinicius Costa Gomes
2010-11-23 15:06 ` [RFC 04/20] Bluetooth: Add LE connection support to L2CAP Vinicius Costa Gomes
2010-11-23 15:06 ` [RFC 05/20] Bluetooth: Add server socket support for LE connection Vinicius Costa Gomes
2010-11-23 15:06 ` [RFC 06/20] Bluetooth: Do not send disconn comand over LE links Vinicius Costa Gomes
2010-11-23 22:48 ` Gustavo F. Padovan
2010-11-24 5:05 ` Ville Tervo
2010-11-23 15:06 ` [RFC 07/20] Bluetooth: Fix initiated LE connections Vinicius Costa Gomes
2010-11-23 15:06 ` [RFC 08/20] Bluetooth: Treat LE and ACL links separately on timeout Vinicius Costa Gomes
2010-11-23 15:06 ` [RFC 09/20] Bluetooth: Fix locking balance in l2cap_le_conn_ready Vinicius Costa Gomes
2010-11-23 22:52 ` Gustavo F. Padovan
2010-11-23 15:06 ` [RFC 10/20] Bluetooth: Add server socket support for LE connection Vinicius Costa Gomes
2010-11-23 22:54 ` Gustavo F. Padovan
2010-11-23 23:04 ` Vinicius Costa Gomes
2010-11-23 15:06 ` [RFC 11/20] Bluetooth: Add SMP command structures Vinicius Costa Gomes
2010-11-23 15:06 ` [RFC 12/20] Bluetooth: fix receiving L2CAP packets over LE Vinicius Costa Gomes
2010-11-23 22:55 ` Gustavo F. Padovan
2010-11-23 23:06 ` Vinicius Costa Gomes
2010-11-24 5:32 ` Ville Tervo
2010-11-24 14:47 ` Vinicius Costa Gomes
2010-11-23 15:06 ` [RFC 13/20] Bluetooth: Implement the first SMP commands Vinicius Costa Gomes
2010-11-23 15:06 ` [RFC 14/20] Bluetooth: Start SMP procedure Vinicius Costa Gomes
2010-11-23 15:06 ` [RFC 15/20] Bluetooth: simple SMP pairing negotiation Vinicius Costa Gomes
2010-11-23 15:06 ` [RFC 16/20] Bluetooth: LE SMP Cryptoolbox functions Vinicius Costa Gomes
2010-11-23 15:06 ` [RFC 17/20] Bluetooth: Add support for using the crypto subsystem Vinicius Costa Gomes
2010-11-23 23:02 ` Gustavo F. Padovan [this message]
2010-11-23 15:06 ` [RFC 18/20] Bluetooth: Add support for SMP confirmation checks Vinicius Costa Gomes
2010-11-23 15:06 ` [RFC 19/20] Bluetooth: Add support for LE Start Encryption Vinicius Costa Gomes
2010-11-23 15:06 ` [RFC 20/20] Bluetooth: Add support for resuming socket when SMP is finished Vinicius Costa Gomes
2010-11-24 5:42 ` [RFC 00/20] Simple SMP Just Works implementation Ville Tervo
2010-11-24 21:08 ` Gustavo F. Padovan
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=20101123230218.GE11860@vigoh \
--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).