Skip to content

Add symmetric keys example (CA-14)#74

Open
Darkenkade42 wants to merge 6 commits into
espressif:masterfrom
Darkenkade42:symm-keys-example
Open

Add symmetric keys example (CA-14)#74
Darkenkade42 wants to merge 6 commits into
espressif:masterfrom
Darkenkade42:symm-keys-example

Conversation

@Darkenkade42

Copy link
Copy Markdown

Added an example to demonstrate device provisioning with symmetric keys.

@projectgus projectgus changed the title Add symmetric keys example Add symmetric keys example (CA-14) Jan 1, 2020
@CLAassistant

CLAassistant commented Jul 10, 2020

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Lisa999

Lisa999 commented Jul 10, 2020

Copy link
Copy Markdown

There's a bug in your code if you're using CMake! The file port / CMakeLists.txt need to be changed also:
From:

if (CONFIG_DEVICE_COMMON_NAME)
	list (APPEND COMPONENT_SRCS "${AZURE_IOT_SDK}/provisioning_client/src/iothub_auth_client.c")
endif()

set (COMPONENT_SUBMODULES "${AZURE_IOT_SDK}")

set(COMPONENT_PRIV_REQUIRES "mbedtls esp-tls main")

register_component()

set_source_files_properties(
    ${AZURE_IOT_SDK}/iothub_client/src/iothubtransport_mqtt_common.c
    PROPERTIES COMPILE_FLAGS
    -Wno-maybe-uninitialized)

component_compile_options (
	-Wno-unused-function
	-Wno-missing-braces
	-Wno-missing-field-initializers
	)

component_compile_definitions (
    USE_LWIP_SOCKET_FOR_AZURE_IOT
	HSM_TYPE_X509
	HSM_TYPE_SAS_TOKEN
)

if (CONFIG_DEVICE_COMMON_NAME)
	add_definitions(-DUSE_PROV_MODULE)
endif()

to this:

if (CONFIG_DEVICE_COMMON_NAME)
	list (APPEND COMPONENT_SRCS "${AZURE_IOT_SDK}/provisioning_client/src/iothub_auth_client.c")
endif()

if (CONFIG_SYMM_KEY)
	list (APPEND COMPONENT_SRCS "${AZURE_IOT_SDK}/provisioning_client/src/iothub_auth_client.c")
endif()

set (COMPONENT_SUBMODULES "${AZURE_IOT_SDK}")

set(COMPONENT_PRIV_REQUIRES "mbedtls esp-tls main")

register_component()

component_compile_options (
	-Wno-unused-function
	-Wno-missing-braces
	-Wno-missing-field-initializers
	)

component_compile_definitions (
        USE_LWIP_SOCKET_FOR_AZURE_IOT
	HSM_TYPE_SAS_TOKEN
)

if (CONFIG_DEVICE_COMMON_NAME)
	add_definitions(-DUSE_PROV_MODULE -DHSM_TYPE_X509)
endif()

if (CONFIG_SYMM_KEY)
	add_definitions(-DUSE_PROV_MODULE -DHSM_TYPE_SYMM_KEY)
endif()

This prevents the linker error:

undefined reference to `hsm_client_x509_init'

@Darkenkade42

Copy link
Copy Markdown
Author

You are correct @Lisa999 . I have added your proposed changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants