Bluetooth: crypto: Refactor a few items
After merging #51809, a few things were spotted that needed tweaking. Among them: - Rename the folder from bt_crypto to crypto, since the prefix is unnecesary - Remove the include folder - Remove the path from the global include paths Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
parent
d21dff001f
commit
b90c27238a
10 changed files with 16 additions and 10 deletions
|
@ -10,7 +10,7 @@ add_subdirectory_ifdef(CONFIG_BT_SHELL shell)
|
||||||
add_subdirectory_ifdef(CONFIG_BT_CONN services)
|
add_subdirectory_ifdef(CONFIG_BT_CONN services)
|
||||||
add_subdirectory_ifdef(CONFIG_BT_MESH mesh)
|
add_subdirectory_ifdef(CONFIG_BT_MESH mesh)
|
||||||
add_subdirectory_ifdef(CONFIG_BT_AUDIO audio)
|
add_subdirectory_ifdef(CONFIG_BT_AUDIO audio)
|
||||||
add_subdirectory_ifdef(CONFIG_BT_CRYPTO bt_crypto)
|
add_subdirectory_ifdef(CONFIG_BT_CRYPTO crypto)
|
||||||
|
|
||||||
if(CONFIG_BT_CTLR AND CONFIG_BT_LL_SW_SPLIT)
|
if(CONFIG_BT_CTLR AND CONFIG_BT_LL_SW_SPLIT)
|
||||||
add_subdirectory(controller)
|
add_subdirectory(controller)
|
||||||
|
|
|
@ -186,7 +186,7 @@ rsource "common/Kconfig"
|
||||||
rsource "host/Kconfig"
|
rsource "host/Kconfig"
|
||||||
rsource "controller/Kconfig"
|
rsource "controller/Kconfig"
|
||||||
rsource "shell/Kconfig"
|
rsource "shell/Kconfig"
|
||||||
rsource "bt_crypto/Kconfig"
|
rsource "crypto/Kconfig"
|
||||||
|
|
||||||
endif # BT_HCI
|
endif # BT_HCI
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,4 @@
|
||||||
|
|
||||||
zephyr_library()
|
zephyr_library()
|
||||||
|
|
||||||
zephyr_include_directories(include)
|
|
||||||
|
|
||||||
zephyr_library_sources(bt_crypto.c)
|
zephyr_library_sources(bt_crypto.c)
|
|
@ -7,15 +7,16 @@
|
||||||
|
|
||||||
#include <zephyr/sys/byteorder.h>
|
#include <zephyr/sys/byteorder.h>
|
||||||
|
|
||||||
#include <bt_crypto.h>
|
|
||||||
#include <tinycrypt/cmac_mode.h>
|
#include <tinycrypt/cmac_mode.h>
|
||||||
#include <tinycrypt/constants.h>
|
#include <tinycrypt/constants.h>
|
||||||
|
|
||||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_CRYPTO)
|
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_CRYPTO)
|
||||||
#define LOG_MODULE_NAME bt_crypto_toolbox
|
#define LOG_MODULE_NAME bt_crypto
|
||||||
#include "common/bt_str.h"
|
#include "common/bt_str.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
|
|
||||||
|
#include "bt_crypto.h"
|
||||||
|
|
||||||
int bt_crypto_aes_cmac(const uint8_t *key, const uint8_t *in, size_t len, uint8_t *out)
|
int bt_crypto_aes_cmac(const uint8_t *key, const uint8_t *in, size_t len, uint8_t *out)
|
||||||
{
|
{
|
||||||
struct tc_aes_key_sched_struct sched;
|
struct tc_aes_key_sched_struct sched;
|
|
@ -2,6 +2,9 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __BT_CRYPTO_H
|
||||||
|
#define __BT_CRYPTO_H
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
@ -143,3 +146,5 @@ int bt_crypto_h7(const uint8_t salt[16], const uint8_t w[16], uint8_t res[16]);
|
||||||
*/
|
*/
|
||||||
int bt_crypto_h8(const uint8_t k[16], const uint8_t s[16], const uint8_t key_id[4],
|
int bt_crypto_h8(const uint8_t k[16], const uint8_t s[16], const uint8_t key_id[4],
|
||||||
uint8_t res[16]);
|
uint8_t res[16]);
|
||||||
|
|
||||||
|
#endif /* __BT_CRYPTO_H */
|
|
@ -23,7 +23,7 @@
|
||||||
#include <tinycrypt/utils.h>
|
#include <tinycrypt/utils.h>
|
||||||
|
|
||||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_CORE)
|
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_CORE)
|
||||||
#define LOG_MODULE_NAME bt_crypto
|
#define LOG_MODULE_NAME bt_host_crypto
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include "common/bt_str.h"
|
#include "common/bt_str.h"
|
||||||
|
|
||||||
|
|
|
@ -26,13 +26,14 @@
|
||||||
#include <zephyr/sys/byteorder.h>
|
#include <zephyr/sys/byteorder.h>
|
||||||
#include <zephyr/sys/util.h>
|
#include <zephyr/sys/util.h>
|
||||||
|
|
||||||
#include <bt_crypto.h>
|
|
||||||
|
|
||||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_SMP)
|
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_SMP)
|
||||||
#define LOG_MODULE_NAME bt_smp
|
#define LOG_MODULE_NAME bt_smp
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include "common/bt_str.h"
|
#include "common/bt_str.h"
|
||||||
|
|
||||||
|
#include "crypto/bt_crypto.h"
|
||||||
|
|
||||||
#include "hci_core.h"
|
#include "hci_core.h"
|
||||||
#include "ecc.h"
|
#include "ecc.h"
|
||||||
#include "keys.h"
|
#include "keys.h"
|
||||||
|
|
|
@ -4,6 +4,8 @@ cmake_minimum_required(VERSION 3.20.0)
|
||||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||||
project(app)
|
project(app)
|
||||||
|
|
||||||
|
target_include_directories(app PRIVATE ${ZEPHYR_BASE}/subsys/bluetooth/crypto)
|
||||||
|
|
||||||
target_sources(app PRIVATE
|
target_sources(app PRIVATE
|
||||||
src/test_bt_crypto.c
|
src/test_bt_crypto.c
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,8 +8,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <zephyr/ztest.h>
|
#include <zephyr/ztest.h>
|
||||||
|
#include "bt_crypto.h"
|
||||||
#include <bt_crypto.h>
|
|
||||||
|
|
||||||
ZTEST_SUITE(bt_crypto, NULL, NULL, NULL, NULL, NULL);
|
ZTEST_SUITE(bt_crypto, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue