tset/gatt_client: enable btstack_crypto

This commit is contained in:
Milanka Ringwald 2023-01-20 14:13:26 +01:00 committed by Matthias Ringwald
parent 4ea63b4d9a
commit 7aef828808
3 changed files with 36 additions and 0 deletions

View File

@ -12,6 +12,7 @@ link_libraries( CppUTestExt )
include_directories(.)
include_directories(../../src)
include_directories(../../3rd-party/rijndael/)
include_directories( ${CMAKE_CURRENT_BINARY_DIR})
set(SOURCES
@ -26,6 +27,9 @@ set(SOURCES
../../src/btstack_util.c
../../src/hci_cmd.c
../../src/hci_dump.c
../../src/le-audio/gatt-service/coordinated_set_identification_service_client.c
../../src/btstack_crypto.c
../../3rd-party/rijndael/rijndael.c
)
# create static lib

View File

@ -19,6 +19,7 @@
#define ENABLE_PRINTF_HEXDUMP
#define ENABLE_SDP_DES_DUMP
#define ENABLE_SDP_EXTRA_QUERIES
#define ENABLE_SOFTWARE_AES128
// #define ENABLE_LE_SECURE_CONNECTIONS
#define ENABLE_L2CAP_ENHANCED_RETRANSMISSION_MODE

View File

@ -9,6 +9,7 @@
#include "ble/att_db.h"
#include "ble/sm.h"
#include "gap.h"
#include "btstack_debug.h"
#define PREBUFFER_SIZE (HCI_INCOMING_PRE_BUFFER_SIZE + 8)
#define TEST_MAX_MTU 23
@ -21,6 +22,9 @@ static uint8_t l2cap_stack_buffer[PREBUFFER_SIZE + TEST_MAX_MTU]; // pre buffer
static uint16_t gatt_client_handle = 0x40;
static hci_connection_t hci_connection;
static uint8_t packet_buffer[256];
static uint16_t packet_buffer_len;
uint16_t get_gatt_client_handle(void){
return gatt_client_handle;
}
@ -78,6 +82,28 @@ static void att_init_connection(att_connection_t * att_connection){
att_connection->authorized = 0;
}
HCI_STATE hci_get_state(void){
return HCI_STATE_WORKING;
}
uint8_t hci_send_cmd(const hci_cmd_t *cmd, ...){
btstack_assert(false);
va_list argptr;
va_start(argptr, cmd);
uint16_t len = hci_cmd_create_from_template(packet_buffer, cmd, argptr);
va_end(argptr);
hci_dump_packet(HCI_COMMAND_DATA_PACKET, 0, packet_buffer, len);
// dump_packet(HCI_COMMAND_DATA_PACKET, packet_buffer, len);
packet_buffer_len = len;
return ERROR_CODE_SUCCESS;
}
bool hci_can_send_command_packet_now(void){
return true;
}
bool hci_can_send_acl_le_packet_now(void){
return true;
}
@ -148,6 +174,11 @@ int sm_le_device_index(uint16_t handle ){
void sm_send_security_request(hci_con_handle_t con_handle){
}
uint8_t sm_get_ltk(hci_con_handle_t con_handle, sm_key_t ltk){
memset((uint8_t*) ltk, 0x22, 16);
return ERROR_CODE_SUCCESS;
}
irk_lookup_state_t sm_identity_resolving_state(hci_con_handle_t con_handle){
return IRK_LOOKUP_SUCCEEDED;
}