running the prov_dev_client_sample outside of the repo with custom hsm compiled

Pavan 6 Reputation points
2020-10-30T06:08:54.583+00:00

So, following the docs, I am able to compile a custom HSM lib and link it to the sdk, and doing that, if I run the sample provided in prov_dev_client_sample with the certs in the same cmake directory (i.e azure-iot-sdk-c/cmake/*). But I created a new project and wanted to use the sample to start off and i get no errors in compiling, but when I run the code out of the repo. it gives me the below error


Error: Time:Fri Oct 30 11:19:56 2020 File:/build/azure-iot-sdk-c-aYsk0M/azure-iot-sdk-c-0.2.0.0/provisioning_client/src/prov_security_factory.c Func:prov_dev_security_init Line:63 HSM type 2 is not supported on this SDK build
Provisioning API Version: 1.3.9
Error: Time:Fri Oct 30 11:19:56 2020 File:/build/azure-iot-sdk-c-aYsk0M/azure-iot-sdk-c-0.2.0.0/provisioning_client/src/prov_auth_client.c Func:prov_auth_create Line:298 hsm_client_create is not a valid address
Error: Time:Fri Oct 30 11:19:56 2020 File:/home/peekay/playground/azure-iot-sdk-c/provisioning_client/src/prov_device_ll_client.c Func:Prov_Device_LL_Create Line:897 failed calling prov_auth_create

Error: Time:Fri Oct 30 11:19:56 2020 File:/home/peekay/playground/azure-iot-sdk-c/provisioning_client/src/prov_device_client.c Func:Prov_Device_Create Line:124 Prov_Device_LL_Create failed
failed calling Prov_Device_Create
Press enter key to exit:


This is my corresponding cmake file

cmake_minimum_required(VERSION 3.16)
project(reader_simulation_azure C)

set(CMAKE_C_STANDARD 99)

set(AZUREIOT_INC_FOLDER ".." "." "./deps/parson" "/usr/local/include/azureiot" "/usr/local/include/azureiot/inc")

include_directories(${AZUREIOT_INC_FOLDER})

add_executable(reader_simulation_azure main.c)

target_link_libraries(reader_simulation_azure
        uuid
        prov_mqtt_transport
        prov_device_client
        prov_device_ll_client
        prov_auth_client
        hsm_security_client
        uhttp
        iothub_client
        iothub_client_mqtt_transport
        umqtt
        aziotsharedutil
        ssl
        pthread
        curl
        ssl
        crypto
        m
        parson
        )

upon checking I see that the Cmake file in the repo has the cmake flags needed to enable these and my code does not. any help as to what needs to change and what is going wrong would mean a lot.

Thanks in advance

Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,115 questions
Azure IoT SDK
Azure IoT SDK
An Azure software development kit that facilitates building applications that connect to Azure IoT services.
207 questions
{count} votes

1 answer

Sort by: Most helpful
  1. António Sérgio Azevedo 7,661 Reputation points Microsoft Employee
    2020-12-18T11:31:42.043+00:00

    Hello @Pavan ,

    As per the related issue on github:

    "If you named your custom hsm implementation hsm_security_client then you would run into an issue of name clashing with another lib we have named the same thing. The custom hsm would have to be named something else and likely added to the CMake list."

    https://github.com/Azure/azure-iot-sdk-c/issues/1725

    49475-image.png

    Thank you so much for your time and in the hope to help others facing the same issue can you please mark this as answer?

    Remember:

    • Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
    0 comments No comments