1 /* 2 * Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef COT_DEF_H 8 #define COT_DEF_H 9 10 /* TBBR CoT definitions */ 11 12 #define COT_MAX_VERIFIED_PARAMS 4 13 14 /* 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 48 #endif /* COT_DEF_H */ 49