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