| Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 1 | # mbed TLS |
| 2 | |
| Simon Butcher | df81924 | 2015-08-19 19:33:27 +0100 | [diff] [blame] | 3 | mbed TLS (formerly known as PolarSSL) makes it trivially easy for developers to include cryptographic and SSL/TLS capabilities in their embedded products, with a minimal code footprint. It offers an SSL library with an intuitive API and readable source code. |
| Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 4 | |
| Irit Arkin | 4d8edd5 | 2015-08-24 13:50:25 +0100 | [diff] [blame] | 5 | The Beta release of mbed TLS integrates the mbed TLS library into mbed OS, mbed SDK and yotta. This is a preview release intended for evaluation only and is **not recommended for deployment**. It currently implements no secure source of random numbers, weakening its security. |
| Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 6 | |
| Manuel Pégourié-Gonnard | f13139a | 2015-10-21 18:32:34 +0200 | [diff] [blame^] | 7 | Currently the only supported yotta targets are: |
| 8 | - `frdm-k64f-gcc` and `frdm-k64f-armcc` |
| 9 | - `x86-linux-native` and `x86-osx-native` |
| 10 | |
| Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 11 | ## Sample programs |
| 12 | |
| 13 | This release includes the following examples: |
| 14 | |
| Manuel Pégourié-Gonnard | f45fd73 | 2015-10-21 17:54:11 +0200 | [diff] [blame] | 15 | 1. [**Self test:**](https://github.com/ARMmbed/mbedtls/blob/development/yotta/data/example-selftest) found in `test/example-selftest`. Tests different basic functions in the mbed TLS library. |
| Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 16 | |
| Manuel Pégourié-Gonnard | f45fd73 | 2015-10-21 17:54:11 +0200 | [diff] [blame] | 17 | 2. [**Benchmark:**](https://github.com/ARMmbed/mbedtls/blob/development/yotta/data/example-benchmark) found in `test/example-benchmark`. Measures the time taken to perform basic cryptographic functions used in the library. |
| Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 18 | |
| Irit Arkin | 4d8edd5 | 2015-08-24 13:50:25 +0100 | [diff] [blame] | 19 | These examples are integrated as yotta tests, so that they are built automatically when you build mbed TLS. You'll find more examples in the various `test/example-*` directories. |
| Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 20 | |
| Manuel Pégourié-Gonnard | f45fd73 | 2015-10-21 17:54:11 +0200 | [diff] [blame] | 21 | ## Performing TLS and DTLS connections |
| Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 22 | |
| Manuel Pégourié-Gonnard | f45fd73 | 2015-10-21 17:54:11 +0200 | [diff] [blame] | 23 | A high-level API for performing TLS and DTLS connections with mbed TLS in mbed OS is provided in a separate yotta module: [mbed-tls-sockets](https://github.com/ARMmbed/mbed-tls-sockets). It is the recommended API for TLS and DTLS connections. It is very similar to the API provided by the [sockets](https://github.com/ARMmbed/sockets) module for unencrypted TCP and UDP connections. |
| 24 | |
| 25 | The `mbed-tls-sockets` module includes a complete [example TLS client](https://github.com/ARMmbed/mbed-tls-sockets/blob/master/test/tls-client/main.cpp) with [usage instructions](https://github.com/ARMmbed/mbed-tls-sockets/blob/master/test/tls-client/README.md). |
| Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 26 | |
| Manuel Pégourié-Gonnard | 32da9f6 | 2015-07-31 15:52:30 +0200 | [diff] [blame] | 27 | ## Configuring mbed TLS features |
| 28 | |
| Irit Arkin | 4d8edd5 | 2015-08-24 13:50:25 +0100 | [diff] [blame] | 29 | mbed TLS makes it easy to disable any feature during compilation that isn't required for a particular project. The default configuration enables all modern and widely-used features, which should meet the needs of new projects, and disables all features that are older or less common, to minimize the code footprint. |
| Manuel Pégourié-Gonnard | 32da9f6 | 2015-07-31 15:52:30 +0200 | [diff] [blame] | 30 | |
| Irit Arkin | 4d8edd5 | 2015-08-24 13:50:25 +0100 | [diff] [blame] | 31 | The list of available compilation flags is presented in the fully documented [config.h file](https://github.com/ARMmbed/mbedtls/blob/development/include/mbedtls/config.h), present in the `mbedtls` directory of the yotta module. |
| 32 | |
| 33 | If you need to adjust those flags, you can provide your own configuration 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, use yotta's [configuration system](http://docs.yottabuild.org/reference/config.html). The file's name should be in your `config.json` file, under mbedtls, as the key `user-config-file`. For example: |
| Manuel Pégourié-Gonnard | 32da9f6 | 2015-07-31 15:52:30 +0200 | [diff] [blame] | 34 | |
| 35 | { |
| 36 | "mbedtls": { |
| 37 | "user-config-file": "\"myapp/my_mbedtls_config_changes.h\"" |
| 38 | } |
| 39 | } |
| 40 | |
| Irit Arkin | 4d8edd5 | 2015-08-24 13:50:25 +0100 | [diff] [blame] | 41 | Please note: you need to provide the exact name that will be used in the `#include` directive, including the `<>` or quotes around the name. |
| Manuel Pégourié-Gonnard | 32da9f6 | 2015-07-31 15:52:30 +0200 | [diff] [blame] | 42 | |
| Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 43 | ## Contributing |
| 44 | |
| Manuel Pégourié-Gonnard | 3dce9ec | 2015-08-27 10:07:09 +0200 | [diff] [blame] | 45 | We gratefully accept bug reports and contributions from the community. There are some requirements we need to fulfill in order to be able to integrate contributions: |
| Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 46 | |
| Manuel Pégourié-Gonnard | 324fc02 | 2015-08-20 11:51:53 +0200 | [diff] [blame] | 47 | * Simple bug fixes to existing code do not contain copyright themselves and we can integrate without issue. The same is true of trivial contributions. |
| Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 48 | |
| Irit Arkin | 4d8edd5 | 2015-08-24 13:50:25 +0100 | [diff] [blame] | 49 | * For larger contributions, such as a new feature, the code can possibly fall under copyright law. We then need your consent to share in the ownership of the copyright. We have a form for this, which we will send to you in case you submit a contribution or pull request that we deem this necessary for. |
| Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 50 | |
| 51 | To contribute, please: |
| 52 | |
| 53 | * [Check for open issues](https://github.com/ARMmbed/mbedtls/issues) or [start a discussion](https://tls.mbed.org/discussions) around a feature idea or a bug. |
| 54 | |
| Irit Arkin | 4d8edd5 | 2015-08-24 13:50:25 +0100 | [diff] [blame] | 55 | * Fork the [mbed TLS repository on GitHub](https://github.com/ARMmbed/mbedtls) to start making your changes. As a general rule, you should use the "development" branch as a basis. |
| Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 56 | |
| 57 | * Write a test that shows that the bug was fixed or that the feature works as expected. |
| 58 | |
| 59 | * Send a pull request and bug us until it gets merged and published. We will include your name in the ChangeLog :) |