summaryrefslogtreecommitdiff
path: root/net/bluetooth/smp.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-08-08 10:32:52 +0400
committerMarcel Holtmann <marcel@holtmann.org>2014-08-14 10:49:18 +0400
commit711eafe345d993cf4831e890fa989d02c06cad62 (patch)
tree6a944b71657ef48d8df93441578ca4b2c90e71fd /net/bluetooth/smp.c
parent54506918059a5bdbf396f34f2e0a2735803024db (diff)
downloadlinux-711eafe345d993cf4831e890fa989d02c06cad62.tar.xz
Bluetooth: Move SMP (de)initialization to smp.c
As preparation for moving SMP to use l2cap_chan infrastructure we need to move the (de)initialization functions to smp.c (where they'll eventually need access to the local L2CAP channel callbacks). Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/smp.c')
-rw-r--r--net/bluetooth/smp.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 33016ec9b247..ab07649ecc77 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -1455,3 +1455,29 @@ int smp_distribute_keys(struct l2cap_conn *conn)
return 0;
}
+
+int smp_register(struct hci_dev *hdev)
+{
+ BT_DBG("%s", hdev->name);
+
+ hdev->tfm_aes = crypto_alloc_blkcipher("ecb(aes)", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(hdev->tfm_aes)) {
+ int err = PTR_ERR(hdev->tfm_aes);
+ BT_ERR("Unable to create crypto context");
+ hdev->tfm_aes = NULL;
+ return err;
+ }
+
+ return 0;
+}
+
+void smp_unregister(struct hci_dev *hdev)
+{
+ BT_DBG("%s", hdev->name);
+
+ if (hdev->tfm_aes) {
+ crypto_free_blkcipher(hdev->tfm_aes);
+ hdev->tfm_aes = NULL;
+ }
+}