New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 805112 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Last visit > 30 days ago
Closed: Apr 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug

Blocking:
issue 842952



Sign in to add a comment

Implement phase 3 of LE legacy pairing

Project Member Reported by mcchou@chromium.org, Jan 23 2018

Issue description

This bug tracks the Implementation of LE Legacy pairing phase 3 based on Just Work pairing.

Tasks:
(1) Implement the state machine for the following packet types
- key distribution
- encryption information
- master identification
- identity information
- identity address information
- signning information
- security request
(2) Implement algorithm for  key and number 
(3) Implement error reporting during pairing process
(4) Mange keys and numbers which are exchanged during the key distribution. Improve the existing persist helper to suit the need of Database approach for key management
(5) Added L2CAP API and HCI method definition for commands required for encryption and key exchanging.

Tests:
(1) Pass all sm unittests
(2) Just work pairing should complete correctly with our test application.

 
Project Member

Comment 1 by bugdroid1@chromium.org, Jan 25 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/newblue/+/8b6ac06be5034b3bef479dc815b62436e6e528cf

commit 8b6ac06be5034b3bef479dc815b62436e6e528cf
Author: Miao-chen Chou <mcchou@chromium.org>
Date: Thu Jan 25 00:06:21 2018

hci: support LE Start Encryption Command (1/3)

Add function definition of LE Start Encryption Command.

BUG= chromium:805112 
TEST=build

Change-Id: I921fb1b830bf1b31c0b65a33f46205201efc27de

[modify] https://crrev.com/8b6ac06be5034b3bef479dc815b62436e6e528cf/hci_templated_commands.h
[modify] https://crrev.com/8b6ac06be5034b3bef479dc815b62436e6e528cf/hci.h

Project Member

Comment 2 by bugdroid1@chromium.org, Jan 25 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/newblue/+/f5b64e67a9259e4816aa964711af93e8812a18ec

commit f5b64e67a9259e4816aa964711af93e8812a18ec
Author: Miao-chen Chou <mcchou@chromium.org>
Date: Thu Jan 25 00:12:10 2018

hci: expose hciLeEncryptConn function for encrypting a connection (2/3)

Provide a method for L2CAP layer to start the encryption on a connection.

BUG= chromium:805112 
TEST=build

Change-Id: I6b4776d5070802d6398d5b7fea93ccbce9c7b070

[modify] https://crrev.com/f5b64e67a9259e4816aa964711af93e8812a18ec/hci.c
[modify] https://crrev.com/f5b64e67a9259e4816aa964711af93e8812a18ec/hci.h

Project Member

Comment 3 by bugdroid1@chromium.org, Jan 25 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/newblue/+/83c68fbb960b50f9042358848082858359d6ccf9

commit 83c68fbb960b50f9042358848082858359d6ccf9
Author: Miao-chen Chou <mcchou@chromium.org>
Date: Thu Jan 25 00:12:10 2018

l2cap: add l2cApiLeEncryptConn (3/3)

BUG= chromium:805112 
TEST=(1) Call l2cApiLeEncryptConn in smRx() case SM_PAIRING_RAND
directly with recognizable patterns as parameters.
     (2) Verify that HCI LE Start Encryption Command is sent with btmon.

Change-Id: Ia6d90241c96c2a9aa79ed52d0dbed92609112df4

[modify] https://crrev.com/83c68fbb960b50f9042358848082858359d6ccf9/l2cap.c
[modify] https://crrev.com/83c68fbb960b50f9042358848082858359d6ccf9/l2cap.h

Project Member

Comment 4 by bugdroid1@chromium.org, Jan 25 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/newblue/+/454598631f6ce5f720bb420a8e7a1a4bcd6aaf12

commit 454598631f6ce5f720bb420a8e7a1a4bcd6aaf12
Author: Dmitry Grinberg <dmitrygr@google.com>
Date: Thu Jan 25 20:06:30 2018

hci: call into L2C for key requests for LE connections

Call L2CAP for LE keys. When a request comes in, L2C code will
be asked for a key and will have the option of saying "yes here
it is" or "no"

BUG= chromium:805112 
TEST=build

