Add mbed os conf tests #255
No reviewers
Labels
No labels
api-spec
bug
CLA requested
CLA valid
compliance
DO NOT MERGE
duplicate
enhancement
feature branch
good first issue
HEADER FORMATTING ISSUE
help wanted
Information
invalid
Jira status: AWAITING REVIEW
Jira status: CLOSED
Jira status: DONE
Jira status: IN PROGRESS
Jira status: IN REVIEW
Jira status: OPEN
Jira status: REOPENED
Jira status: RESOLVED
mirrored
mirror internally
needs: backports
needs: ci
needs: design review
needs: preceding PR
needs: review
needs: work
notabug
open for community contribution
Product Backlog
question
ready for merge
security
stale
type: bug
type: enhancement
type: question
web pages
wontfix
writing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-ARMmbed/mbed-crypto!255
Loading…
Reference in a new issue
No description provided.
Delete branch "add_mbed_os_conf_tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add a test in
all.shthat configures the default configuration inMbed OSand fix test dependencies discovered from it.@ -1122,1 +1122,4 @@component_test_basic_mbed_os_conf () {msg "build+test: Mbed OS default configuration"scripts/config.pl unset MBEDTLS_NET_CRather than call
config.pla bunch of times, how about defining the Mbed OS configuration in a file inconfigs? Or as a filter inconfig.pl, if we want to define it by comparison to the default configuration?@ -1123,0 +1128,4 @@scripts/config.pl unset MBEDTLS_FS_IOscripts/config.pl unset MBEDTLS_PSA_ITS_FILE_C # requires a filesystemscripts/config.pl unset MBEDTLS_PSA_CRYPTO_STORAGE_C # requires PSA ITS#scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY Need some entropyWhy is this line commented out?
@ -1123,0 +1181,4 @@scripts/config.pl unset MBEDTLS_SSL_TRUNCATED_HMACscripts/config.pl unset MBEDTLS_PLATFORM_TIME_TYPE_MACROscripts/config.pl set MBEDTLS_MPI_MAX_SIZE 512make CC=gcc CFLAGS='-Werror -O1' all testMaybe do a 32-bit build to be slightly closer to Mbed OS?
General question: where is the Mbed OS configuration defined?
@ -1123,0 +1128,4 @@scripts/config.pl unset MBEDTLS_FS_IOscripts/config.pl unset MBEDTLS_PSA_ITS_FILE_C # requires a filesystemscripts/config.pl unset MBEDTLS_PSA_CRYPTO_STORAGE_C # requires PSA ITS#scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY Need some entropyBecause we need some entropy sources, otherwise
psa_crypto_init()will fail@ -1123,0 +1181,4 @@scripts/config.pl unset MBEDTLS_SSL_TRUNCATED_HMACscripts/config.pl unset MBEDTLS_PLATFORM_TIME_TYPE_MACROscripts/config.pl set MBEDTLS_MPI_MAX_SIZE 512make CC=gcc CFLAGS='-Werror -O1' all testok.
The idea was to check Mbed OS configuration, but this won't harm
When Mbed TLS is imported to Mbed OS, the import script is run, adjusting the Mbed TLS config, in the
adjust_config.shscript.Thanks. Could we move that script to the Mbed TLS repository, and use that from
all.sh? Looking at its commit history, it's mostly modified by Mbed TLS team members.I think it's doable, and in this case, preferable, but I think we should hear what @Patater has to say on this, since he is more familiar with the script
Could we make a "reference configuration" for Mbed OS (to live in Mbed TLS's reference configs folder)? We can make the importer just copy over the Mbed OS reference configuration instead of shell-script-modifying it. This means we can delete some code. :)
It depends whether we want to define the Mbed OS configuration by enumerating its contents or relative to the default configuration. If we add a new option which is enabled by default, should it be also enabled in Mbed OS by default?
Furthermore, if we make a reference configuration, how do we document it? It needs to be documented so that people can make informed choices when making custom builds of Mbed OS.
As Gilles mentioned,
If we have a reference configuration for Mbed OS, that will be used by the importer script, it means that every new configuration in the main
config.hfile, will be need to be added to the reference configuration.In my opinion we should have the importer script take the main configuration file, and script modify it to Mbed OS related features, like it does now, otherwise we will encounter numerous maintenance issues.
What's the best way to ship a differential reference configuration?
MBEDTLS_USER_CONFIG_FILE?config.pycalls?I feel like the first option would be more portable and slightly easier to maintain, but interested to hear your thoughts as well.
@ -1123,0 +1181,4 @@scripts/config.pl unset MBEDTLS_SSL_TRUNCATED_HMACscripts/config.pl unset MBEDTLS_PLATFORM_TIME_TYPE_MACROscripts/config.pl set MBEDTLS_MPI_MAX_SIZE 512make CC=gcc CFLAGS='-Werror -O1' all testShould we also add
-Wstack-usage=2048 -Werrorto ensure we don't overflow the Mbed OS default main thread stack?We should also use
-Os, if that's what Mbed OS will default to using.@ -1123,0 +1181,4 @@scripts/config.pl unset MBEDTLS_SSL_TRUNCATED_HMACscripts/config.pl unset MBEDTLS_PLATFORM_TIME_TYPE_MACROscripts/config.pl set MBEDTLS_MPI_MAX_SIZE 512make CC=gcc CFLAGS='-Werror -O1' all testGah, seems we can't enforce that stack limit until we can fit within that stack limit.
What stack size should we test that we don't exceed and recommend Mbed OS users configure if they want to use Mbed TLS? We appear to fit within 6000 bytes.
@ -1123,0 +1181,4 @@scripts/config.pl unset MBEDTLS_SSL_TRUNCATED_HMACscripts/config.pl unset MBEDTLS_PLATFORM_TIME_TYPE_MACROscripts/config.pl set MBEDTLS_MPI_MAX_SIZE 512make CC=gcc CFLAGS='-Werror -O1' all testStack consumption in
mbedtls_mpi_exp_modincreases exponentially withMBEDTLS_MPI_WINDOW_SIZE. It's a space/time compromise, with ~1.5kB difference in stack usage between the min and max value on a 32-bit machine. Maybe we could reduce this value in Mbed OS: currently it uses the best-performance value except onTARGET_STM32F439xI.The library and the test suite are written in a very different style when it comes to stack consumption.
execute_testsuses achar buf[5000]to store a line of the.datafile. I think we should-Wstack-usageonly for the library, not for the test suite.@ -1123,0 +1181,4 @@scripts/config.pl unset MBEDTLS_SSL_TRUNCATED_HMACscripts/config.pl unset MBEDTLS_PLATFORM_TIME_TYPE_MACROscripts/config.pl set MBEDTLS_MPI_MAX_SIZE 512make CC=gcc CFLAGS='-Werror -O1' all testI agree we should run with
-Wstack-usageonly for the library for this PR.In the future, we should build the tests as they'd be used on target, perhaps with our actual on-target testing capability, (so, likely excluding host_test.function): this enables us to catch when on-target testing would run into stack issues. Some test suites allocate unnecessarily large buffers on the stack. We should have a regression test in place to ensure issues like what https://github.com/ARMmbed/mbed-crypto/pull/278 fixes don't rear their heads again, but adding such tests in this PR is out of scope.
It seems to me that with Mbed TLS recently becoming more independent from Mbed OS, it's no longer clear if this test should live in the mbedtls tree, especially if that requires having (an equivalent of) the Mbed OS config living in the Mbed TLS tree. @Patater @danh-arm wdyt?
Considering this PR does not appear to be close to be ready (still requires design discussions) or recently active, and we moving away from the mbed-crypto repo for new work, I'm closing this PR and encouraging you to re-open a similar one in mbedtls if you're still interested (perhaps after discussing if this is still appropriate now that Mbed TLS is less strongly connected to Mbed OS).
Pull request closed