diff --git a/Makefile b/Makefile index 6d15e27c2..bede21a10 100644 --- a/Makefile +++ b/Makefile @@ -730,7 +730,7 @@ ifeq ($(DYN_DISABLE_AUTH), 1) endif endif -ifneq ($(filter 1,${MEASURED_BOOT} ${TRUSTED_BOARD_BOOT}),) +ifneq ($(filter 1,${MEASURED_BOOT} ${TRUSTED_BOARD_BOOT} ${DRTM_SUPPORT}),) CRYPTO_SUPPORT := 1 else CRYPTO_SUPPORT := 0 diff --git a/drivers/auth/crypto_mod.c b/drivers/auth/crypto_mod.c index eada3579a..2028d53d8 100644 --- a/drivers/auth/crypto_mod.c +++ b/drivers/auth/crypto_mod.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2021, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2022, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -50,9 +50,9 @@ void crypto_mod_init(void) assert(crypto_lib_desc.verify_signature != NULL); assert(crypto_lib_desc.verify_hash != NULL); #endif /* TRUSTED_BOARD_BOOT */ -#if MEASURED_BOOT +#if MEASURED_BOOT || DRTM_SUPPORT assert(crypto_lib_desc.calc_hash != NULL); -#endif /* MEASURED_BOOT */ +#endif /* MEASURED_BOOT || DRTM_SUPPORT */ /* Initialize the cryptographic library */ crypto_lib_desc.init(); @@ -109,7 +109,7 @@ int crypto_mod_verify_hash(void *data_ptr, unsigned int data_len, digest_info_ptr, digest_info_len); } -#if MEASURED_BOOT +#if MEASURED_BOOT || DRTM_SUPPORT /* * Calculate a hash * @@ -129,7 +129,7 @@ int crypto_mod_calc_hash(enum crypto_md_algo alg, void *data_ptr, return crypto_lib_desc.calc_hash(alg, data_ptr, data_len, output); } -#endif /* MEASURED_BOOT */ +#endif /* MEASURED_BOOT || DRTM_SUPPORT */ /* * Authenticated decryption of data diff --git a/include/drivers/auth/crypto_mod.h b/include/drivers/auth/crypto_mod.h index 73b2b998c..103f08500 100644 --- a/include/drivers/auth/crypto_mod.h +++ b/include/drivers/auth/crypto_mod.h @@ -57,12 +57,12 @@ typedef struct crypto_lib_desc_s { int (*verify_hash)(void *data_ptr, unsigned int data_len, void *digest_info_ptr, unsigned int digest_info_len); -#if MEASURED_BOOT +#if MEASURED_BOOT || DRTM_SUPPORT /* Calculate a hash. Return hash value */ int (*calc_hash)(enum crypto_md_algo md_alg, void *data_ptr, unsigned int data_len, unsigned char output[CRYPTO_MD_MAX_SIZE]); -#endif /* MEASURED_BOOT */ +#endif /* MEASURED_BOOT || DRTM_SUPPORT */ /* * Authenticated decryption. Return one of the @@ -96,13 +96,13 @@ int crypto_mod_auth_decrypt(enum crypto_dec_algo dec_algo, void *data_ptr, unsigned int iv_len, const void *tag, unsigned int tag_len); -#if MEASURED_BOOT +#if MEASURED_BOOT || DRTM_SUPPORT int crypto_mod_calc_hash(enum crypto_md_algo alg, void *data_ptr, unsigned int data_len, unsigned char output[CRYPTO_MD_MAX_SIZE]); -#endif /* MEASURED_BOOT */ +#endif /* MEASURED_BOOT || DRTM_SUPPORT */ -#if MEASURED_BOOT && TRUSTED_BOARD_BOOT +#if (MEASURED_BOOT || DRTM_SUPPORT) && TRUSTED_BOARD_BOOT /* Macro to register a cryptographic library */ #define REGISTER_CRYPTO_LIB(_name, _init, _verify_signature, _verify_hash, \ _calc_hash, _auth_decrypt) \ @@ -124,14 +124,14 @@ int crypto_mod_calc_hash(enum crypto_md_algo alg, void *data_ptr, .verify_hash = _verify_hash, \ .auth_decrypt = _auth_decrypt \ } -#elif MEASURED_BOOT +#elif MEASURED_BOOT || DRTM_SUPPORT #define REGISTER_CRYPTO_LIB(_name, _init, _calc_hash) \ const crypto_lib_desc_t crypto_lib_desc = { \ .name = _name, \ .init = _init, \ .calc_hash = _calc_hash, \ } -#endif /* MEASURED_BOOT && TRUSTED_BOARD_BOOT */ +#endif /* (MEASURED_BOOT || DRTM_SUPPORT) && TRUSTED_BOARD_BOOT */ extern const crypto_lib_desc_t crypto_lib_desc;