-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix Out-Of-Band (OOB) data generation for BLE OOB pairing #9339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -653,14 +653,20 @@ ble_error_t GenericSecurityManager::generateOOB( | |
/* Secure connections. Avoid generating if we're already waiting for it. | ||
* If a local random is set to 0 it means we're already calculating. */ | ||
if (!is_all_zeros(_oob_local_random)) { | ||
status = _pal.generate_secure_connections_oob(); | ||
/* save the current values in case the call to | ||
* generate_secure_connections_oob fails */ | ||
address_t orig_local_address = _oob_local_address; | ||
oob_lesc_value_t orig_local_random = _oob_local_random; | ||
|
||
_oob_local_address = *address; | ||
/* this will be updated when calculation completes, | ||
* a value of all zeros is an invalid random value */ | ||
set_all_zeros(_oob_local_random); | ||
|
||
if (status == BLE_ERROR_NONE) { | ||
_oob_local_address = *address; | ||
/* this will be updated when calculation completes, | ||
* a value of all zeros is an invalid random value */ | ||
set_all_zeros(_oob_local_random); | ||
} else if (status != BLE_ERROR_NOT_IMPLEMENTED) { | ||
status = _pal.generate_secure_connections_oob(); | ||
if (status != BLE_ERROR_NONE && status != BLE_ERROR_NOT_IMPLEMENTED) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you need to now: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. status is returned on line 670 for the failure case. Do you mean you want BLE_ERROR_NOT_IMPLEMENTED to be able to be propagated back to the user? This was not the case originally. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you are right, it needs to be hidden - bundling this together with legacy was not a good idea, we have to hide the SC failure since it's optional |
||
_oob_local_address = orig_local_address; | ||
_oob_local_random = orig_local_random; | ||
return status; | ||
} | ||
} else { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This modification to
_oob_local_random
should be reverted ifgenerate_secure_connections_oob
fail.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no problem, should be easy enough.