summaryrefslogtreecommitdiff
path: root/bl1/bl1_main.c
diff options
context:
space:
mode:
authorJuan Castillo <juan.castillo@arm.com>2015-05-19 11:54:12 +0100
committerJuan Castillo <juan.castillo@arm.com>2015-06-25 08:53:27 +0100
commit1779ba6b97fbff87290f164c7c78559329173e02 (patch)
tree366ee19673e8fbe3b36e676f77511c4f3e4e1268 /bl1/bl1_main.c
parentccbf890e5e2fb75b4df30f50f06c505702a0e01c (diff)
TBB: switch to the new authentication framework
This patch modifies the Trusted Board Boot implementation to use the new authentication framework, making use of the authentication module, the cryto module and the image parser module to authenticate the images in the Chain of Trust. A new function 'load_auth_image()' has been implemented. When TBB is enabled, this function will call the authentication module to authenticate parent images following the CoT up to the root of trust to finally load and authenticate the requested image. The platform is responsible for picking up the right makefiles to build the corresponding cryptographic and image parser libraries. ARM platforms use the mbedTLS based libraries. The platform may also specify what key algorithm should be used to sign the certificates. This is done by declaring the 'KEY_ALG' variable in the platform makefile. FVP and Juno use ECDSA keys. On ARM platforms, BL2 and BL1-RW regions have been increased 4KB each to accommodate the ECDSA code. REMOVED BUILD OPTIONS: * 'AUTH_MOD' Change-Id: I47d436589fc213a39edf5f5297bbd955f15ae867
Diffstat (limited to 'bl1/bl1_main.c')
-rw-r--r--bl1/bl1_main.c43
1 files changed, 4 insertions, 39 deletions
diff --git a/bl1/bl1_main.c b/bl1/bl1_main.c
index c270cf49..e3225319 100644
--- a/bl1/bl1_main.c
+++ b/bl1/bl1_main.c
@@ -31,7 +31,7 @@
#include <arch.h>
#include <arch_helpers.h>
#include <assert.h>
-#include <auth.h>
+#include <auth_mod.h>
#include <bl_common.h>
#include <debug.h>
#include <platform.h>
@@ -161,38 +161,16 @@ void bl1_main(void)
#if TRUSTED_BOARD_BOOT
/* Initialize authentication module */
- auth_init();
-
- /*
- * Load the BL2 certificate into the BL2 region. This region will be
- * overwritten by the image, so the authentication module is responsible
- * for storing the relevant data from the certificate (keys, hashes,
- * etc.) so it can be used later.
- */
- err = load_image(bl1_tzram_layout,
- BL2_CERT_ID,
- BL2_BASE,
- &bl2_image_info,
- NULL);
- if (err) {
- ERROR("Failed to load BL2 certificate.\n");
- panic();
- }
-
- err = auth_verify_obj(AUTH_BL2_IMG_CERT, bl2_image_info.image_base,
- bl2_image_info.image_size);
- if (err) {
- ERROR("Failed to validate BL2 certificate.\n");
- panic();
- }
+ auth_mod_init();
#endif /* TRUSTED_BOARD_BOOT */
/* Load the BL2 image */
- err = load_image(bl1_tzram_layout,
+ err = load_auth_image(bl1_tzram_layout,
BL2_IMAGE_ID,
BL2_BASE,
&bl2_image_info,
&bl2_ep);
+
if (err) {
/*
* TODO: print failure to load BL2 but also add a tzwdog timer
@@ -202,19 +180,6 @@ void bl1_main(void)
panic();
}
-#if TRUSTED_BOARD_BOOT
- err = auth_verify_obj(AUTH_BL2_IMG, bl2_image_info.image_base,
- bl2_image_info.image_size);
- if (err) {
- ERROR("Failed to validate BL2 image.\n");
- panic();
- }
-
- /* After working with data, invalidate the data cache */
- inv_dcache_range(bl2_image_info.image_base,
- (size_t)bl2_image_info.image_size);
-#endif /* TRUSTED_BOARD_BOOT */
-
/*
* Create a new layout of memory for BL2 as seen by BL1 i.e.
* tell it the amount of total and free memory available.