-
Notifications
You must be signed in to change notification settings - Fork 66
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
Link to system mbedtls #356
Conversation
🎉 Thank you for your code contribution! To guarantee the change/addition is conformant to the OCF Specification, we would like to ask you to execute OCF Conformance Testing of your change ☝️ when your work is ready to be reviewed. ℹ️ To verify your latest change (4be1348), label this PR with |
Nice job, Martin! We've talked with @jkralik and if we understand the problem with the Also to test the various compilation options I'm thinking about modifying the GH workflows. In most workflows we have |
19f0495
to
af387f0
Compare
af387f0
to
fc0827a
Compare
If set to ON (default) the mbedtls library is patched and built by the iotivity-lite build system. If set to OFF, the iotivity-lite build system searches for the mbedtls library using CMake's find_package function and verifies that the library has been built with the OCF patches applied.
- Allow compilation will clang - Make tests that use CMake to build configurable, so they can be built in such a way that they preinstall mbedTLS and then use the preinstalled libraries.
- remove patched in implementation of mbedtls_platform_entropy_poll using oc_random_value - remove obsolete __OC_RANDOM - implement mbedtls entropy source using oc_entropy_value and use public API mbedtls_entropy_add_source to add it to mbedTLS - add mbedtls_oc_platform-standalone.h.in when building mbedtls with standalone programs which don't link with iotivity-lite. This file is processed by CMake, which then creates mbedtls_oc_platform.h. This header is included by mbedtls_config.h and defines some of the defines needed by mbedTLS configuration which otherwise would be defined from included iotivity-lite headers.
fc0827a
to
7bd43e4
Compare
Kudos, SonarCloud Quality Gate passed! |
This PR adds a
BUILD_MBEDTLS
CMake option:ON
(default) the mbedtls library is patched and built by the iotivity-lite build system.OFF
, the iotivity-lite build system searches for the mbedtls library using CMake'sfind_package
function and verifies that the library has been built with the OCF patches applied.To test this feature, I used patched, built and installed the mbedtls library from the
deps/mbedtls
submodule before building iotivity-lite:To patch mbedtls I used the
deps/mbedtls-patch.cmake
script:Then I configured, built and installed mbedtls as a shared library:
After that, with
BUILD_MBEDTLS=OFF
iotivity-lite was able tofind_package
functionmbedtls_x509write_crt_set_subject_alt_names
functionBut to make the patched mbedtls library compile successfully, I had to modify the OCF patches and remove the generic entropy pool setting, since that requires parts of the iotivity-lite sources.
I am not sure what impact this modification of the OCF patches for mbedtls has and whether that would be acceptable.
I also haven't tested whether
BUILD_MBEDTLS=OFF
works on all platforms and with different build configurations.