Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 1 | /* |
Manish V Badarkhe | 043fd62 | 2020-05-16 16:36:39 +0100 | [diff] [blame] | 2 | * Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved. |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 7 | #ifndef COT_DEF_H |
| 8 | #define COT_DEF_H |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 9 | |
Pankaj Gupta | 8778ebf | 2020-12-09 14:02:38 +0530 | [diff] [blame] | 10 | #ifdef MBEDTLS_CONFIG_FILE |
| 11 | #include MBEDTLS_CONFIG_FILE |
| 12 | #endif |
| 13 | |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 14 | /* TBBR CoT definitions */ |
Manish Pandey | 5f8e1a0 | 2020-05-27 22:40:10 +0100 | [diff] [blame] | 15 | #if defined(SPD_spmd) |
| 16 | #define COT_MAX_VERIFIED_PARAMS 8 |
| 17 | #else |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 18 | #define COT_MAX_VERIFIED_PARAMS 4 |
Manish Pandey | 5f8e1a0 | 2020-05-27 22:40:10 +0100 | [diff] [blame] | 19 | #endif |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 20 | |
Manish V Badarkhe | 043fd62 | 2020-05-16 16:36:39 +0100 | [diff] [blame] | 21 | /* |
| 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 Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 55 | #endif /* COT_DEF_H */ |