cot_def.h 1.48 KB
Newer Older
Juan Castillo's avatar
Juan Castillo committed
1
/*
2
 * Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
Juan Castillo's avatar
Juan Castillo committed
3
 *
dp-arm's avatar
dp-arm committed
4
 * SPDX-License-Identifier: BSD-3-Clause
Juan Castillo's avatar
Juan Castillo committed
5
6
 */

7
8
#ifndef COT_DEF_H
#define COT_DEF_H
Juan Castillo's avatar
Juan Castillo committed
9

10
11
12
13
#ifdef MBEDTLS_CONFIG_FILE
#include MBEDTLS_CONFIG_FILE
#endif

Juan Castillo's avatar
Juan Castillo committed
14
/* TBBR CoT definitions */
15
16
17
#if defined(SPD_spmd)
#define COT_MAX_VERIFIED_PARAMS		8
#else
Juan Castillo's avatar
Juan Castillo committed
18
#define COT_MAX_VERIFIED_PARAMS		4
19
#endif
Juan Castillo's avatar
Juan Castillo committed
20

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * 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

55
#endif /* COT_DEF_H */