blob: c4111469200a9f96e5d044bc708f8121e855aebd [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
10/* TBBR CoT definitions */
11
12#define COT_MAX_VERIFIED_PARAMS 4
13
Manish V Badarkhe043fd622020-05-16 16:36:39 +010014/*
15 * Maximum key and hash sizes (in DER format).
16 *
17 * Both RSA and ECDSA keys may be used at the same time. In this case, the key
18 * buffers must be big enough to hold either. As RSA keys are bigger than ECDSA
19 * ones for all key sizes we support, they impose the minimum size of these
20 * buffers.
21 */
22#if TF_MBEDTLS_USE_RSA
23#if TF_MBEDTLS_KEY_SIZE == 1024
24#define PK_DER_LEN 162
25#elif TF_MBEDTLS_KEY_SIZE == 2048
26#define PK_DER_LEN 294
27#elif TF_MBEDTLS_KEY_SIZE == 3072
28#define PK_DER_LEN 422
29#elif TF_MBEDTLS_KEY_SIZE == 4096
30#define PK_DER_LEN 550
31#else
32#error "Invalid value for TF_MBEDTLS_KEY_SIZE"
33#endif
34#else /* Only using ECDSA keys. */
35#define PK_DER_LEN 91
36#endif
37
38#if TF_MBEDTLS_HASH_ALG_ID == TF_MBEDTLS_SHA256
39#define HASH_DER_LEN 51
40#elif TF_MBEDTLS_HASH_ALG_ID == TF_MBEDTLS_SHA384
41#define HASH_DER_LEN 67
42#elif TF_MBEDTLS_HASH_ALG_ID == TF_MBEDTLS_SHA512
43#define HASH_DER_LEN 83
44#else
45#error "Invalid value for TF_MBEDTLS_HASH_ALG_ID"
46#endif
47
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000048#endif /* COT_DEF_H */