Platform: Get device lifecycle from CC312 on Musca-B1
CryptoCell lifecycle includes:
- CM: Chip manufacture lifecycle, belongs to IC vendor
- DM: Device manufacture lifecycle, belongs to OEM
- SE: Secure enable lifecycle, belongs to end user
- RMA: Return to manufacture and analyze, belongs to ICV or OEM debug
Mapping PSA lifecycle to CryptoCell lifecycle:
- TFM_SLC_ASSEMBLY_AND_TEST – CM
- TFM_SLC_PSA_ROT_PROVISIONING - DM
- TFM_SLC_SECURED – SE
- TFM_SLC_DECOMMISSIONED – RMA
If the chip is not yet provisioned, it is CM lifecycle.
Change-Id: I7d39c7f0d5b09be7a669a1970fcafc669763ebfb
Signed-off-by: Xu Yong <yong.xu@arm.com>
Signed-off-by: Tamas Ban <tamas.ban@arm.com>
diff --git a/platform/ext/common/cc312/cc312.c b/platform/ext/common/cc312/cc312.c
index 7dc8556..a5c417d 100644
--- a/platform/ext/common/cc312/cc312.c
+++ b/platform/ext/common/cc312/cc312.c
@@ -13,6 +13,7 @@
#include "mbedtls/platform.h"
#include "mbedtls/ctr_drbg.h"
#include "mbedtls/entropy.h"
+#include "mbedtls_cc_mng_int.h"
#include "arm_cmse.h"
CCRndContext_t* CC312_pRndCtx = NULL;
@@ -96,3 +97,8 @@
return 0;
}
+
+int crypto_hw_accelerator_get_lcs(uint32_t *lcs)
+{
+ return mbedtls_mng_lcsGet(lcs);
+}
diff --git a/platform/ext/common/cc312/crypto_hw.h b/platform/ext/common/cc312/crypto_hw.h
index b5baa8b..2d577cd 100644
--- a/platform/ext/common/cc312/crypto_hw.h
+++ b/platform/ext/common/cc312/crypto_hw.h
@@ -8,6 +8,8 @@
#ifndef __CRYPTO_HW_H__
#define __CRYPTO_HW_H__
+#include <stdint.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -44,6 +46,14 @@
*/
int crypto_hw_accelerator_otp_provisioning(void);
+/** \brief Retrieve the device lifecycle
+ *
+ * \param[out] lcs Pointer to store lifecycle state
+ *
+ * \return 0 on success, non-zero otherwise
+ */
+int crypto_hw_accelerator_get_lcs(uint32_t *lcs);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */