aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/smp.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index a38941593e8b..39ca9616d2de 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -62,6 +62,8 @@ struct smp_chan {
62 struct smp_ltk *slave_ltk; 62 struct smp_ltk *slave_ltk;
63 struct smp_irk *remote_irk; 63 struct smp_irk *remote_irk;
64 unsigned long flags; 64 unsigned long flags;
65
66 struct crypto_blkcipher *tfm_aes;
65}; 67};
66 68
67static inline void swap_buf(const u8 *src, u8 *dst, size_t len) 69static inline void swap_buf(const u8 *src, u8 *dst, size_t len)
@@ -583,6 +585,13 @@ static struct smp_chan *smp_chan_create(struct l2cap_conn *conn)
583 if (!smp) 585 if (!smp)
584 return NULL; 586 return NULL;
585 587
588 smp->tfm_aes = crypto_alloc_blkcipher("ecb(aes)", 0, CRYPTO_ALG_ASYNC);
589 if (IS_ERR(smp->tfm_aes)) {
590 BT_ERR("Unable to create ECB crypto context");
591 kfree(smp);
592 return NULL;
593 }
594
586 smp->conn = conn; 595 smp->conn = conn;
587 conn->smp_chan = smp; 596 conn->smp_chan = smp;
588 conn->hcon->smp_conn = conn; 597 conn->hcon->smp_conn = conn;
@@ -605,6 +614,8 @@ void smp_chan_destroy(struct l2cap_conn *conn)
605 kfree(smp->csrk); 614 kfree(smp->csrk);
606 kfree(smp->slave_csrk); 615 kfree(smp->slave_csrk);
607 616
617 crypto_free_blkcipher(smp->tfm_aes);
618
608 /* If pairing failed clean up any keys we might have */ 619 /* If pairing failed clean up any keys we might have */
609 if (!complete) { 620 if (!complete) {
610 if (smp->ltk) { 621 if (smp->ltk) {