diff options
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/mgmt.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 78939e0ed1f4..ba3b4a5820b1 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -3672,7 +3672,7 @@ static int add_remote_oob_data(struct sock *sk, struct hci_dev *hdev, | |||
3672 | status, &cp->addr, sizeof(cp->addr)); | 3672 | status, &cp->addr, sizeof(cp->addr)); |
3673 | } else if (len == MGMT_ADD_REMOTE_OOB_EXT_DATA_SIZE) { | 3673 | } else if (len == MGMT_ADD_REMOTE_OOB_EXT_DATA_SIZE) { |
3674 | struct mgmt_cp_add_remote_oob_ext_data *cp = data; | 3674 | struct mgmt_cp_add_remote_oob_ext_data *cp = data; |
3675 | u8 *rand192, *hash192; | 3675 | u8 *rand192, *hash192, *rand256, *hash256; |
3676 | u8 status; | 3676 | u8 status; |
3677 | 3677 | ||
3678 | if (bdaddr_type_is_le(cp->addr.type)) { | 3678 | if (bdaddr_type_is_le(cp->addr.type)) { |
@@ -3691,13 +3691,34 @@ static int add_remote_oob_data(struct sock *sk, struct hci_dev *hdev, | |||
3691 | rand192 = NULL; | 3691 | rand192 = NULL; |
3692 | hash192 = NULL; | 3692 | hash192 = NULL; |
3693 | } else { | 3693 | } else { |
3694 | rand192 = cp->rand192; | 3694 | /* In case one of the P-192 values is set to zero, |
3695 | hash192 = cp->hash192; | 3695 | * then just disable OOB data for P-192. |
3696 | */ | ||
3697 | if (!memcmp(cp->rand192, ZERO_KEY, 16) || | ||
3698 | !memcmp(cp->hash192, ZERO_KEY, 16)) { | ||
3699 | rand192 = NULL; | ||
3700 | hash192 = NULL; | ||
3701 | } else { | ||
3702 | rand192 = cp->rand192; | ||
3703 | hash192 = cp->hash192; | ||
3704 | } | ||
3705 | } | ||
3706 | |||
3707 | /* In case one of the P-256 values is set to zero, then just | ||
3708 | * disable OOB data for P-256. | ||
3709 | */ | ||
3710 | if (!memcmp(cp->rand256, ZERO_KEY, 16) || | ||
3711 | !memcmp(cp->hash256, ZERO_KEY, 16)) { | ||
3712 | rand256 = NULL; | ||
3713 | hash256 = NULL; | ||
3714 | } else { | ||
3715 | rand256 = cp->rand256; | ||
3716 | hash256 = cp->hash256; | ||
3696 | } | 3717 | } |
3697 | 3718 | ||
3698 | err = hci_add_remote_oob_data(hdev, &cp->addr.bdaddr, | 3719 | err = hci_add_remote_oob_data(hdev, &cp->addr.bdaddr, |
3699 | cp->addr.type, hash192, rand192, | 3720 | cp->addr.type, hash192, rand192, |
3700 | cp->hash256, cp->rand256); | 3721 | hash256, rand256); |
3701 | if (err < 0) | 3722 | if (err < 0) |
3702 | status = MGMT_STATUS_FAILED; | 3723 | status = MGMT_STATUS_FAILED; |
3703 | else | 3724 | else |