feat(crypto): update crypto module for DRTM support

Updated crypto module to include crypto calls necessary for a
DRTM supported build.

Signed-off-by: Manish V Badarkhe <manish.badarkhe@arm.com>
Change-Id: I4f945997824393f46864b7fb7fd380308a025452
diff --git a/Makefile b/Makefile
index 6d15e27..bede21a 100644
--- a/Makefile
+++ b/Makefile
@@ -730,7 +730,7 @@
     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 eada357..2028d53 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 @@
 	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 @@
 					   digest_info_ptr, digest_info_len);
 }
 
-#if MEASURED_BOOT
+#if MEASURED_BOOT || DRTM_SUPPORT
 /*
  * Calculate a hash
  *
@@ -129,7 +129,7 @@
 
 	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 73b2b99..103f085 100644
--- a/include/drivers/auth/crypto_mod.h
+++ b/include/drivers/auth/crypto_mod.h
@@ -57,12 +57,12 @@
 	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 @@
 			    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 @@
 		.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;