Skip to content

Commit 1bfd47e

Browse files
b.vikram@xilinx.comSiva Addepalli
authored andcommitted
sw_apps :zynqmp_fsbl: Added support for authenticated images to boot as non secure images if RSA_EN is not programmed
The patch adds support in ZynqMP FSBL to boot load images as non secure images if RSA_EN is not programmed. Signed-off-by: Vikram Sreenivasa Batchali <[email protected]> Acked-by: Krishna Chaitanya Patakamuri <[email protected]>
1 parent 104a448 commit 1bfd47e

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

lib/sw_apps/zynqmp_fsbl/src/xfsbl_initialization.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
* 8.0 bsv 12/16/20 Update print format in XFsbl_EccInit to correctly print
4747
* 64 bit addresses and lengths
4848
* bsv 04/01/21 Added TPM support
49+
* bsv 04/28/21 Added support to ensure authenticated images boot as
50+
* non-secure when RSA_EN is not programmed
4951
*
5052
* </pre>
5153
*
@@ -1260,7 +1262,7 @@ static u32 XFsbl_ValidateHeader(XFsblPs * FsblInstancePtr)
12601262
if (((EfuseCtrl & EFUSE_SEC_CTRL_RSA_EN_MASK) != 0U) ||
12611263
((BootHdrAttrb & XIH_BH_IMAGE_ATTRB_RSA_MASK)
12621264
== XIH_BH_IMAGE_ATTRB_RSA_MASK)) {
1263-
1265+
FsblInstancePtr->AuthEnabled = TRUE;
12641266
XFsbl_Printf(DEBUG_INFO,"Authentication Enabled\r\n");
12651267
#ifdef XFSBL_SECURE
12661268
/* Read AC offset from Image header table */

lib/sw_apps/zynqmp_fsbl/src/xfsbl_main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
* 2.0 bv 12/02/16 Made compliance to MISRAC 2012 guidelines
2222
* Added warm restart support
2323
* 3.0 bv 03/03/21 Print multiboot offset in FSBL banner
24+
* bsv 04/28/21 Added support to ensure authenticated images boot as
25+
* non-secure when RSA_EN is not programmed
2426
*
2527
* </pre>
2628
*
@@ -45,7 +47,8 @@ static void XFsbl_FallBack(void);
4547
static void XFsbl_MarkUsedRPUCores(XFsblPs *FsblInstPtr, u32 PartitionNum);
4648

4749
/************************** Variable Definitions *****************************/
48-
XFsblPs FsblInstance={0x3U, XFSBL_SUCCESS, 0U, 0U, 0U};
50+
XFsblPs FsblInstance = {0x3U, XFSBL_SUCCESS, 0U, 0U, 0U, 0U};
51+
4952
/*****************************************************************************/
5053
/** This is the FSBL main function and is implemented stage wise.
5154
*

lib/sw_apps/zynqmp_fsbl/src/xfsbl_main.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/******************************************************************************
2-
* Copyright (c) 2015 - 2020 Xilinx, Inc. All rights reserved.
2+
* Copyright (c) 2015 - 2021 Xilinx, Inc. All rights reserved.
33
* SPDX-License-Identifier: MIT
44
******************************************************************************/
55

@@ -19,6 +19,8 @@
1919
* 1.00 kc 10/21/13 Initial release
2020
* 2.0 vb 03/24/17 Added macros for LOVEC/HIVEC and USB boot mode,
2121
* Made compliance to MISRAC 2012 guidelines
22+
* 3.00 bsv 04/28/21 Added support to ensure authenticated images boot as
23+
* non-secure when RSA_EN is not programmed
2224
*
2325
* </pre>
2426
*
@@ -70,6 +72,8 @@ typedef struct {
7072
u32 ProcessorID; /**< One of R5-0, R5-LS, A53-0 */
7173
u32 A53ExecState; /**< One of A53 64-bit, A53 32-bit */
7274
u32 BootHdrAttributes; /**< Boot Header attributes */
75+
u32 AuthEnabled; /**< Check if RSA_EN is programmed or
76+
Boot Header authentication is enabled */
7377
u32 ImageOffsetAddress; /**< Flash offset address */
7478
XFsblPs_ImageHeader ImageHeader; /** Image header */
7579
u32 ErrorCode; /**< Error code during FSBL failure */

lib/sw_apps/zynqmp_fsbl/src/xfsbl_partition_load.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
* bsv 28/01/21 Fix build issues in case SECURE and BITSTREAM code are
4343
* excluded
4444
* bsv 04/01/21 Added TPM support
45+
* bsv 04/28/21 Added support to ensure authenticated images boot as
46+
* non-secure when RSA_EN is not programmed
4547
*
4648
* </pre>
4749
*
@@ -1200,15 +1202,15 @@ static u32 XFsbl_PartitionValidation(XFsblPs * FsblInstancePtr,
12001202
/**
12011203
* check the authentication status
12021204
*/
1203-
if (XFsbl_IsRsaSignaturePresent(PartitionHeader) ==
1204-
XIH_PH_ATTRB_RSA_SIGNATURE )
1205-
{
1205+
if ((FsblInstancePtr->AuthEnabled == TRUE) &&
1206+
(XFsbl_IsRsaSignaturePresent(PartitionHeader) ==
1207+
XIH_PH_ATTRB_RSA_SIGNATURE)) {
12061208
IsAuthenticationEnabled = TRUE;
12071209
}
1208-
else
1209-
{
1210+
else {
12101211
IsAuthenticationEnabled = FALSE;
12111212
}
1213+
12121214
/* check the checksum status */
12131215
if (XFsbl_GetChecksumType(PartitionHeader) !=
12141216
XIH_PH_ATTRB_NOCHECKSUM )

0 commit comments

Comments
 (0)