|
1 | 1 | # Guidelines for porting Cryptocell to Mbed OS
|
2 | 2 |
|
3 |
| -Cryptocell (CC) 310 is a hardware accelerator that can be ported to several boards, assuming these boards have CC 310 embedded in their hardware. |
| 3 | +Cryptocell (CC) 310 is a hardware accelerator you can port to boards that have CC 310 embedded in their hardware. |
4 | 4 |
|
5 | 5 | The CC 310 driver consists of three libraries:
|
6 | 6 |
|
7 |
| -* A common core library(`libcc_core.a`). |
8 |
| -* A platform-specific TRNG library, containing TRNG-related information, for sampling sufficient entropy on the specific platform(`libcc_trng.a`). |
9 |
| -* A platform-specific library containing extra information, such as the CC register's base addresses on the specific board. (`libcc_ext.a`) |
| 7 | +* A common core library (`libcc_core.a`). |
| 8 | +* A platform-specific TRNG library containing TRNG-related information for sampling sufficient entropy on the specific platform (`libcc_trng.a`). |
| 9 | +* A platform-specific library containing extra information, such as the CC register's base addresses on the specific board (`libcc_ext.a`). |
10 | 10 |
|
11 | 11 | Library version information:
|
12 | 12 |
|
13 |
| -* The CC 310 libraries were built from version `arm_sw-cc310-1.1.0.1285` |
| 13 | +* The CC 310 libraries were built from version `arm_sw-cc310-1.1.0.1285`. |
14 | 14 | * The `IAR` libraries were built using `IAR ANSI C/C++ Compiler V7.80.1.11864/W32 for ARM` with `--cpu Cortex-M4f`.
|
15 | 15 | * The `ARM` libraries were built using `ARM Compiler 5.06 update 4 (build 422)` with `--cpu cortex-m4`.
|
16 | 16 | * The `GCC_ARM` libraries were built using `arm-none-eabi-gcc 6.3.1 20170620 (release)` with `-mcpu=cortex-m4`.
|
17 | 17 |
|
18 |
| -To port your CC 310 driver to Mbed OS on your specific target, do the following: |
| 18 | +To port your CC 310 driver to Mbed OS on your specific target: |
19 | 19 |
|
20 |
| -1. In `targets.json` add the following to your target: |
| 20 | +1. In `targets.json`, add the following to your target: |
21 | 21 | * `MBEDTLS_CONFIG_HW_SUPPORT` to `macros_add` key. This instructs Mbed TLS to look for an alternative cryptographic implementation.
|
22 | 22 | * `CRYPTOCELL310` to `feature`. Use this in your common code that you need to remove from compilation in case CC exists in your board. Use `#if !defined(FEATURE_CRYPTOCELL310)` and `#if defined(FEATURE_CRYPTOCELL310)`.
|
23 | 23 | 1. In `objects.h`, include `objects_cryptocell.h`. You can use the `FEATURE_CRYPTOCELL310` precompilation check as defined above.
|
24 | 24 | 1. In `features/cryptocell/FEATURE_CRYPTOCELL310/TARGET_<target name>`, add your platform-specific libraries for all toolchains in `TOOLCHAIN_ARM`, `TOOLCHAIN_GCC_ARM` and `TOOLCHAIN_IAR` respectively.
|
25 | 25 | 1. Add your CC setup code:
|
26 |
| - * Implement `crypto_platform_setup()` and `crypto_platform_terminate()` to enable CC on your platform, in case you have board-specific setup functionality, required for CC setup. You MUST call 'SaSi_LibInit()` and 'SaSi_LibFini()' respectively in these functions. |
| 26 | + * Implement `crypto_platform_setup()` and `crypto_platform_terminate()` to enable CC on your platform, in case you have board-specific setup functionality, required for CC setup. You MUST call `SaSi_LibInit()` and `SaSi_LibFini()` in these functions. |
27 | 27 | * Define `crypto_platform_ctx` in `crypto_device_platform.h` in a way that suits your implementation.
|
28 |
| - |
| 28 | + |
| 29 | +## Enabling optional alternative drivers |
| 30 | + |
| 31 | +Three additional modules that are not enabled by default have alternative implementation support. This allows backward compatability because these modules don't have full functionality and returns `MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED` for some features. The modules are: |
| 32 | + |
| 33 | +* `AES`, which only supports 128 bit key size, as opposed to previous support for all key sizes. |
| 34 | +* `CMAC`, which only supports AES 128 bit key size, as opposed to previous support for DES and all key sizes. |
| 35 | +* `SHA512`, which only supports SHA512, as opposed to previous support for SHA384, as well. |
| 36 | + |
| 37 | +To enable these modules, define `MBEDTLS_AES_ALT`, `MBEDTLS_CMAC_ALT` and `MBEDTLS_SHA512_ALT`, either in `mbed_app.json` or in your `MBEDTLS_USER_CONFIG_FILE`, to have hardware accelerated module with reduced RAM size, on the expense of full functionality. |
0 commit comments