blob: 34c2ce55d9f8bc1b665bdfca9fb83719b86e055a [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/*******************************************************************************
2 * Copyright (C) 2016, ZIXC Corporation.
3 *
4 * File Name:
5 * File Mark:
6 * Description:
7 * Others:
8 * Version:
9 * Author:
10 * Date:
11 * History 1:
12 * Date:
13 * Version:
14 * Author:
15 * Modification:
16 * History 2:
17 ********************************************************************************/
18#ifndef __SECURE_VERIFY_H__
19#define __SECURE_VERIFY_H__
20//#include <image.h>
21
22/*--------------CRM ¼Ä´æÆ÷------------*/
23#define SYS_CTRL_BASE 0x00140000
24#define SYS_LSP_CRM_BASE 0x01400000
25#define SYS_MATRIX_CRM_BASE 0x01306000
26#define SYS_SOC_CRM_BASE 0x0013b000
27
28
29#define EFUSE_BYPASS (SYS_CTRL_BASE+0x140)
30#define BOOTSEL_INFO (SYS_SOC_CRM_BASE+0x4)
31#define MPLL_CFG0 (SYS_SOC_CRM_BASE+0x8)
32#define UPLL_CFG0 (SYS_SOC_CRM_BASE+0x10)
33#define RMCORE_CLK_CFG (SYS_SOC_CRM_BASE+0x38)
34#define RM_MOD_CLKSEL (SYS_SOC_CRM_BASE+0x3c)
35#define MATRIX_AXI_SEL (SYS_MATRIX_CRM_BASE+0x0)
36
37/* -------- efuse ²ÎÊý-------------*/
38#define SYS_EFUSE_BASE 0x0121b000
39#define EFUSE_RAM_BASE (SYS_EFUSE_BASE+0x40)
40
41/* -------- RSA, HASH ²ÎÊý-------------*/
42#define SYS_RSA_BASE 0x0121c000
43#define SYS_HASH_BASE 0x0121d000
44
45/*ΪÁË¿´ÆðÀ´·½±ã, hashºÍkeyÔÚbufferµÄ´æ·Å˳ÐòΪµÍµØÖ··Å¸ßλÊý¾Ý*/
46// ¶¨Òå½á¹¹
47typedef volatile struct
48{
49 u32 secure_flag;
50 u32 puk_hash[4];
51 u32 dev_id[3];
52} efuse_struct;
53
54typedef struct
55{
56 u32 uiPubKeyRsaE[32];
57 u32 uiPubKeyRsaN[32];
58 u32 uiHashY[32];
59} sImageHeader;
60
61static void get_efuse_data(void);
62static u32 SMALL2BIG(u32 *puiArrIn, u32 *puiArrOut, u32 uiLen);
63u8 secure_verify(u32 addr);
64static u8 data_cmp_word(u32* src, u32* dst, u32 cnt);
65int efuse_init(void);
66void efuse_get_devinfo(efuse_struct *efuse_info);
67
68#endif /* __SECURE_VERIFY_H__ */