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

WOLFMQTT_EXAMPLE_CERT allowing static or extern cert assignment #354

Merged
merged 4 commits into from
Dec 15, 2023

Conversation

gojimmypi
Copy link
Contributor

@gojimmypi gojimmypi commented Sep 27, 2023

Related to #352, this PR introduces the WOLFMQTT_EXAMPLE_CERT to allow the CMakeLists.txt in an Espressif Managed Component project to build the AWS example using the certs defined in examples/aws/awsiot.c and used in the examples/mqttexample.c source.

GitHub Workflow Update Included

edit: Thank you @bandi13 for the .github/workflows/ubuntu-check.yml update included here that helped identify the occasional workflow network failure, as well as the workflow updates in #355.

Background

Without this change, included files outside of the project directory like this:

idf_component_register(SRCS
                       	    main.c
                       	    wifi_connect.c
                       	    time_helper.c
                       	    ${WOLFMQTT_ROOT}/examples/aws/awsiot.c
                       	    ${WOLFMQTT_ROOT}/examples/mqttexample.c
                       	    ${WOLFMQTT_ROOT}/examples/mqttnet.c
                       	    ${WOLFMQTT_ROOT}/examples/mqttport.c
                        INCLUDE_DIRS
                            "."
                            "./include"
                        )

... fail to properly build:

C:/workspace/wolfMQTT-gojimmypi/examples/mqttexample.c:662:30: error: 'device_cert' undeclared (first use in this function)
  662 |                 (const byte*)device_cert, (long)sizeof(device_cert),

The PR is an alternative to my current method of copying those files to the local project directory. Although the copy works, it is one more point of maintenance when the example certs expire.

Usage

Define WOLFMQTT_EXTERN_CERT either in user_settings.h, or in the case of Managed Component examples, this cmake line is added to the main project CMakeLists.txt:

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFMQTT_EXTERN_CERT")

See also the published wolfSSL Managed Component.

@gojimmypi
Copy link
Contributor Author

retest this please

I checked this PR on Ubuntu,: installing wolfSSL and successfully doing a make for all the MQTT examples. I'm not sure why the tests failed with Error: The operation was canceled.

Copy link
Member

@embhorn embhorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@embhorn embhorn self-requested a review September 29, 2023 19:42
Copy link
Member

@embhorn embhorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the conflicts after I merged #355

@gojimmypi
Copy link
Contributor Author

Jenkins retest this please.

@gojimmypi gojimmypi requested a review from embhorn October 3, 2023 23:00
@embhorn embhorn merged commit c98d9ab into wolfSSL:master Dec 15, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants