Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add symmetric keys example (CA-14) #74

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Darkenkade42
Copy link

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
Copy link

CLAassistant commented Jul 10, 2020

CLA assistant check
All committers have signed the CLA.

@Lisa999
Copy link

Lisa999 commented Jul 10, 2020

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
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