- Notifications
You must be signed in to change notification settings - Fork 8.2k
Bluetooth: Host: Add encrypted advertising #55225
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
Bluetooth: Host: Add encrypted advertising #55225
Conversation
5141a4c to e281606 Compare
Thalley left a comment
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.
The second commit should be tests: bluetooth:
Why is this being added as a library, instead of just an API in bluetooth.h?
e281606 to bfec8d5 Compare
The host is pretty bloated and tries to be too nice to the user. This pushes functionality that shouldn't be in the host to be inside the host (settings usage, a bunch of gatt functionality, adv resume comes to mind). That functionality then makes use of the internal state and functions, because why not, it's more efficient and that results in:
That's why we'd like to slim down the host to a maintainable core + some libraries on top. |
| The current tests only check that the advdata encrypts and decrypts back to itself. It would be nice to have some tests that checks that the encrypted data is correct as well. I suggest we use the "Encrypted Advertising Data Sample Data" from the CSS. |
bfec8d5 to 004f862 Compare 004f862 to e809c6b Compare
This sounds like it should be done in a separate PR. Having this |
e809c6b to 0110c3a Compare 617ef27 to 6e6ef05 Compare | @theob-pro I think it might make sense to rename the header file simply to |
6fbedab to 42224c6 Compare 42224c6 to e6bc5ca Compare | Rebased to resolve file conflict ( |
e6bc5ca to 625b8a5 Compare 625b8a5 to a2f4789 Compare | Rebased to resolve file conflict ( |
Thalley left a comment
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.
My remaining comments are about undocumented/required formatting changes, and one comment about a LOG_WRN that I think should be LOG_DBG, but it's not bad enough that I will block this PR anymore :)
| I agree, let's get this in, and @theob-pro and @Thalley can discuss the small stuff in a new PR. |
jhedberg left a comment
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.
Sorry for being slow to review this. I've tried to keep my comments restricted to things which require more effort/pain to fix later in the game, i.e. the API details.
a2f4789 to 60cb6c9 Compare Create a new Bluetooth library and add Encrypted Advertising Data to it. Encrypted Advertising Data is a new feature from the Bluetooth Core Specification 5.4. It provides a way to communicate encrypted data in advertising, scan response and EIR packets. To do that it introduce a new advertising data type called `Encrypted Advertising Data`. Also, it introduce a new characteristic called `Encrypted Data Key Material`, this provides a way to share the key material. The library add two main functions `bt_ead_encrypt` and `bt_ead_decrypt`. Two helper functions are added to `bluetooth.h`. `bt_data_get_len` and `bt_data_serialize`, the first one allow the user to get the total size of a set of `bt_data` structures; the second one generate a spec compliant bytes array from a `bt_data` structure. The last one is useful because `bt_ead_encrypt` take as input those kind of bytes array. Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Add a new BabbleSim test that use the sample data from the Supplement to the Bluetooth Core Specification to validate the Encrypted Advertising Data feature implementation. Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
60cb6c9 to 30e6665 Compare
Create a new Bluetooth library and add Encrypted Advertising Data to it.
Encrypted Advertising Data is a new feature from the Bluetooth Core Specification 5.4. It provides a way to communicate encrypted data in advertising, scan response and EIR packets. To do that it introduce a new advertising data type called
Encrypted Advertising Data. Also, it introduce a new characteristic calledEncrypted Data Key Material, this provides a way to share the key material.The library add two main functions
bt_ead_encryptandbt_ead_decrypt.Also, add a new BabbleSim test that use the sample data from the Supplement to the Bluetooth Core Specification to validate the encryption, decryption and authentication.
Related issue: #55081