}
}
-static int hci_register_smp(struct hci_dev *hdev)
-{
- int err;
-
- BT_DBG("%s", hdev->name);
-
- hdev->tfm_aes = crypto_alloc_blkcipher("ecb(aes)", 0,
- CRYPTO_ALG_ASYNC);
- if (IS_ERR(hdev->tfm_aes)) {
- BT_ERR("Unable to create crypto context");
- err = PTR_ERR(hdev->tfm_aes);
- hdev->tfm_aes = NULL;
- return err;
- }
-
- return 0;
-}
-
-static void hci_unregister_smp(struct hci_dev *hdev)
-{
- BT_DBG("%s", hdev->name);
-
- if (hdev->tfm_aes) {
- crypto_free_blkcipher(hdev->tfm_aes);
- hdev->tfm_aes = NULL;
- }
-}
-
static int __hci_init(struct hci_dev *hdev)
{
int err;
hdev->debugfs,
&hdev->discov_interleaved_timeout);
- hci_register_smp(hdev);
+ smp_register(hdev);
}
return 0;
rfkill_destroy(hdev->rfkill);
}
- hci_unregister_smp(hdev);
+ smp_unregister(hdev);
device_del(&hdev->dev);
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;
+ }
+}
bdaddr_t *bdaddr);
int smp_generate_rpa(struct crypto_blkcipher *tfm, u8 irk[16], bdaddr_t *rpa);
+int smp_register(struct hci_dev *hdev);
+void smp_unregister(struct hci_dev *hdev);
+
#endif /* __SMP_H */