Add support for MBEDTLS_USER_CONFIG_FILE

This commit is contained in:
Manuel Pégourié-Gonnard 2015-07-31 15:52:30 +02:00 committed by Manuel Pégourié-Gonnard
parent 43569a93cc
commit 32da9f66a8
4 changed files with 36 additions and 1 deletions

View file

@ -2,6 +2,9 @@ mbed TLS ChangeLog (Sorted per branch, date)
= mbed TLS 2 branch = mbed TLS 2 branch
Features
* Added support for yotta as a build system
Bugfix Bugfix
* Fix segfault in the benchmark program when benchmarking DHM. * Fix segfault in the benchmark program when benchmarking DHM.
* Fix build error with CMake and pre-4.5 versions of GCC (found by Hugo * Fix build error with CMake and pre-4.5 versions of GCC (found by Hugo
@ -20,6 +23,9 @@ Bugfix
Changes Changes
* The PEM parser now accepts a trailing space at end of lines (#226). * The PEM parser now accepts a trailing space at end of lines (#226).
* It is now possible to #include a user-provided configuration file at the
end of the default config.h by defining MBEDTLS_USER_CONFIG_FILE on the
compiler's command line.
= mbed TLS 2.0.0 released 2015-07-13 = mbed TLS 2.0.0 released 2015-07-13

View file

@ -2425,6 +2425,19 @@
#include "mbedtls/target_config.h" #include "mbedtls/target_config.h"
#endif #endif
/*
* Allow user to override any previous default.
*
* Use two macro names for that, as:
* - with yotta the prefix YOTTA_CFG_ is forced
* - without yotta is looks weird to have a YOTTA prefix.
*/
#if defined(YOTTA_CFG_MBEDTLS_USER_CONFIG_FILE)
#include YOTTA_CFG_MBEDTLS_USER_CONFIG_FILE
#elif defined(MBEDTLS_USER_CONFIG_FILE)
#include MBEDTLS_USER_CONFIG_FILE
#endif
#include "check_config.h" #include "check_config.h"
#endif /* MBEDTLS_CONFIG_H */ #endif /* MBEDTLS_CONFIG_H */

View file

@ -56,7 +56,7 @@ sed -n 's/MBED..._[A-Z0-9_]*/\'"$NL"'&\'"$NL"/gp \
$HEADERS library/*.c \ $HEADERS library/*.c \
| grep MBEDTLS | sort -u > _MBEDTLS_XXX | grep MBEDTLS | sort -u > _MBEDTLS_XXX
TYPOS=$( diff _caps _MBEDTLS_XXX | sed -n 's/^> //p' \ TYPOS=$( diff _caps _MBEDTLS_XXX | sed -n 's/^> //p' \
| egrep -v 'XXX|__|_$|^MBEDTLS_CONFIG_FILE$' || true ) | egrep -v 'XXX|__|_$|^MBEDTLS_.*CONFIG_FILE$' || true )
rm _MBEDTLS_XXX _caps rm _MBEDTLS_XXX _caps
if [ "x$TYPOS" = "x" ]; then if [ "x$TYPOS" = "x" ]; then
echo "PASS" echo "PASS"

View file

@ -20,6 +20,22 @@ These examples are integrated as yotta tests so that they are build automaticall
Please follow the instructions in the [TLS client sample](https://github.com/ARMmbed/mbedtls/tree/master/yotta/data/example-tls-client). These include a list of prerequisites and an explanation of building mbed TLS with yotta. Please follow the instructions in the [TLS client sample](https://github.com/ARMmbed/mbedtls/tree/master/yotta/data/example-tls-client). These include a list of prerequisites and an explanation of building mbed TLS with yotta.
## Configuring mbed TLS features
**Warning:** This is only a preview of a future feature that will require support from yotta; as of yotta 0.5.2 this is not supported yet.
mbed TLS makes it easy to disable during the compilation any feature that is not needed for a particular project. The default configuration enables all modern and widely-used features, which should meet the need of any new project; it disables all features that are either older or less mainstrem, in order to keep the footprint low. The list of available compile flags is available in the fully documented [config.h file](https://github.com/ARMmbed/mbedtls/blob/master/include/mbedtls/config.h), present in the `mbedtls` directory of the yotta module.
Should you need to adjust those flags, you can provide your own configuration file with the suitable `#define` and `#undef` statements, to be included between the default definitions and the sanity checks. This file should be in your application's include directory and can be named freely; you just need to let mbed TLS know the name of the file, by using yotta's [configuration system](http://docs.yottabuild.org/reference/config.html). This name should go in your `config.json`, under mbedtls, as the key `user-config-file`, for example:
{
"mbedtls": {
"user-config-file": "\"myapp/my_mbedtls_config_changes.h\""
}
}
Please note you need to provide the exact name that will be used in the `#include` directive, including the `<>` or quotes around the name.
## Contributing ## Contributing
We graciously accept bugs and contributions from the community. There are some requirements we need to fulfil in order to be able to integrate contributions in the main code: We graciously accept bugs and contributions from the community. There are some requirements we need to fulfil in order to be able to integrate contributions in the main code: