Skip to content

BLE: Security Manager #6188

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

Merged
merged 346 commits into from
Mar 2, 2018
Merged

BLE: Security Manager #6188

merged 346 commits into from
Mar 2, 2018

Conversation

paul-szczepanek-arm
Copy link
Member

Description

The existing Security Manager is very limited. This extends the API and actually implements the functionality. So far this only works for hardware using the Cordio stack and will require porting from maintainers of other devices.

This pull request includes legacy pairing and link security. Secure Connections are included but not tested due to lack of hardware targets supporting it.

Tested on the cordio stack port for the ST nucleo and discovery using the new Security Manager example (ARMmbed/mbed-os-example-ble#136).

(Handbook: ARMmbed/mbed-os-5-docs#418)

Pull request type

  • Fix
  • Refactor
  • New Target
  • Feature

pan- and others added 30 commits January 17, 2018 15:50
Palsm cordio and Nordic implementation
*
* @param[in] connectionHandle connection connectionHandle
*/
virtual void confirmationRequest(ble::connection_handle_t connectionHandle) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are you supposed to confirm ? I believe this should take the value to confirm in parameter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those comments are bad, will clarify, this is confirmation that passkeys match

Copy link
Member

@pan- pan- Mar 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you push the confirmation value to the user ? According to the specification:

If both devices have output capabilities, this step requires the displaying of a
user confirmation value. This value should be displayed until the end of step 2.
If one or both devices do not have output capabilities, the same protocol is
used but the Hosts will skip the step asking for the user confirmation.

User confirmation is required in Numeric Comparison; not Passkey entry.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you use displayPasskey on both (supplying the number to display) and then request confirmation on one or both and application calls confirmationEntered

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you're right!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added diagram to overview doc and comments in doxygen

}

// set the distribution flags in the db
_db.set_distribution_flags(cb->db_entry, *cb);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deref of cb outside the cb check

ControlBlock_t *cb = get_control_block(connection);
if (cb) {
if (cb->encryption_requested) {
enable_encryption(connection);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed as already encrypted

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

@cmonr
Copy link
Contributor

cmonr commented Mar 1, 2018

Heads up @paul-szczepanek-arm, there's now a conflicting file in master.

Copy link
Member

@pan- pan- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent; I've left few comments for the last mistakes.

@@ -14,16 +14,150 @@
* limitations under the License.
*/

#ifndef __SECURITY_MANAGER_H__
#define __SECURITY_MANAGER_H__
#ifndef _SECURITY_MANAGER_H_
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier starting with an underscore and an uppercase letter are reserved :(.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixd

*
*
* Sequence diagram "Just Works" pairing
*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be interesting to surround diagrams with verbatim and endverbatim tags: https://www.stack.nl/~dimitri/doxygen/manual/commands.html#cmdverbatim

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

surrounded

* it. If either side doesn't support it Legacy Pairing will be used. This is an older standard of pairing.
* If higher security is required legacy pairing can be disabled by calling allowLegacyPairing(false);
*
* How to use
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It maybe interresting to use the tag par: https://www.stack.nl/~dimitri/doxygen/manual/commands.html#cmdpar

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added paragraphs

* @param[in] whitelist pointer to the whitelist filled with entries based on bonding information
*/
virtual void whitelistFromBondTable(Gap::Whitelist_t* whitelist) {
if (whitelist) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must go.

namespace ble {
namespace generic {

using pal::advertising_peer_address_type_t;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using directives shouldn't be used in headers.

* Implemented by classes that are reacting to connection changes.
* @see ConnectionEventMonitor
*/
class ConnectionEventHandler {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be an inner class of ConnectionEventMonitor.

* limitations under the License.
*/

#ifndef _PAL_MEMORY_SECURITY_DB_H_
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The leading underscore should be removed.

@@ -0,0 +1,72 @@
/* mbed Microcontroller Library
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea how it gets here. This file should be removed.

Copy link
Member

@pan- pan- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheer. LGTM!

@cmonr
Copy link
Contributor

cmonr commented Mar 1, 2018

Woo! Let's kick off CI for this PR!

/morph build

@mbed-ci
Copy link

mbed-ci commented Mar 1, 2018

Build : SUCCESS

Build number : 1318
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6188/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Mar 1, 2018

@cmonr
Copy link
Contributor

cmonr commented Mar 1, 2018

A single Windows VM had issues pulling sources to export. Restarting the build.

/morph export-build

@mbed-ci
Copy link

mbed-ci commented Mar 2, 2018

@mbed-ci
Copy link

mbed-ci commented Mar 2, 2018

@adbridge adbridge merged commit ed17033 into ARMmbed:master Mar 2, 2018
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.

7 participants