初始提交

This commit is contained in:
2025-05-13 22:00:58 +08:00
commit e4c030b0c0
564 changed files with 78858 additions and 0 deletions

View File

@ -0,0 +1,161 @@
# SignSuite : 签名秘钥类型
# 0: ECDSA_SHA256
# 1: ECDSA_SHA256_LEA_CTR
# 2: ECDSA_SHA256_LEA_CBC_MAC
# 3: ECDSA_SHA256_AES_CBC
# 10: SM2_SM3
# 11: SM2_SM3_LEA_CTR
# 12: SM2_SM3_LEA_CBC_MAC
# 13: SM2_SM3_SM4_CBC
# 30: RSA 4096
# 34: RSA 4096 - SHA256
[SIGN_CFG]
# 此SignSuite默认为ECDSA_SHA256_LEA_CTR类型
SignSuite=1
UpgImagePath =
UpgSignedImagePath =
RootKeyFile=build/config/target_config/ws63/sign_config/ec_bp256_oem_root_private_key.pem
SubKeyFile=build/config/target_config/ws63/sign_config/ec_bp256_app_private_key.pem
[TOOLS]
UpgToolPath=tools/bin/sign_tool/sign_tool_pltuni
LzmaToolPath=tools/bin/lzma_tool/lzma_tool
UpgToolWinPath=tools\bin\sign_tool\sign_tool_pltuni.exe
LzmaToolWinPath=tools\bin\lzma_tool\lzma_tool.exe
# Default Single sign mode. If there are 'RootKeyFileExt' & 'SubKeyFileExt' then means Double Sign mode.
# RootKeyFileExt=
# SubKeyFileExt=
[FOTA_KEY_AREA]
ImageId=0xCB8D154E
StructVersion=0x00010000
KeyOwnerId=0
KeyId=0
# KeyAlg :Algorithm of the external public key:
# 0x2A13C812: ECC256_SHA256 (校验签名)
# 0x2A13C823: SM2_SM3
# 0x2A13C845: RSA4096_SHA256
# 0x2A13C856: SHA256(ECC256 FORMAT)
# 0x2A13C867: SHA256(RSA4096) (校验hash)
# 0x2A13C878: SM3_ONLY
# Others: Invalid
KeyAlg=0x2A13C812
KeyVersion=0x00000000
KeyVersionMask=0x00000000
Msid=0x00000000
MsidMask=0x00000000
[FOTA_INFO_AREA]
ImageId=0xCB8D154E
StructVersion=0x00010000
Version=0x00000000
VersionMask=0x00000000
Msid=0x00000000
MsidMask=0x00000000
HardwareID=0
[flashboot]
HeaderMagic=0x464F5451
ImageId=0x4B1E3C2D
# DecompressFlag :升级镜像模式标记
# 0x3C7896E1 - compressed image
# 0x44494646 - diff image
# other :原始镜像不处理
DecompressFlag=0x3C7896E1
# ReRncFlag:升级镜像加密标记
# 0x3C7896E1:加密
# other:不加密
ReRncFlag=0x0
# RootKeyType : 用于加密图像的根密钥在ReEncFlag启用时有效
# 0 - ODRK0, for TEE runtime FW image.
# 1 - ODRK1, for Protocol and REE Application image.
RootKeyType=0x0
# 用于解密更新映像秘钥的派生参数盐值16在ReEncFlag启用时有效
ProtectionKeyL1=00000000000000000000000000000000
# 用于解密更新映像秘钥的派生参数盐值12在ReEncFlag启用时有效
ProtectionKeyL2=00000000000000000000000000000000
# 用于加密更新映像的加密保护密钥在ReEncFlag启用时有效
PlainKey=6712E3ACC547DEEF9375159058521FEB
Iv=00000000000000000000000000000000
version_ext=0x00000000
version_mask=0x00000000
[nv]
HeaderMagic=0x464F5451
ImageId=0xCB9E063C
# DecompressFlag :升级镜像模式标记
# 0 :原始镜像不处理 (nv只能使用该值)
DecompressFlag=0x0
# ReRncFlag:升级镜像加密标记
# 0x3C7896E1:加密
# other:不加密
ReRncFlag=0x0
# RootKeyType : 用于加密图像的根密钥在ReEncFlag启用时有效
# 0 - ODRK0, for TEE runtime FW image.
# 1 - ODRK1, for Protocol and REE Application image.
RootKeyType=0x0
# 用于解密更新映像秘钥的派生参数盐值16在ReEncFlag启用时有效
ProtectionKeyL1=00000000000000000000000000000000
# 用于解密更新映像秘钥的派生参数盐值12在ReEncFlag启用时有效
ProtectionKeyL2=00000000000000000000000000000000
# 用于加密更新映像的加密保护密钥在ReEncFlag启用时有效
PlainKey=6712E3ACC547DEEF9375159058521FEB
Iv=00000000000000000000000000000000
version_ext=0x00000000
version_mask=0x00000000
[application]
HeaderMagic=0x464F5451
ImageId=0x4B0F2D2D
# DecompressFlag :升级镜像模式标记
# 0x3C7896E1 - compressed image
# 0x44494646 - diff image
# other :原始镜像不处理
# DecompressFlag=0x3C7896E1
# DecompressFlag=0x44494646
DecompressFlag=0x3C7896E1
# ReRncFlag:升级镜像加密标记
# 0x3C7896E1:加密
# other:不加密
ReRncFlag=0x0
# RootKeyType : 用于加密图像的根密钥在ReEncFlag启用时有效
# 0 - ODRK0, for TEE runtime FW image.
# 1 - ODRK1, for Protocol and REE Application image.
RootKeyType=0x0
# 用于解密更新映像秘钥的派生参数盐值16byte在ReEncFlag启用时有效
ProtectionKeyL1=00112233445566778899AABBCCDDEEFF
# 用于解密更新映像秘钥的派生参数盐值前12byte在ReEncFlag启用时有效
ProtectionKeyL2=00112233445566778899AABB00000000
# 用于加密更新映像的加密保护密钥在ReEncFlag启用时有效
PlainKey=70D37764279C2B086604078E8C577505
#70D37764279C2B086604078E8C577505DEF83C1FD6E4D47BB464CF172F91156C ABRK ota加密
Iv=FF000000000000000000000000000000
version_ext=0x00000000
version_mask=0x00000000
[hilink]
HeaderMagic=0x464F5451
ImageId=0x5A87A52D
# DecompressFlag :升级镜像模式标记
# 0x3C7896E1 - compressed image
# 0x44494646 - diff image
# other :原始镜像不处理
# DecompressFlag=0x3C7896E1
# DecompressFlag=0x44494646
DecompressFlag=0x3C7896E1
# ReRncFlag:升级镜像加密标记
# 0x3C7896E1:加密
# other:不加密
ReRncFlag=0x0
# RootKeyType : 用于加密图像的根密钥在ReEncFlag启用时有效
# 0 - ODRK0, for TEE runtime FW image.
# 1 - ODRK1, for Protocol and REE Application image.
RootKeyType=0x0
# 用于解密更新映像的1级加密保护密钥在ReEncFlag启用时有效
ProtectionKeyL1=
# 用于解密更新映像的2级加密保护密钥在ReEncFlag启用时有效
ProtectionKeyL2=
version_ext=0x00000000
version_mask=0x00000000

