-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Deprecate BT_FIXED_APPKEY #25414
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
base: main
Are you sure you want to change the base?
Deprecate BT_FIXED_APPKEY #25414
Changes from all commits
97c8465
190ff63
1976e39
0d6a557
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,22 +7,15 @@ LE Pairing Responder | |||||
| :local: | ||||||
| :depth: 2 | ||||||
|
|
||||||
| The LE Pairing Responder model is a vendor model. | ||||||
| The LE Pairing Responder model is a vendor model and it requires :kconfig:option:`CONFIG_BT_APP_PASSKEY` option to be enabled. | ||||||
| This model can be used to hand over a passkey that will authenticate a Bluetooth LE connection over a mesh network when it is not possible to use other pairing methods. | ||||||
|
|
||||||
| Before the pairing is initiated, an initiator should send an LE Pairing message with Passkey Reset sub-opcode to set a new passkey for the next pairing request. | ||||||
| Before the pairing is initiated, an initiator should send an LE Pairing message with Passkey Reset sub-opcode. This will trigger random passkey generation by LE Pairing Responder model or return the passkey set by the app using :c:func:`bt_mesh_le_pair_resp_passkey_set` function. | ||||||
|
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.
Suggested change
|
||||||
| The passkey returned in the LE Pairing message with the Passkey Status sub-opcode should be used for the next pairing. | ||||||
|
|
||||||
| The passkey is generated using the :c:func:`bt_rand` function and set to the host using the :c:func:`bt_passkey_set` function. | ||||||
| The latter requires the :kconfig:option:`CONFIG_BT_FIXED_PASSKEY` option to be enabled. | ||||||
|
|
||||||
| .. note:: | ||||||
| The warning generated by the :kconfig:option:`CONFIG_BT_FIXED_PASSKEY` option should be disregarded as long as the application always invalidates the previously used passkey by calling the :c:func:`bt_mesh_le_pair_resp_passkey_invalidate` function regardless of the pairing result (see below). | ||||||
|
|
||||||
| This model requires an application to only enable the display capability for the LE pairing by setting the :c:member:`bt_conn_auth_cb.pairing_display` callback. | ||||||
| After every pairing request, the application must invalidate the previously used passkey by calling the :c:func:`bt_mesh_le_pair_resp_passkey_invalidate` function. | ||||||
| This function can be called from callbacks :c:member:`bt_conn_auth_info_cb.pairing_complete` and :c:member:`bt_conn_auth_info_cb.pairing_failed`. | ||||||
| See the :file:`samples/bluetooth/mesh/common/smp_bt_auth.c` file for the reference. | ||||||
| This model requires an application to only enable the display capability for the LE pairing by setting the :c:member:`bt_conn_auth_cb.pairing_display` callback. The application must also set the :c:member:`bt_conn_auth_cb.app_passkey` callback to use the passkey generated by LE Pairing Responder model. | ||||||
| After every pairing request, the application must invalidate the previously used passkey by calling the :c:func:`bt_mesh_le_pair_resp_passkey_invalidate` function or calling :c:func:`bt_mesh_le_pair_resp_passkey_set` with :ref:`BT_PASSKEY_RAND` value. | ||||||
| Those functions can be called from callbacks :c:member:`bt_conn_auth_info_cb.pairing_complete` and :c:member:`bt_conn_auth_info_cb.pairing_failed`. See the :file:`samples/bluetooth/mesh/common/smp_bt_auth.c` file for the reference. | ||||||
|
|
||||||
| .. figure:: images/bt_mesh_le_pair_resp.svg | ||||||
| :alt: Diagram of interaction between an Initiator and the LE Pairing Responder model | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -35,6 +35,7 @@ extern "C" { | |||||
| /* @brief Invalidate previously used passkey. | ||||||
| * | ||||||
| * A user must call this function when a pairing request completes regardless of the status. | ||||||
| * | ||||||
|
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. Is this needed? 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. nope |
||||||
| */ | ||||||
| void bt_mesh_le_pair_resp_passkey_invalidate(void); | ||||||
|
|
||||||
|
|
@@ -43,11 +44,23 @@ void bt_mesh_le_pair_resp_passkey_invalidate(void); | |||||
| * By default, passkeys will be randomly generated on every new request. This function allows to use | ||||||
| * pre-defined passkey instead. | ||||||
| * | ||||||
| * @params passkey Passkey to use for the pairing, or @ref BT_PASSKEY_INVALID to use randomly | ||||||
| * @params passkey Passkey to use for the pairing, or @ref BT_PASSKEY_RAND to use randomly | ||||||
| * generated passkey again. | ||||||
| */ | ||||||
| void bt_mesh_le_pair_resp_passkey_set(uint32_t passkey); | ||||||
|
|
||||||
| /** @brief Get passkey to be used in the very next pairing. | ||||||
| * | ||||||
| * This function will return the passkey set by the @ref bt_mesh_le_pair_resp_passkey_set function or it will return | ||||||
| * a randomly generated passkey by the Reset message. | ||||||
| * | ||||||
| * If the passkey has never been set or the Reset message has never been received, @ref BT_PASSKEY_RAND will be returned. | ||||||
| * | ||||||
| * @return Passkey to be used in the very next pairing; | ||||||
| * @ref BT_PASSKEY_RAND if passkey is not set. | ||||||
| */ | ||||||
| const uint32_t bt_mesh_le_pair_resp_passkey_get(void); | ||||||
|
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. Not sure const-qualifier is needed here.
Suggested change
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. actually not; initially I was using pointer I think it is leftover. |
||||||
|
|
||||||
| /** @cond INTERNAL_HIDDEN */ | ||||||
|
|
||||||
| extern const struct bt_mesh_model_op _bt_mesh_le_pair_resp_op[]; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| CONFIG_MCUMGR_TRANSPORT_BT_PERM_RW_AUTHEN=y | ||
| CONFIG_BT_SMP=y | ||
| CONFIG_BT_FIXED_PASSKEY=y | ||
| CONFIG_BT_APP_PASSKEY=y | ||
| CONFIG_BT_MESH_LE_PAIR_RESP=y | ||
| CONFIG_BT_SMP_SC_ONLY=y | ||
| CONFIG_BT_SMP_ALLOW_UNAUTH_OVERWRITE=n |
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.
Can we show the usage of
bt_mesh_le_pair_resp_passkey_getfunction on diagram? In the app_passkey callback.