Skip to content

Commit

Permalink
mediatek: mt7988: add anti-rollback support
Browse files Browse the repository at this point in the history
This patch adds anti-rollback v2 support for mt7988

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
  • Loading branch information
hackpascal committed Jul 24, 2023
1 parent 29e2a3d commit b66972f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions plat/mediatek/mt7988/bl2/bl2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ endif
# Trusted board boot
include $(MTK_PLAT)/apsoc_common/bl2/tbbr.mk

# Anti-rollback
include $(MTK_PLAT)/apsoc_common/bl2/ar.mk

ifeq ($(BL2_COMPRESS),1)
BL2_CPPFLAGS += -DUSING_BL2PL
endif # END OF BL2_COMPRESS
Expand Down
16 changes: 15 additions & 1 deletion plat/mediatek/mt7988/mtk_tbbr.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

#include <plat/common/platform.h>
#include <common/debug.h>

extern int mtk_ar_get_efuse_bl_ar_ver(uint32_t *efuse_bl_ar_ver);
extern char mtk_rotpk_hash[], mtk_rotpk_hash_end[];
Expand All @@ -21,13 +22,26 @@ int plat_get_rotpk_info(void *cookie, void **key_ptr, unsigned int *key_len,

int plat_get_nv_ctr(void *cookie, unsigned int *nv_ctr)
{
#ifdef MTK_ANTI_ROLLBACK
int ret;
uint32_t efuse_bl_ar_ver;

ret = mtk_ar_get_efuse_bl_ar_ver(&efuse_bl_ar_ver);
if (ret) {
ERROR("[%s] get EFUSE_BL_AR_VER fail\n", __func__);
return ret;
}

*nv_ctr = efuse_bl_ar_ver;
#else
*nv_ctr = 0;
#endif
return 0;
}

int plat_set_nv_ctr(void *cookie, unsigned int nv_ctr)
{
return 1;
return 0;
}

int plat_get_mbedtls_heap(void **heap_addr, size_t *heap_size)
Expand Down
1 change: 1 addition & 0 deletions plat/mediatek/mt7988/platform.mk
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ include $(MTK_PLAT_SOC)/bl31.mk
include $(MTK_PLAT_SOC)/drivers/efuse/efuse.mk

include $(MTK_PLAT)/apsoc_common/bl2/tbbr_post.mk
include $(MTK_PLAT)/apsoc_common/bl2/ar_post.mk
include $(MTK_PLAT)/apsoc_common/bl2/bl2_image_post.mk

OPTEE_TZRAM_SIZE := 0x10000
Expand Down

0 comments on commit b66972f

Please sign in to comment.