Skip to content

Conversation

joerchan
Copy link
Contributor

Originally meant to backport e06bac0~2..e06bac0 from #33266

Cherry-picking had dependencies so one more commit was included.
Additional fixes have been included in this PR, these should have been backported earlier.

Original backport commit list:
e06bac0 Bluetooth: host: Overwrite existing bond when IRK has been updated
7fee6b8 Bluetooth: host: Refactor update_keys_check to operate on keys as input

Dependency commit:
b35075d Bluetooth: SMP: Re-pairing cannot lower the security level of the bond

Additional fixes backported:
3102f3b Bluetooth: host: Fail pairing with identical public key
64d6d10 Bluetooth: SMP: Add option to disallow unauthenticated re-pairing
7ab754d Bluetooth: SMP: Fix bond lost on pairing failure.
a3e89e8 bluetooth: host: Fix simultaneous pairings getting the same keys slot

@joerchan joerchan requested review from carlescufi and jhedberg March 25, 2021 17:34
@joerchan
Copy link
Contributor Author

Need #33467

@galak
Copy link
Contributor

galak commented Apr 13, 2021

Can you rebase now that the doc building is fixed.

@joerchan joerchan force-pushed the backport-33266-to-v1.14-branch branch from a7cf02b to 977af92 Compare April 21, 2021 11:33
@joerchan
Copy link
Contributor Author

@galak Rebased, but something else went wrong. Is it an unstable test?

@nashif
Copy link
Member

nashif commented May 21, 2021

@joerchan the failing test are not related, is this ready to move out of draft?

@nashif
Copy link
Member

nashif commented Jun 29, 2021

@joerchan the failing test are not related, is this ready to move out of draft?

@joerchan ping

joerchan and others added 7 commits August 5, 2021 13:29
Make sure that a new pairing procedure with an existing bond does not
result in a security with weaker security properties.

Signed-off-by: Joakim Andersson <[email protected]>
Disallows all unauthenticated pairing attempts made by the
peer where an unauthenticated bond already exists.
This would enable cases where an attacker could copy the peer device
address to connect and start an unauthenticated pairing procedure
to replace the existing bond. Now in order to create a new bond the old
bond has to be explicitly deleted with bt_unpair.

Added option to disable this rule in order to maintain backwards
compatibility in case this behavior is accepted.

Signed-off-by: Joakim Andersson <[email protected]>
Fix an issue where a slot in the key pool was considered free when
either the address was cleared or no keys were written in the entry
(enc_size == 0). This caused a problem with simultaneous pairing
attempts that would be assigned the same entry.

This patch makes it so a a slot is considered free even when keys are
not yet present in the entry, and makes sure the address is cleared in
case of pairing failure or timeout so to mark the slot as free.

Signed-off-by: François Delawarde <[email protected]>
Fix an an issue where established bonding information in the peripheral
are deleted when the central does not have the bond information.
This could be because the central has removed the bond information, or
this is in fact not the central but someone spoofing it's identity, or
an accidental RPA match.

This is a regression from: a3e89e8

Signed-off-by: Joakim Andersson <[email protected]>
Fail the pairing procedure when both devices have the same non-debug
public key.

Signed-off-by: Joakim Andersson <[email protected]>
Refactor update_keys_check helper function to operate on input keys
input. This allows the function to be re-used on a keys structure that
is not the current connection keys.

This also avoids the helper function changing the connection state.
The conn->le.keys pointer should at this point always have been
assigned, as central when sending the pairing request, and as peripheral
when receiving the pairing request at the very latest.

Signed-off-by: Joakim Andersson <[email protected]>
Overwrite the existing bond when the IRK of the existing bond could not
resolve the RPA of the peer. This would happen if the peer has deleted
the bond and replaced the IRK that was used.

Signed-off-by: Joakim Andersson <[email protected]>
@joerchan joerchan force-pushed the backport-33266-to-v1.14-branch branch from 977af92 to 664c927 Compare August 5, 2021 11:50
@joerchan joerchan marked this pull request as ready for review August 5, 2021 13:56
@joerchan joerchan requested review from Vudentz and sjanc as code owners August 5, 2021 13:56
@joerchan joerchan added this to the v1.14.3 milestone Aug 5, 2021
@nashif nashif merged commit ef512f2 into zephyrproject-rtos:v1.14-branch Aug 30, 2021
@joerchan joerchan deleted the backport-33266-to-v1.14-branch branch August 30, 2021 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants