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:
Carles Cufi 2022-11-10 10:08:19 +01:00 committed by Johan Hedberg
commit b90c27238a
10 changed files with 16 additions and 10 deletions

View file

@ -10,7 +10,7 @@ add_subdirectory_ifdef(CONFIG_BT_SHELL shell)
add_subdirectory_ifdef(CONFIG_BT_CONN services)
add_subdirectory_ifdef(CONFIG_BT_MESH mesh)
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)
add_subdirectory(controller)

View file

@ -186,7 +186,7 @@ rsource "common/Kconfig"
rsource "host/Kconfig"
rsource "controller/Kconfig"
rsource "shell/Kconfig"
rsource "bt_crypto/Kconfig"
rsource "crypto/Kconfig"
endif # BT_HCI

View file

@ -2,6 +2,4 @@
zephyr_library()
zephyr_include_directories(include)
zephyr_library_sources(bt_crypto.c)

View file

@ -7,15 +7,16 @@
#include <zephyr/sys/byteorder.h>
#include <bt_crypto.h>
#include <tinycrypt/cmac_mode.h>
#include <tinycrypt/constants.h>
#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/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)
{
struct tc_aes_key_sched_struct sched;

View file

@ -2,6 +2,9 @@
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __BT_CRYPTO_H
#define __BT_CRYPTO_H
#include <stddef.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],
uint8_t res[16]);
#endif /* __BT_CRYPTO_H */

View file

@ -23,7 +23,7 @@
#include <tinycrypt/utils.h>
#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/bt_str.h"

View file

@ -26,13 +26,14 @@
#include <zephyr/sys/byteorder.h>
#include <zephyr/sys/util.h>
#include <bt_crypto.h>
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_SMP)
#define LOG_MODULE_NAME bt_smp
#include "common/log.h"
#include "common/bt_str.h"
#include "crypto/bt_crypto.h"
#include "hci_core.h"
#include "ecc.h"
#include "keys.h"

View file

@ -4,6 +4,8 @@ cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(app)
target_include_directories(app PRIVATE ${ZEPHYR_BASE}/subsys/bluetooth/crypto)
target_sources(app PRIVATE
src/test_bt_crypto.c
)

View file

@ -8,8 +8,7 @@
#include <string.h>
#include <zephyr/ztest.h>
#include <bt_crypto.h>
#include "bt_crypto.h"
ZTEST_SUITE(bt_crypto, NULL, NULL, NULL, NULL, NULL);