blob: 800ad07eb251969d5fe7e277e271dcd231728847 [file] [log] [blame]
Juan Castillo9b265a82015-05-07 14:52:44 +01001/*
Manish V Badarkhe043fd622020-05-16 16:36:39 +01002 * Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
Juan Castillo9b265a82015-05-07 14:52:44 +01003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Juan Castillo9b265a82015-05-07 14:52:44 +01005 */
6
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00007#ifndef COT_DEF_H
8#define COT_DEF_H
Juan Castillo9b265a82015-05-07 14:52:44 +01009
Pankaj Gupta8778ebf2020-12-09 14:02:38 +053010#ifdef MBEDTLS_CONFIG_FILE
11#include MBEDTLS_CONFIG_FILE
12#endif
13
Juan Castillo9b265a82015-05-07 14:52:44 +010014/* TBBR CoT definitions */
Manish Pandey5f8e1a02020-05-27 22:40:10 +010015#if defined(SPD_spmd)
16#define COT_MAX_VERIFIED_PARAMS 8
17#else
Juan Castillo9b265a82015-05-07 14:52:44 +010018#define COT_MAX_VERIFIED_PARAMS 4
Manish Pandey5f8e1a02020-05-27 22:40:10 +010019#endif
Juan Castillo9b265a82015-05-07 14:52:44 +010020
Manish V Badarkhe043fd622020-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. */
42#define PK_DER_LEN 91
43#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 Diaz5eb88372018-11-08 10:20:19 +000055#endif /* COT_DEF_H */