From: johan.hedberg@gmail.com
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 01/10] Bluetooth: Remove SMP data specific crypto context
Date: Tue, 18 Feb 2014 17:14:30 +0200 [thread overview]
Message-ID: <1392736479-8808-2-git-send-email-johan.hedberg@gmail.com> (raw)
In-Reply-To: <1392736479-8808-1-git-send-email-johan.hedberg@gmail.com>
From: Johan Hedberg <johan.hedberg@intel.com>
Now that each HCI device has its own AES crypto context we don't need
the one stored in the SMP data any more. This patch removes the variable
from struct smp_chan and updates the SMP code to use the per-hdev crypto
context.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/smp.c | 15 ++-------------
net/bluetooth/smp.h | 1 -
2 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 5867c1c3f436..6dcb35640b6f 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -413,21 +413,13 @@ static void confirm_work(struct work_struct *work)
{
struct smp_chan *smp = container_of(work, struct smp_chan, confirm);
struct l2cap_conn *conn = smp->conn;
- struct crypto_blkcipher *tfm;
+ struct crypto_blkcipher *tfm = conn->hcon->hdev->tfm_aes;
struct smp_cmd_pairing_confirm cp;
int ret;
u8 res[16], reason;
BT_DBG("conn %p", conn);
- tfm = crypto_alloc_blkcipher("ecb(aes)", 0, CRYPTO_ALG_ASYNC);
- if (IS_ERR(tfm)) {
- reason = SMP_UNSPECIFIED;
- goto error;
- }
-
- smp->tfm = tfm;
-
if (conn->hcon->out)
ret = smp_c1(tfm, smp->tk, smp->prnd, smp->preq, smp->prsp,
conn->hcon->src_type, &conn->hcon->src,
@@ -457,7 +449,7 @@ static void random_work(struct work_struct *work)
struct smp_chan *smp = container_of(work, struct smp_chan, random);
struct l2cap_conn *conn = smp->conn;
struct hci_conn *hcon = conn->hcon;
- struct crypto_blkcipher *tfm = smp->tfm;
+ struct crypto_blkcipher *tfm = hcon->hdev->tfm_aes;
u8 reason, confirm[16], res[16], key[16];
int ret;
@@ -562,9 +554,6 @@ void smp_chan_destroy(struct l2cap_conn *conn)
BUG_ON(!smp);
- if (smp->tfm)
- crypto_free_blkcipher(smp->tfm);
-
kfree(smp);
conn->smp_chan = NULL;
conn->hcon->smp_conn = NULL;
diff --git a/net/bluetooth/smp.h b/net/bluetooth/smp.h
index 4f373bc56ad7..8f54c9b152de 100644
--- a/net/bluetooth/smp.h
+++ b/net/bluetooth/smp.h
@@ -133,7 +133,6 @@ struct smp_chan {
u8 id_addr_type;
u8 irk[16];
unsigned long smp_flags;
- struct crypto_blkcipher *tfm;
struct work_struct confirm;
struct work_struct random;
};
--
1.8.5.3
next prev parent reply other threads:[~2014-02-18 15:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-18 15:14 [PATCH 00/10] Bluetooth: More patches for privacy johan.hedberg
2014-02-18 15:14 ` johan.hedberg [this message]
2014-02-18 16:04 ` [PATCH 01/10] Bluetooth: Remove SMP data specific crypto context Marcel Holtmann
2014-02-18 16:24 ` Johan Hedberg
2014-02-18 16:29 ` Johan Hedberg
2014-02-18 17:34 ` Marcel Holtmann
2014-02-18 15:14 ` [PATCH 02/10] Bluetooth: Fix missing address type check for removing LTKs johan.hedberg
2014-02-18 15:14 ` [PATCH 03/10] Bluetooth: Remove return values from functions that don't need them johan.hedberg
2014-02-18 15:14 ` [PATCH 04/10] Bluetooth: Fix hci_remove_ltk failure when no match is found johan.hedberg
2014-02-18 15:14 ` [PATCH 05/10] Bluetooth: Fix completing SMP as peripheral when no keys are expected johan.hedberg
2014-02-18 15:14 ` [PATCH 06/10] Bluetooth: Fix removing any IRKs when unpairing devices johan.hedberg
2014-02-18 15:14 ` [PATCH 07/10] Bluetooth: Add convenience function for fetching IRKs johan.hedberg
2014-02-18 15:14 ` [PATCH 08/10] Bluetooth: Track the LE Identity Address in struct hci_conn johan.hedberg
2014-02-18 17:01 ` Marcel Holtmann
2014-02-18 15:14 ` [PATCH 09/10] Bluetooth: Fix updating Identity Address in L2CAP channels johan.hedberg
2014-02-18 18:25 ` Marcel Holtmann
2014-02-18 15:14 ` [PATCH 10/10] Bluetooth: Wait for SMP key distribution completion when pairing johan.hedberg
2014-02-18 15:44 ` [PATCH v2 " johan.hedberg
2014-02-18 18:28 ` Marcel Holtmann
2014-02-18 19:48 ` Johan Hedberg
2014-02-18 16:59 ` [PATCH 00/10] Bluetooth: More patches for privacy 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=1392736479-8808-2-git-send-email-johan.hedberg@gmail.com \
--to=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.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