aboutsummaryrefslogtreecommitdiffstats
path: root/include/common
diff options
context:
space:
mode:
authorManish V Badarkhe <Manish.Badarkhe@arm.com>2020-05-16 16:36:39 +0100
committerManish V Badarkhe <Manish.Badarkhe@arm.com>2020-05-19 05:05:19 +0100
commitad43c49ee39f52d2f3e682aefd76ecbbe3e0c712 (patch)
tree041dd6db1e190a329c2d4cb44651b8c3ea4a26a8 /include/common
parent4108abb4a0ab73fe311df5a65eb706e5f534f3f5 (diff)
downloadplatform_external_arm-trusted-firmware-ad43c49ee39f52d2f3e682aefd76ecbbe3e0c712.tar.gz
platform_external_arm-trusted-firmware-ad43c49ee39f52d2f3e682aefd76ecbbe3e0c712.tar.bz2
platform_external_arm-trusted-firmware-ad43c49ee39f52d2f3e682aefd76ecbbe3e0c712.zip
Cleanup the code for TBBR CoT descriptors
CoT used for BL1 and BL2 are moved to tbbr_cot_bl1.c and tbbr_cot_bl2.c respectively. Common CoT used across BL1 and BL2 are moved to tbbr_cot_common.c. Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com> Change-Id: I2252ac8a6960b3431bcaafdb3ea4fb2d01b79cf5
Diffstat (limited to 'include/common')
-rw-r--r--include/common/tbbr/cot_def.h36
1 files changed, 35 insertions, 1 deletions
diff --git a/include/common/tbbr/cot_def.h b/include/common/tbbr/cot_def.h
index 33350a0d3..c41114692 100644
--- a/include/common/tbbr/cot_def.h
+++ b/include/common/tbbr/cot_def.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -11,4 +11,38 @@
#define COT_MAX_VERIFIED_PARAMS 4
+/*
+ * Maximum key and hash sizes (in DER format).
+ *
+ * Both RSA and ECDSA keys may be used at the same time. In this case, the key
+ * buffers must be big enough to hold either. As RSA keys are bigger than ECDSA
+ * ones for all key sizes we support, they impose the minimum size of these
+ * buffers.
+ */
+#if TF_MBEDTLS_USE_RSA
+#if TF_MBEDTLS_KEY_SIZE == 1024
+#define PK_DER_LEN 162
+#elif TF_MBEDTLS_KEY_SIZE == 2048
+#define PK_DER_LEN 294
+#elif TF_MBEDTLS_KEY_SIZE == 3072
+#define PK_DER_LEN 422
+#elif TF_MBEDTLS_KEY_SIZE == 4096
+#define PK_DER_LEN 550
+#else
+#error "Invalid value for TF_MBEDTLS_KEY_SIZE"
+#endif
+#else /* Only using ECDSA keys. */
+#define PK_DER_LEN 91
+#endif
+
+#if TF_MBEDTLS_HASH_ALG_ID == TF_MBEDTLS_SHA256
+#define HASH_DER_LEN 51
+#elif TF_MBEDTLS_HASH_ALG_ID == TF_MBEDTLS_SHA384
+#define HASH_DER_LEN 67
+#elif TF_MBEDTLS_HASH_ALG_ID == TF_MBEDTLS_SHA512
+#define HASH_DER_LEN 83
+#else
+#error "Invalid value for TF_MBEDTLS_HASH_ALG_ID"
+#endif
+
#endif /* COT_DEF_H */