Skip to content

Commit 0fd0de6

Browse files
committed
Update the Mbed TLS README.md
Add content missing from the README.md taken from the Yotta/Mbed OS 3 Readme.
1 parent 541fc1f commit 0fd0de6

File tree

1 file changed

+87
-5
lines changed

1 file changed

+87
-5
lines changed

features/mbedtls/README.md

Lines changed: 87 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,96 @@
1-
README for mbed TLS
1+
README for Mbed TLS
22
===================
33

4-
mbed TLS for mbed OS
4+
Mbed TLS for Mbed OS
55
--------------------
66

7-
This edition of mbed TLS has been adapted for mbed OS and imported from its standalone release, which you can find on [github here](https://github.com/ARMmbed/mbedtls). This edition of mbed TLS does not include test code, sample applications, or the scripts used in the development of the library. All of these can be found in the standalone release.
7+
This edition of Mbed TLS has been adapted for Mbed OS and imported from its standalone release, which you can find on [github here](https://github.com/ARMmbed/mbedtls). This edition of Mbed TLS does not include the test code or the scripts used in the development of the library. All of these can be found in the standalone release.
88

99

10-
Getting Help and Support
11-
------------------------
10+
Getting Started
11+
---------------
12+
13+
Several example programs are available that demonstrate the use of Mbed TLS with
14+
Mbed OS. These are a great way of getting to know the library.
15+
16+
1. [**TLS Client:**](https://github.com/ARMmbed/mbed-os-example-tls/tree/master/tls-client) TLS Client demonstrates the use of Mbed TLS to establish a client TLS connection to a remote server.
17+
18+
2. [**Benchmark:**](https://github.com/ARMmbed/mbed-os-example-tls/tree/master/benchmark) Benchmark measures the time taken to perform basic cryptographic functions used in the library.
19+
20+
3. [**Hashing:**](https://github.com/ARMmbed/mbed-os-example-tls/tree/master/hashing) Hashing demonstrates the various APIs for computing hashes of data (also known as message digests) with SHA-256.
21+
22+
4. [**Authenticated encryption:**](https://github.com/ARMmbed/mbed-os-example-tls/tree/master/authcrypt) Authcrypt demonstrates usage of the Cipher API for encrypting and authenticating data with AES-CCM.
23+
24+
25+
These examples are fully integrated into Mbed OS. Each of them comes with complete usage instructions as a `README.md` file in the directory of each example.
26+
27+
28+
Configuring Mbed TLS features
29+
-----------------------------
30+
31+
Mbed TLS makes it easy to disable any feature during compilation, if that feature isn't required for a particular project. The default configuration enables all modern and widely-used features of the TLS protocol, which should meet the needs of most projects. It also disables all older and less common features, to minimize the code footprint.
32+
33+
The list of available compilation flags is available in the fully documented [config.h file](https://github.com/ARMmbed/mbedtls/blob/development/include/mbedtls/config.h).
34+
35+
If you need to adjust those flags, you can provide your own supplementary configuration-adjustment file with suitable `#define` and `#undef` statements. These will be included between the default definitions and the sanity checks. Your configuration file should be in your application's include directory, and can be named freely; you just need to let mbed TLS know the file's name. To do that, you can use the [Mbed OS Configuration
36+
system](https://docs.mbed.com/docs/mbed-os-api/en/latest/api/md_docs_config_system.html)
37+
38+
For example, if you wanted to enable the options, `MBEDTLS_PEM_WRITE_C` and `MBEDTLS_CMAC_C`, and provide your own additional configuration file for Mbed TLS named `my_config.h`, you could define these in a top level `mbed_app.json` configuration file in the root directory of your project.
39+
40+
The Mbed TLS configuration file would be specified in the `.json` file as follows.
41+
42+
```
43+
{
44+
"macros" : [
45+
46+
"MBEDTLS_USER_CONFIG_FILE" : "my_config.h",
47+
48+
"MBEDTLS_PEM_WRITE_C",
49+
"MBEDTLS_CMAC_C"
50+
]
51+
....remainder of file...
52+
}
53+
```
54+
55+
The additional configuration file, `my_config.h`, can then be used as a normal configuration header file to include additional configurations. For example, it could include the follow lines to include ECJPAKE, and the CBC block mode:
56+
57+
```
58+
#define MBEDTLS_ECJPAKE_C
59+
#define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
60+
61+
#undef MBEDTLS_CIPHER_MODE_CBC
62+
```
63+
64+
## Getting Mbed TLS from GitHub
65+
66+
Mbed TLS is maintained and developed in the open, independently of Mbed OS, and its source can be found on GitHub here: [ARMmbed/mbedtls](https://github.com/ARMmbed/mbedtls). As a consequence, unlike other parts of mbed OS, changes to Mbed TLS must be committed upstream in the Mbed TLS repository.
67+
68+
To import into an instance of Mbed OS a different version of Mbed TLS, a `Makefile` script is provided to update the local git repository, extract a specific version, and to modify the configuration files to those used for the Mbed OS defaults.
69+
70+
To use the `Makefile`, you can either set `MBED_TLS_RELEASE` environment variable to the git tag or commit id of the Mbed TLS Release or version you want to use, or alternatively you can modify the `Makefile` itself.
71+
72+
You should then run the following commands in the `importer` directory in the Mbed TLS directory:
73+
74+
```
75+
make update
76+
make
77+
```
78+
79+
`make update` will pull the specified version of Mbed TLS into the local `importer/TARGET_IGNORE` directory and `make` will transform it into the `src` directory, modifying its configuration file as necessary.
80+
81+
Once these steps are complete, you can make your Mbed OS build normally with the new version of Mbed TLS.
82+
83+
## Differences between the standalone and mbed OS editions
84+
85+
While the two editions share the same code base, there are still a number of differences, mainly in configuration and integration. You should keep in mind those differences when reading some articles in our [knowledge base](https://tls.mbed.org/kb), as currently all the articles are about the standalone edition.
86+
87+
* The Mbed OS edition has a smaller set of features enabled by default in `config.h`, in order to reduce footprint. While the default configuration of the standalone edition puts more emphasize on maintaining interoperability with old peers, the mbed OS edition only enables the most modern ciphers and the latest version of (D)TLS.
88+
89+
* The following components of mbed TLS are disabled in the mbed OS edition: `net_sockets.c` and `timing.c`. This is because Mbed OS includes its own equivalents.
90+
91+
92+
Help and Support
93+
----------------
1294

1395
The [mbed TLS website](https://tls.mbed.org/) contains full documentation for the library, including function by function descriptions, knowledgebase articles, blogs and a support forum for questions to the community.
1496

0 commit comments

Comments
 (0)