mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-03-20 22:15:59 +00:00
Bluetooth: Use bool for smp_ltk_encrypt return value
The return value of smp_ltk_encrypt is simple boolean, so just use bool and make the code a bit more readable. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
81218d2099
commit
f81cd823a8
1 changed files with 5 additions and 5 deletions
|
@ -837,7 +837,7 @@ static u8 smp_cmd_pairing_random(struct l2cap_conn *conn, struct sk_buff *skb)
|
||||||
return smp_random(smp);
|
return smp_random(smp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 smp_ltk_encrypt(struct l2cap_conn *conn, u8 sec_level)
|
static bool smp_ltk_encrypt(struct l2cap_conn *conn, u8 sec_level)
|
||||||
{
|
{
|
||||||
struct smp_ltk *key;
|
struct smp_ltk *key;
|
||||||
struct hci_conn *hcon = conn->hcon;
|
struct hci_conn *hcon = conn->hcon;
|
||||||
|
@ -845,18 +845,18 @@ static u8 smp_ltk_encrypt(struct l2cap_conn *conn, u8 sec_level)
|
||||||
key = hci_find_ltk_by_addr(hcon->hdev, &hcon->dst, hcon->dst_type,
|
key = hci_find_ltk_by_addr(hcon->hdev, &hcon->dst, hcon->dst_type,
|
||||||
hcon->out);
|
hcon->out);
|
||||||
if (!key)
|
if (!key)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (sec_level > BT_SECURITY_MEDIUM && !key->authenticated)
|
if (sec_level > BT_SECURITY_MEDIUM && !key->authenticated)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags))
|
if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags))
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
hci_le_start_enc(hcon, key->ediv, key->rand, key->val);
|
hci_le_start_enc(hcon, key->ediv, key->rand, key->val);
|
||||||
hcon->enc_key_size = key->enc_size;
|
hcon->enc_key_size = key->enc_size;
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)
|
static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)
|
||||||
|
|
Loading…
Add table
Reference in a new issue