diff options
author | Balint Matyi <Balint.Matyi@arm.com> | 2020-03-23 09:45:22 +0100 |
---|---|---|
committer | Balint Matyi <Balint.Matyi@arm.com> | 2020-04-28 09:44:57 +0100 |
commit | 7e31db26838649655ab4613b0e990c050a77f489 (patch) | |
tree | 3f3088d35fbb7fbb76c30656918fb1b77e84e054 /lib/ext/cryptocell-312-runtime | |
parent | b37ac45566fdea4a80cddb4687f3e399027f14cc (diff) | |
download | trusted-firmware-m-7e31db26838649655ab4613b0e990c050a77f489.tar.gz |
Platform: Use crypto keys from eMRAM on Musca-S1
Changes the CC312 library to use the persistent eMRAM instead of
the volatile OTP on the Musca-S1. Adds matching crypto function
implementations using the eMRAM into the S1 platform directory.
Signed-off-by: Balint Matyi <Balint.Matyi@arm.com>
Change-Id: Icdce419ce770de38baa023266ed25ce541e9d4cf
Diffstat (limited to 'lib/ext/cryptocell-312-runtime')
-rw-r--r-- | lib/ext/cryptocell-312-runtime/host/src/cc_mng/mbedtls_cc_mng_int.c | 10 | ||||
-rw-r--r-- | lib/ext/cryptocell-312-runtime/host/src/cc_mng/mbedtls_cc_mng_int.h | 7 |
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/ext/cryptocell-312-runtime/host/src/cc_mng/mbedtls_cc_mng_int.c b/lib/ext/cryptocell-312-runtime/host/src/cc_mng/mbedtls_cc_mng_int.c index af0e13cb63..a734a9e42c 100644 --- a/lib/ext/cryptocell-312-runtime/host/src/cc_mng/mbedtls_cc_mng_int.c +++ b/lib/ext/cryptocell-312-runtime/host/src/cc_mng/mbedtls_cc_mng_int.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2001-2020, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -20,6 +20,10 @@ #include "cc_util_pm.h" /************* Auxiliary API's *************/ +/* All Musca-S1 platform-dependent defines (DX_PLAT_MUSCA_S1) are due to the + * fact that the S1 board's OTP is just an ordinary register which is volatile. + * The MRAM is used instead, and this is what the changes reflect. + */ int mbedtls_mng_otpWordRead(uint32_t otpAddress, uint32_t *pOtpWord) { uint32_t regVal=0; @@ -36,7 +40,11 @@ int mbedtls_mng_otpWordRead(uint32_t otpAddress, uint32_t *pOtpWord) } /* read OTP word */ +#ifdef DX_PLAT_MUSCA_S1 + CC_READ_MRAM_WORD(otpAddress*sizeof(uint32_t), regVal); +#else CC_READ_OTP_WORD(otpAddress*sizeof(uint32_t), regVal); +#endif *pOtpWord = regVal; return CC_OK; diff --git a/lib/ext/cryptocell-312-runtime/host/src/cc_mng/mbedtls_cc_mng_int.h b/lib/ext/cryptocell-312-runtime/host/src/cc_mng/mbedtls_cc_mng_int.h index ea51539807..f4d21f551a 100644 --- a/lib/ext/cryptocell-312-runtime/host/src/cc_mng/mbedtls_cc_mng_int.h +++ b/lib/ext/cryptocell-312-runtime/host/src/cc_mng/mbedtls_cc_mng_int.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2001-2020, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -87,6 +87,11 @@ typedef enum { otpData = CC_HAL_READ_REGISTER(CC_OTP_BASE_ADDR + otpAddr); \ }while(0) +#define CC_READ_MRAM_WORD(mramOffs, mramData) \ + do { \ + mramData = (*((volatile uint32_t *)(DX_MRAM_CC + (mramOffs)))); \ + }while(0) + /*! Poll NVM register to assure that the NVM boot is finished (and LCS and the keys are valid). */ #define CC_WAIT_ON_NVM_IDLE_BIT() \ do { \ |