Change-Id: I2fd66caef5127d07d1de27bf474547d251a9349d

[modify] https://crrev.com/454598631f6ce5f720bb420a8e7a1a4bcd6aaf12/l2cap.c
[modify] https://crrev.com/454598631f6ce5f720bb420a8e7a1a4bcd6aaf12/l2cap.h
[modify] https://crrev.com/454598631f6ce5f720bb420a8e7a1a4bcd6aaf12/hci.c
[modify] https://crrev.com/454598631f6ce5f720bb420a8e7a1a4bcd6aaf12/hci_templated_commands.h

Project Member

Comment 5 by bugdroid1@chromium.org, Jan 29 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/newblue/+/7fa293403aac03514095cff1dd0ee90176ddded7

commit 7fa293403aac03514095cff1dd0ee90176ddded7
Author: Dmitry Grinberg <dmitrygr@google.com>
Date: Mon Jan 29 23:53:11 2018

l2c,hci: plumb key req,resp up to L2C

* an L2C conn can set itself up as a "security manager" with l2c
* if it so does, any key requests go to it via a new "state"
* add L2C func to accept key and pass to hci
* update hci to expect said reply async (previously was sync)

BUG= chromium:805112 
TEST=build

Change-Id: I0c8e4a6f13f8d157bb5ce3df199d11d35a7ebbe2

[modify] https://crrev.com/7fa293403aac03514095cff1dd0ee90176ddded7/l2cap.c
[modify] https://crrev.com/7fa293403aac03514095cff1dd0ee90176ddded7/l2cap.h
[modify] https://crrev.com/7fa293403aac03514095cff1dd0ee90176ddded7/hci.c
[modify] https://crrev.com/7fa293403aac03514095cff1dd0ee90176ddded7/hci.h

Project Member

Comment 6 by bugdroid1@chromium.org, Feb 2 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/newblue/+/ff18cd5b774600bc2a05d27a42fdaaa7357e9ce3

commit ff18cd5b774600bc2a05d27a42fdaaa7357e9ce3
Author: Dmitry Grinberg <dmitrygr@google.com>
Date: Thu Feb 01 21:39:22 2018

persist: add ability to store per-device "numbers"

A number is a 64-bit value stored per-device (or for self if "addr" is
NULL). Basically just like a key, except it is a number.

BUG= chromium:805112 
TEST=build
Change-Id: Iee5d9e687a111f5554398abec9ef60ea67b0ca76

[modify] https://crrev.com/ff18cd5b774600bc2a05d27a42fdaaa7357e9ce3/persist.c
[modify] https://crrev.com/ff18cd5b774600bc2a05d27a42fdaaa7357e9ce3/persist.h

Project Member

Comment 7 by bugdroid1@chromium.org, Feb 21 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/newblue/+/45c2fc14a82565b33fc9d93315aac744d59888e7

commit 45c2fc14a82565b33fc9d93315aac744d59888e7
Author: Miao-chen Chou <mcchou@chromium.org>
Date: Thu Feb 08 03:08:58 2018

persist: add the default numbers property array and random number generation

This adds the default numbers property array if it does not exist during
loading. This also adds the function reusing the function generating random key
to generate random number for the first time when the local device's properties
are created.

Unittest PersistTestSuite is added, and its tests include
- LocalDeviceNameGetterAndSetter
- LocalDiscoveryGetterAndSetter
- DeviceGetAddDel
- DeviceKeyAddGetDel
- DeviceNumerAddGetDel

BUG= chromium:805112 
TEST=build and run unittest by "./new_blue_unittest
     --gtest_filter=*PersistTestSuite*"

Change-Id: Ic038c997d3e7f43df1af9a3c0284a0b46d814bf6

