wiced: use micro-ecc from WICED SDK to avoid duplicate symbols

This commit is contained in:
Matthias Ringwald 2017-04-25 20:48:09 +02:00
parent 4e94d79fcb
commit cdb8bfaea6
2 changed files with 8 additions and 5 deletions

View File

@ -13,9 +13,11 @@ GLOBAL_INCLUDES += \
../../src \
../../platform/embedded \
../../chipset/bcm \
../../3rd-party/micro-ecc \
../../../../
# micro-ecc of WICED tree used for SECP256R1 in LE Secure Connections
$(NAME)_COMPONENTS += crypto/micro-ecc
# core BTstack sources
$(NAME)_SOURCES += \
../../src/ad_parser.c \
@ -49,10 +51,6 @@ $(NAME)_SOURCES += \
../../src/l2cap_signaling.c \
../../example/sco_demo_util.c \
# micro-ecc for LE Secure Connection
$(NAME)_SOURCES += \
../../3rd-party/micro-ecc/uECC.c \
# WICED port incl. support for Broadcom chipset
$(NAME)_SOURCES += \
main.c \

View File

@ -2783,6 +2783,7 @@ static void sm_handle_encryption_result(uint8_t * data){
#ifdef ENABLE_LE_SECURE_CONNECTIONS
#ifndef HAVE_HCI_CONTROLLER_DHKEY_SUPPORT
#if !defined(WICED_VERSION) || defined(USE_MBEDTLS_FOR_ECDH)
// @return OK
static int sm_generate_f_rng(unsigned char * buffer, unsigned size){
if (ec_key_generation_state != EC_KEY_GENERATION_ACTIVE) return 0;
@ -2795,6 +2796,7 @@ static int sm_generate_f_rng(unsigned char * buffer, unsigned size){
setup->sm_passkey_bit = offset;
return 1;
}
#endif
#ifdef USE_MBEDTLS_FOR_ECDH
// @return error
static int sm_generate_f_rng_mbedtls(void * context, unsigned char * buffer, size_t size){
@ -2837,7 +2839,10 @@ static void sm_handle_random_result(uint8_t * data){
mbedtls_mpi_free(&d);
#endif
#ifdef USE_MICROECC_FOR_ECDH
#ifndef WICED_VERSION
// micro-ecc from WICED SDK uses its wiced_crypto_get_random by default
uECC_set_rng(&sm_generate_f_rng);
#endif
uECC_make_key(ec_q, ec_d);
#endif