Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 1 | /* |
laurenw-arm | 483e5ac | 2022-04-21 15:49:00 -0500 | [diff] [blame] | 2 | * Copyright (c) 2015-2022, 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 |
laurenw-arm | 483e5ac | 2022-04-21 15:49:00 -0500 | [diff] [blame] | 17 | #elif defined(ARM_COT_cca) |
| 18 | #define COT_MAX_VERIFIED_PARAMS 8 |
Manish Pandey | 5f8e1a0 | 2020-05-27 22:40:10 +0100 | [diff] [blame] | 19 | #else |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 20 | #define COT_MAX_VERIFIED_PARAMS 4 |
Manish Pandey | 5f8e1a0 | 2020-05-27 22:40:10 +0100 | [diff] [blame] | 21 | #endif |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 22 | |
Manish V Badarkhe | 043fd62 | 2020-05-16 16:36:39 +0100 | [diff] [blame] | 23 | /* |
| 24 | * Maximum key and hash sizes (in DER format). |
| 25 | * |
| 26 | * Both RSA and ECDSA keys may be used at the same time. In this case, the key |
| 27 | * buffers must be big enough to hold either. As RSA keys are bigger than ECDSA |
| 28 | * ones for all key sizes we support, they impose the minimum size of these |
| 29 | * buffers. |
| 30 | */ |
| 31 | #if TF_MBEDTLS_USE_RSA |
| 32 | #if TF_MBEDTLS_KEY_SIZE == 1024 |
| 33 | #define PK_DER_LEN 162 |
| 34 | #elif TF_MBEDTLS_KEY_SIZE == 2048 |
| 35 | #define PK_DER_LEN 294 |
| 36 | #elif TF_MBEDTLS_KEY_SIZE == 3072 |
| 37 | #define PK_DER_LEN 422 |
| 38 | #elif TF_MBEDTLS_KEY_SIZE == 4096 |
| 39 | #define PK_DER_LEN 550 |
| 40 | #else |
| 41 | #error "Invalid value for TF_MBEDTLS_KEY_SIZE" |
| 42 | #endif |
| 43 | #else /* Only using ECDSA keys. */ |
Nicolas Toromanoff | 6bc2bbf | 2020-11-17 10:03:40 +0100 | [diff] [blame] | 44 | #define PK_DER_LEN 92 |
Manish V Badarkhe | 043fd62 | 2020-05-16 16:36:39 +0100 | [diff] [blame] | 45 | #endif |
| 46 | |
| 47 | #if TF_MBEDTLS_HASH_ALG_ID == TF_MBEDTLS_SHA256 |
| 48 | #define HASH_DER_LEN 51 |
| 49 | #elif TF_MBEDTLS_HASH_ALG_ID == TF_MBEDTLS_SHA384 |
| 50 | #define HASH_DER_LEN 67 |
| 51 | #elif TF_MBEDTLS_HASH_ALG_ID == TF_MBEDTLS_SHA512 |
| 52 | #define HASH_DER_LEN 83 |
| 53 | #else |
| 54 | #error "Invalid value for TF_MBEDTLS_HASH_ALG_ID" |
| 55 | #endif |
| 56 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 57 | #endif /* COT_DEF_H */ |