View File

@ -0,0 +1,71 @@
#!/usr/bin/env python3
# coding=utf-8
'''
* Copyright HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2023. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Description: part of hupg build scripts
'''
import struct
from ctypes import *
###############################Defining Basic Types###############################################
td_char = c_char
td_s8 = c_byte
td_u8 = c_ubyte
td_s16 = c_short
td_u16 = c_ushort
td_s32 = c_int
td_u32 = c_uint
fota_key_area_data_fields = [
("image_id", td_u32),
("struct_version", td_u32),
("struct_length", td_u32),
("signature_length", td_u32),
("key_owner_id", td_u32),
("key_id", td_u32),
("key_alg", td_u32),
("ecc_curve_type", td_u32),
("key_length", td_u32),
("fota_key_version_ext", td_u32),
("mask_fota_key_version_ext", td_u32),
("msid_ext", td_u32),
("mask_msid_ext", td_u32),
("maintenance_mode", td_u32),
("die_id", td_u8 * 16),
("fota_info_addr", td_u32),
("reserved", td_u8 * 52),
("fota_external_public_key", td_u8 * 64),
("sig_fota_key_area", td_u8 * 64),
]
fota_info_area_data_fields = [
("image_id", td_u32),
("struct_version", td_u32),
("struct_length", td_u32),
("signature_length", td_u32),
("fota_version_ext", td_u32),
("mask_fota_version_ext", td_u32),
("msid_ext", td_u32),
("mask_msid_ext", td_u32),
("image_hash_table_addr", td_u32),
("image_hash_table_length", td_u32),
("image_hash_table_hash", td_u8 * 32),
("image_num", td_u32),
("hardware_id", td_u32),
("reserved", td_u8 * 112),
("sign_fota_info", td_u8 * 64),
]