blob: 7823ff3eca93250d9cc4efd0faf7432f34643221 [file] [log] [blame]
Juan Castillodff93c82015-05-07 14:52:44 +01001/*
Govindraj Rajaa8eadc52023-01-11 18:34:58 +00002 * Copyright (c) 2015-2023, ARM Limited and Contributors. All rights reserved.
Juan Castillodff93c82015-05-07 14:52:44 +01003 *
dp-arm82cb2c12017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Juan Castillodff93c82015-05-07 14:52:44 +01005 */
6
Antonio Nino Diazc3cf06f2018-11-08 10:20:19 +00007#ifndef COT_DEF_H
8#define COT_DEF_H
Juan Castillodff93c82015-05-07 14:52:44 +01009
Govindraj Rajaa8eadc52023-01-11 18:34:58 +000010#include <mbedtls/version.h>
Pankaj Guptaff67fca2020-12-09 14:02:38 +053011
Juan Castillodff93c82015-05-07 14:52:44 +010012/* TBBR CoT definitions */
Manish Pandey44f1aa82020-05-27 22:40:10 +010013#if defined(SPD_spmd)
14#define COT_MAX_VERIFIED_PARAMS 8
laurenw-arm56b741d2022-04-21 15:49:00 -050015#elif defined(ARM_COT_cca)
16#define COT_MAX_VERIFIED_PARAMS 8
Manish Pandey44f1aa82020-05-27 22:40:10 +010017#else
Juan Castillodff93c82015-05-07 14:52:44 +010018#define COT_MAX_VERIFIED_PARAMS 4
Manish Pandey44f1aa82020-05-27 22:40:10 +010019#endif
Juan Castillodff93c82015-05-07 14:52:44 +010020
Manish V Badarkhead43c492020-05-16 16:36:39 +010021/*
22 * Maximum key and hash sizes (in DER format).
23 *
24 * Both RSA and ECDSA keys may be used at the same time. In this case, the key
25 * buffers must be big enough to hold either. As RSA keys are bigger than ECDSA
26 * ones for all key sizes we support, they impose the minimum size of these
27 * buffers.
28 */
29#if TF_MBEDTLS_USE_RSA
30#if TF_MBEDTLS_KEY_SIZE == 1024
31#define PK_DER_LEN 162
32#elif TF_MBEDTLS_KEY_SIZE == 2048
33#define PK_DER_LEN 294
34#elif TF_MBEDTLS_KEY_SIZE == 3072
35#define PK_DER_LEN 422
36#elif TF_MBEDTLS_KEY_SIZE == 4096
37#define PK_DER_LEN 550
38#else
39#error "Invalid value for TF_MBEDTLS_KEY_SIZE"
40#endif
41#else /* Only using ECDSA keys. */
Nicolas Toromanoff1ef303f2020-11-17 10:03:40 +010042#define PK_DER_LEN 92
Manish V Badarkhead43c492020-05-16 16:36:39 +010043#endif
44
45#if TF_MBEDTLS_HASH_ALG_ID == TF_MBEDTLS_SHA256
46#define HASH_DER_LEN 51
47#elif TF_MBEDTLS_HASH_ALG_ID == TF_MBEDTLS_SHA384
48#define HASH_DER_LEN 67
49#elif TF_MBEDTLS_HASH_ALG_ID == TF_MBEDTLS_SHA512
50#define HASH_DER_LEN 83
51#else
52#error "Invalid value for TF_MBEDTLS_HASH_ALG_ID"
53#endif
54
Antonio Nino Diazc3cf06f2018-11-08 10:20:19 +000055#endif /* COT_DEF_H */