Commit Graph

18 Commits

Author SHA1 Message Date
Szymon Janc b1e6bb5ef7 Bluetooth: Compile only required parts of keys support
Depending on BR/EDR and SMP support only subset of keys functionality
is needed. This fix compilation if SMP is disabled and BR/EDR is
enabled.

Change-Id: Icf4b5ad1a214e514e03c4c9a359d151e69cab2ab
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-03-23 10:36:28 +01:00
Arkadiusz Lichwa 158cdbf91a Bluetooth: Fix checkpatch error/warnings
Fixes some checkpatch's errors/warning in HCI stack code.

Change-Id: I105fb491b5509f72549ab788764b1386ce3af47f
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-03-21 14:48:40 +01:00
Arkadiusz Lichwa 53de0818f9 Bluetooth: BR/EDR: Update keys management
Updates keys interfaces allowing to store and locate legacy link key
in keys database.

Change-Id: Ibd50edff890e998e3c6f80ee7f1442dff7a7c91f
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:25:20 -05:00
Johan Hedberg 25f6579016 Bluetooth: Move all bt_conn related APIs to conn.h
To have some proper split of conn.h and bluetooth.h APIs make sure all
bt_conn related ones are in conn.h. This also helps avoid forward
declarations for some upcoming patches where we need bluetooth.h
defines from within conn.h.

Change-Id: Ief3d32118a6749fb5785dab6cb3fee4ebb86ddb4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:19 -05:00
Szymon Janc 51f8ca59cd Bluetooth: Add newline to log macros
Make newline part of log macros so that caller doesn't have to
append '\n' every time logs are used. This make sure that no
log will be missing new line which results in concatenated log
messages.

Change-Id: I3231ae747c790816dbc1608e0a3bd56467ba0a1b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:59 -05:00
Javier B Perez Hernandez f7fffae8aa Change BSD-3 licenses to Apache 2
Change all the Intel and Wind River code license from BSD-3 to Apache 2.

Change-Id: Id8be2c1c161a06ea8a0b9f38e17660e11dbb384b
Signed-off-by: Javier B Perez Hernandez <javier.b.perez.hernandez@linux.intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:29 -05:00
Szymon Janc cc261005f2 Bluetooth: Remove includes from internal headers
All required includes should be placed in source file that includes
internal header.

Change-Id: I161e7ebe2e62377ea4cf03f759d48f5900103076
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Szymon Janc 90121208ab Bluetooth: Simplify keys management code
There is no need for separate lists of each key type as this
lookup optimization is of little benefit. Removing those results in
much simpler and smaller code. Using array over list also improves
data locality and thus cache utilization.

This patch results in following code size reduction:
keys.o from 14208 to 10028 bytes
microkernel.elf from 599417 to 597091 bytes

Change-Id: Ia8fe21ca3d79f668d8550c4376fa403e8778861e
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:38 -05:00
Luiz Augusto von Dentz 69130ed2c0 Bluetooth: keys: Add bt_keys_find_addr
bt_keys_find_addr lookup for any keys for the given address thus it can
be used to check if bonding procedure has been perfomed.

Change-Id: Ia398866418a908e35c8cd70e19b2bb2aa0a0be96
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:44 -05:00
Andrei Emeltchenko ef703e1317 Bluetooth: Add local and remote CSRK keys
Add local and remote Connection Signature Resolving Keys and helper
functions.

Change-Id: I63af2e566dccc6ffb5397d28bde6f04bc78b93b1
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:14:41 -05:00
Johan Hedberg d0950676e8 Bluetooth: Add bt_keys_add_type() convenience API
When we already have bt_keys object and want to ensure that it
contains a certain key type it's wasteful to have to go and call
bt_keys_get_type() (because of the extra lookup it'll do).

Change-Id: I97831e6817e734d7e8b6aa18c7917736577f3438
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:39 -05:00
Szymon Janc fd79c5f913 Bluetooth: Add support for storing LTK
This allows to store LTK used in further connections encryption
when acting as a master.

Change-Id: I5711d7a9ec5f36add66fbf07e546ebd64ecb3c8b
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:31 -05:00
Johan Hedberg a2241a55fd Bluetooth: Add config option for security keys handling
This makes sure that keys.c doesn't always have its BT_DBG logs
enabled.

Change-Id: Ia97149f08a448f55a15c3282f72afb23c495b715
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:31 -05:00
Johan Hedberg 939544b75d Bluetooth: Move logging helpers to a dedicated header file
To make it clearer that these helpers are intended only for
Bluetooth-subsystem internal code, move them to a separate file.

Change-Id: Iea64780f5c61c1c96e12c9df378676bc49498fe4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:23 -05:00
Johan Hedberg 44795a6574 Bluetooth: Add API for looking up IRKs
Add an API to bt_keys for looking up IRKs based on a given RPA.

Change-Id: If9c0569c8d619f9cb2b6174d77c25dd5358db863
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:17 -05:00
Johan Hedberg 40e6a1288c Bluetooth: Add IRK storage
Add support to store IRKs through the bt_keys API.

Change-Id: I01f713f8ad3657605a8bc2738db349d25bb89649
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:17 -05:00
Johan Hedberg 275c0316ff Bluetooth: Refactor key handling to prepare for more key types
We'll need to store many other keys besides slave LTKs. Refactor the
key handling code so that new types can be easily added.

Change-Id: I768db9cb29e8e73e87713e59f7b80af80399f20d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:17 -05:00
Johan Hedberg 384533912d Bluetooth: Move key handling to separate files
In preparation of adding more key support and to not bloat hci_core.c
prepare a new .c file for the key management code.

Change-Id: I5129a7a3a5d495a299f75e4e669253446a276142
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:17 -05:00