Skip to content
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

[nrf fromtree] bluetooth: host: Allow for ECDH operations through sys… #2495

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions subsys/bluetooth/host/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1002,10 +1002,11 @@ config BT_ECC
select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT
select PSA_WANT_ECC_SECP_R1_256
imply MBEDTLS_PSA_P256M_DRIVER_ENABLED if MBEDTLS_PSA_CRYPTO_C
select BT_LONG_WQ
imply BT_LONG_WQ
help
If this option is set, internal APIs will be available to perform ECDH operations
through the long work queue. operations needed e.g. by LE Secure Connections.
If this option is set, internal APIs will be available to perform ECDH operations through
the long work queue (or system work queue). The operations are used e.g. by LE Secure
Connections.

endif # BT_HCI_HOST

Expand Down
12 changes: 10 additions & 2 deletions subsys/bluetooth/host/ecc.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,11 @@ int bt_pub_key_gen(struct bt_pub_key_cb *new_cb)

atomic_clear_bit(bt_dev.flags, BT_DEV_HAS_PUB_KEY);

bt_long_wq_submit(&pub_key_work);
if (IS_ENABLED(CONFIG_BT_LONG_WQ)) {
bt_long_wq_submit(&pub_key_work);
} else {
k_work_submit(&pub_key_work);
}

return 0;
}
Expand Down Expand Up @@ -338,7 +342,11 @@ int bt_dh_key_gen(const uint8_t remote_pk[BT_PUB_KEY_LEN], bt_dh_key_cb_t cb)
sys_memcpy_swap(&ecc.public_key_be[BT_PUB_KEY_COORD_LEN],
&remote_pk[BT_PUB_KEY_COORD_LEN], BT_PUB_KEY_COORD_LEN);

bt_long_wq_submit(&dh_key_work);
if (IS_ENABLED(CONFIG_BT_LONG_WQ)) {
bt_long_wq_submit(&dh_key_work);
} else {
k_work_submit(&dh_key_work);
}

return 0;
}
Expand Down