[modify] https://crrev.com/45c2fc14a82565b33fc9d93315aac744d59888e7/config.h
[add] https://crrev.com/45c2fc14a82565b33fc9d93315aac744d59888e7/tests/persist_unittest.cc
[modify] https://crrev.com/45c2fc14a82565b33fc9d93315aac744d59888e7/Makefile
[modify] https://crrev.com/45c2fc14a82565b33fc9d93315aac744d59888e7/tests/sm_unittest.cc
[modify] https://crrev.com/45c2fc14a82565b33fc9d93315aac744d59888e7/persist.c
[modify] https://crrev.com/45c2fc14a82565b33fc9d93315aac744d59888e7/persist.h
[add] https://crrev.com/45c2fc14a82565b33fc9d93315aac744d59888e7/tests/unittest.cc

Description: Show this description
Description: Show this description
Project Member

Comment 10 by bugdroid1@chromium.org, Mar 7 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/newblue/+/6a05b429648bf2e0a35dfec692057677acc2bbbf

commit 6a05b429648bf2e0a35dfec692057677acc2bbbf
Author: Dmitry Grinberg <dmitrygr@google.com>
Date: Wed Mar 07 22:20:32 2018

hci: fix LTK key req issues

1. key request being sent to ACL had wrong connection ID (raw HCI
connection Id was being sent instead of the ACL connection handle.
2. ACL not replying caused a deadlock by calling a sync() command in a
worker thread. Fixed by calling the request deny func async.

BUG= chromium:805112 
TEST=build, run SM where ACL connection ID matches in key request
and verify that no deadlock error printed

Change-Id: I8014ca94796cd455b5825856b75ffc6c2cc9b5c1

[modify] https://crrev.com/6a05b429648bf2e0a35dfec692057677acc2bbbf/hci.c

Project Member

Comment 11 by bugdroid1@chromium.org, Mar 7 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/newblue/+/243f44e5adbcbff59051f01e128b5f7ee34081c9

commit 243f44e5adbcbff59051f01e128b5f7ee34081c9
Author: Dmitry Grinberg <dmitrygr@google.com>
Date: Wed Mar 07 22:32:52 2018

hci: record self addr when accepting LE conns

Previously the code did not do it well since when the advertising set
was disabled, it was no longer possible to query its "self addr". Now we
query it before disabling, thus avoiding the issue.

BUG= chromium:805112 
TEST=builds & conn addr seems to work. mcchou@ will test with SM when
she gets there

Change-Id: I2bf68a29fbb808ee5e9b8cfca71b5569db7b869f

[modify] https://crrev.com/243f44e5adbcbff59051f01e128b5f7ee34081c9/hci.c

Project Member

Comment 12 by bugdroid1@chromium.org, Mar 10 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/newblue/+/3fe1e6f94674a7b78f864aca09c169015eddfa16

commit 3fe1e6f94674a7b78f864aca09c169015eddfa16
Author: Miao-chen Chou <mcchou@chromium.org>
Date: Sat Mar 10 04:05:07 2018

persist: support the keys and numbers needed for SMP key manager

This adds the following key types and number types to suit the key
management of SMP.
- KEY_TYPE_LTK
- KEY_TYPE_MY_LTK
- PERSIST_NUM_TYPE_SM_MY_RANDOM
- PERSIST_NUM_TYPE_SM_EDIV
- PERSIST_NUM_TYPE_SM_MY_DIV

This also removed the setup of Number Property for the local device and
the corresponding unittest, since the generated numbers should be
associated with each peer device.

BUG= chromium:805112 
TEST=build and run new_blue_test. Perform a read operation on"Current
Time" characteristic to trigger the authentication request and verify
the phase transit to SM_PHASE_DONE

Change-Id: I31ff33f62c9f6d280f5b3752bab11b30e853e283
Reviewed-on: https://chromium-review.googlesource.com/956529
Commit-Ready: Miao-chen Chou <mcchou@chromium.org>
Tested-by: Miao-chen Chou <mcchou@chromium.org>
Reviewed-by: Dmitry Grinberg <dmitrygr@google.com>

[modify] https://crrev.com/3fe1e6f94674a7b78f864aca09c169015eddfa16/persist.c
[modify] https://crrev.com/3fe1e6f94674a7b78f864aca09c169015eddfa16/tests/persist_unittest.cc
[modify] https://crrev.com/3fe1e6f94674a7b78f864aca09c169015eddfa16/persist.h
[modify] https://crrev.com/3fe1e6f94674a7b78f864aca09c169015eddfa16/Makefile

Project Member

Comment 13 by bugdroid1@chromium.org, Mar 10 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/newblue/+/e5c6dfd74dfe28828cc9588798fda6780b1bac2a

commit e5c6dfd74dfe28828cc9588798fda6780b1bac2a
Author: Miao-chen Chou <mcchou@chromium.org>
Date: Sat Mar 10 04:05:08 2018

sm: implement pairing phase 3 based on Just Work pairing

This implements phase 3 of pairing process based on the Just Work pairing
algorithm. The following packet types are handled.
- key distribution
- encryption information
- master identification
- identity information
- identity address information
- signning information
- security request

The responder role during Just Work pairing is verified working.
However, the initiator role is not yet verified so as the connection
re-establishment.

BUG= chromium:805112 
TEST=build and run new_blue_test. Perform a read operation on "Current
Time" characteristic to trigger the authentication request and verify
the phase transits to SM_PHASE_DONE as the responder role

Change-Id: I6bd8d58ea5eb2cf4c30bc60eeaf18cbc8a497ca5
Reviewed-on: https://chromium-review.googlesource.com/956530
Commit-Ready: Miao-chen Chou <mcchou@chromium.org>
Tested-by: Miao-chen Chou <mcchou@chromium.org>
Reviewed-by: Dmitry Grinberg <dmitrygr@google.com>

[modify] https://crrev.com/e5c6dfd74dfe28828cc9588798fda6780b1bac2a/sm.c

Project Member

Comment 14 by bugdroid1@chromium.org, Mar 13 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/newblue/+/0c5e3d292c86eff527d50a6347fa74502d1b6ac9

commit 0c5e3d292c86eff527d50a6347fa74502d1b6ac9
Author: Miao-chen Chou <mcchou@chromium.org>
Date: Tue Mar 13 00:45:27 2018

hci, l2cap: add the handler for Encryption Key Refresh Complete Event

This sets the handler in hci, adds the l2cap API to handle the key
refresh logic and adds the notification to parties who care about this
event.

BUG= chromium:805112 
TEST=build

Change-Id: I0c2a67a5bedfdeddd45005c84b73278f579609d3

[modify] https://crrev.com/0c5e3d292c86eff527d50a6347fa74502d1b6ac9/l2cap.c
[modify] https://crrev.com/0c5e3d292c86eff527d50a6347fa74502d1b6ac9/l2cap.h
[modify] https://crrev.com/0c5e3d292c86eff527d50a6347fa74502d1b6ac9/hci.c

Project Member

Comment 15 by bugdroid1@chromium.org, Mar 13 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/newblue/+/18136f0611d950b797dac123c1e99e1d6e8b1b58

commit 18136f0611d950b797dac123c1e99e1d6e8b1b58
Author: Miao-chen Chou <mcchou@chromium.org>
Date: Tue Mar 13 00:45:27 2018

sm, gatt: handle the L2C_ENCR_KEY_REF event

This adds the logic in sm and gatt to handle the L2C_ENCR_KEY_REF event.
In sm, this event is used to perform the phase transition of the case
where LTK is used as the new key after encrypted with STK during the
pairing process.
In gatt, this event is viewed as a source of updating the encryption
state.

BUG= chromium:805112 
TEST=(1)Build and run new_blue_test.
     (2)Perform a read operation on "Current Time" characteristic to
        trigger the authentication request and verify the phase transits
        to SM_PHASE_LTK_ENCRYPTED as the responder role
     (3)Verify that GATT stops complaining about unhandled L2CAP event

Change-Id: Ie6f25804fdf3cb104eb2d884a47439804c8f8fe3

[modify] https://crrev.com/18136f0611d950b797dac123c1e99e1d6e8b1b58/sm.c
[modify] https://crrev.com/18136f0611d950b797dac123c1e99e1d6e8b1b58/gatt.c

Labels: -M-66 M-69
Cc: -kobbad@chromium.org dwmclary@chromium.org
Status: Fixed (was: Started)
Blocking: 842952
Status: Verified (was: Fixed)

Sign in to add a comment