diff --git a/example/Makefile.inc b/example/Makefile.inc index e8f4a25e8..cb8d199c3 100644 --- a/example/Makefile.inc +++ b/example/Makefile.inc @@ -2,11 +2,13 @@ VPATH += ${BTSTACK_ROOT}/src VPATH += ${BTSTACK_ROOT}/src/ble VPATH += ${BTSTACK_ROOT}/src/classic VPATH += ${BTSTACK_ROOT}/example +VPATH += ${BTSTACK_ROOT}/3rd-party/mbedtls/library CFLAGS += -I. CFLAGS += -I${BTSTACK_ROOT}/src/ble CFLAGS += -I${BTSTACK_ROOT}/src/classic CFLAGS += -I${BTSTACK_ROOT}/src +CFLAGS += -I${BTSTACK_ROOT}/3rd-party/mbedtls/include CORE += \ btstack_memory.c \ @@ -54,6 +56,11 @@ SM_MINIMAL += \ PAN += \ pan.c \ +MBEDTLS = \ + bignum.c \ + ecp.c \ + ecp_curves.c \ + EXAMPLES = \ ancs_client_demo \ gap_dedicated_bonding \ @@ -87,7 +94,7 @@ EXAMPLES_USING_LE = \ # .o for .c CORE_OBJ = $(CORE:.c=.o) COMMON_OBJ = $(COMMON:.c=.o) -SM_REAL_OBJ = $(SM_REAL:.c=.o) +SM_REAL_OBJ = $(SM_REAL:.c=.o) $(MBEDTLS:.c=.o) SM_MINIMAL_OBJ = $(SM_MINIMAL:.c=.o) ATT_OBJ = $(ATT:.c=.o) GATT_CLIENT_OBJ = $(GATT_CLIENT:.c=.o) diff --git a/example/le_counter.c b/example/le_counter.c index 38a0baff6..c210191da 100644 --- a/example/le_counter.c +++ b/example/le_counter.c @@ -98,6 +98,9 @@ static void le_counter_setup(void){ // setup SM: Display only sm_init(); +#ifdef ENABLE_LE_SECURE_CONNECTIONS + sm_set_authentication_requirements(SM_AUTHREQ_SECURE_CONNECTION); +#endif // setup ATT server att_server_init(profile_data, att_read_callback, att_write_callback); diff --git a/example/le_counter.gatt b/example/le_counter.gatt index fb0e8a549..a9aad864b 100644 --- a/example/le_counter.gatt +++ b/example/le_counter.gatt @@ -8,5 +8,7 @@ CHARACTERISTIC, GATT_SERVICE_CHANGED, READ, PRIMARY_SERVICE, 0000FF10-0000-1000-8000-00805F9B34FB // Counter Characteristic, with read and notify CHARACTERISTIC, 0000FF11-0000-1000-8000-00805F9B34FB, READ | NOTIFY | DYNAMIC, +// Counter Characteristic, with read and notify + authentication +CHARACTERISTIC, 0000FF12-0000-1000-8000-00805F9B34FB, READ | NOTIFY | DYNAMIC | AUTHENTICATION_REQUIRED, diff --git a/port/libusb/btstack_config.h b/port/libusb/btstack_config.h index c42181cbe..c424fc133 100644 --- a/port/libusb/btstack_config.h +++ b/port/libusb/btstack_config.h @@ -14,6 +14,7 @@ // BTstack features that can be enabled #define ENABLE_BLE #define ENABLE_CLASSIC +#define ENABLE_LE_SECURE_CONNECTIONS #define ENABLE_LOG_ERROR #define ENABLE_LOG_INFO #define ENABLE_LOG_INTO_HCI_DUMP