mirror of https://github.com/ARMmbed/mbed-os.git
Rename the generic name `ctx` of `mbedtls_platform_context` in `platform_alt.c` to a specific name `plat_ctx`, to avoid conflicts when used as external in crypto modules. |
||
|---|---|---|
| .. | ||
| TARGET_MCU_NRF52840 | ||
| binaries | ||
| include | ||
| Readme.md | ||
| cc_internal.c | ||
| cc_internal.h | ||
| ccm_alt.c | ||
| ccm_alt.h | ||
| ecdh_alt.c | ||
| ecdsa_alt.c | ||
| ecdsa_alt.c.mod | ||
| mbedtls_device.h | ||
| objects_cryptocell.h | ||
| sha1_alt.c | ||
| sha1_alt.h | ||
| sha256_alt.c | ||
| sha256_alt.h | ||
| trng.c | ||
Readme.md
Guidelines for porting Cryptocell to Mbed OS
Cryptocell (CC) 310 is a hardware accelerator that can be ported to several boards, assuming these boards have CC 310 embedded in their hardware.
The CC 310 driver consists of three libraries:
- A common core library(
libcc_core.a). - A platform-specific TRNG library, containing TRNG-related information, for sampling sufficient entropy on the specific platform(
libcc_trng.a). - A platform-specific library containing extra information, such as the CC register's base addresses on the specific board. (
libcc_ext.a)
Library version information:
- The CC 310 libraries were built from version
arm_sw-cc310-1.1.0.1285 - The
IARlibraries were built usingIAR ANSI C/C++ Compiler V7.80.1.11864/W32 for ARMwith--cpu Cortex-M4f. - The
ARMlibraries were built usingARM Compiler 5.06 update 4 (build 422)with--cpu cortex-m4. - The
GCC_ARMlibraries were built usingarm-none-eabi-gcc 6.3.1 20170620 (release)with-mcpu=cortex-m4.
To port your CC 310 driver to Mbed OS on your specific target, do the following:
- In
targets.jsonadd the following to your target:MBEDTLS_CONFIG_HW_SUPPORTtomacros_addkey. This instructs Mbed TLS to look for an alternative cryptographic implementation.CRYPTOCELL310tofeature. 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).
- In
objects.h, includeobjects_cryptocell.h. You can use theFEATURE_CRYPTOCELL310precompilation check as defined above. - In
features/cryptocell/FEATURE_CRYPTOCELL310/TARGET_<target name>, add your platform-specific libraries for all toolchains inTOOLCHAIN_ARM,TOOLCHAIN_GCC_ARMandTOOLCHAIN_IARrespectively. - Add your CC setup code:
- Implement
crypto_platform_setup()andcrypto_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. - Define
crypto_platform_ctxincrypto_device_platform.hin a way that suits your implementation.
- Implement