Gilles Peskine | 278e5eb | 2020-07-13 11:28:20 +0200 | [diff] [blame] | 1 | Building Mbed TLS with PSA cryptoprocessor drivers |
| 2 | ================================================== |
| 3 | |
| 4 | **This is a specification of work in progress. The implementation is not yet merged into Mbed TLS.** |
| 5 | |
| 6 | This document describes how to build Mbed TLS with additional cryptoprocessor drivers that follow the PSA cryptoprocessor driver interface. |
| 7 | |
Ronald Cron | e6e6b75 | 2023-01-16 16:56:51 +0100 | [diff] [blame] | 8 | The interface is not fully implemented in Mbed TLS yet. Please note that the interface may still change: until further notice, we do not guarantee backward compatibility with existing driver code. |
Gilles Peskine | 278e5eb | 2020-07-13 11:28:20 +0200 | [diff] [blame] | 9 | |
| 10 | ## Introduction |
| 11 | |
| 12 | The PSA cryptography driver interface provides a way to build Mbed TLS with additional code that implements certain cryptographic primitives. This is primarily intended to support platform-specific hardware. |
| 13 | |
| 14 | Note that such drivers are only available through the PSA cryptography API (crypto functions beginning with `psa_`, and X.509 and TLS interfaces that reference PSA types). |
| 15 | |
| 16 | Concretely speaking, a driver consists of one or more **driver description files** in JSON format and some code to include in the build. The driver code can either be provided in binary form as additional object file to link, or in source form. |
| 17 | |
| 18 | ## How to build Mbed TLS with drivers |
| 19 | |
| 20 | To build Mbed TLS with drivers: |
| 21 | |
Ronald Cron | e6e6b75 | 2023-01-16 16:56:51 +0100 | [diff] [blame] | 22 | 1. Pass the driver description files through the Make variable `PSA_DRIVERS` when building the library. |
Gilles Peskine | 278e5eb | 2020-07-13 11:28:20 +0200 | [diff] [blame] | 23 | |
| 24 | ``` |
| 25 | cd /path/to/mbedtls |
| 26 | make PSA_DRIVERS="/path/to/acme/driver.json /path/to/nadir/driver.json" lib |
| 27 | ``` |
| 28 | |
Ronald Cron | e6e6b75 | 2023-01-16 16:56:51 +0100 | [diff] [blame] | 29 | 2. Link your application with the implementation of the driver functions. |
Gilles Peskine | 278e5eb | 2020-07-13 11:28:20 +0200 | [diff] [blame] | 30 | |
| 31 | ``` |
| 32 | cd /path/to/application |
| 33 | ld myapp.o -L/path/to/acme -lacmedriver -L/path/to/nadir -lnadirdriver -L/path/to/mbedtls -lmbedcrypto |
| 34 | ``` |
| 35 | |
| 36 | <!-- TODO: what if the driver is provided as C source code? --> |
| 37 | |
| 38 | <!-- TODO: what about additional include files? --> |