Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

riscv: telink: load DAC key/cert from flash zone. #366

Merged
merged 5 commits into from
Jan 13, 2025

Conversation

pulin1103
Copy link
Collaborator

No description provided.

{
return false;
}
if (efuse_get_chip_id(chip_id))
Copy link
Collaborator

@andy-liu-telink andy-liu-telink Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

efuse_get_chip_id在B92和TL321x中的返回值不同的,处理逻辑刚好相反。可以参考金邈的这个PR里面的处理方式:telink-semi/mcuboot#3

}

size_t dac_cert_len;
dac_cert_len = buffer[100];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100用宏表示一下吧。 比如
static constexpr uint32_t kDacContentsOffset = 100;


size_t dac_cert_len;
dac_cert_len = buffer[100];
dac_cert_len |= (uint16_t) buffer[101] << 8;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

按照上面的处理方式,这里可以101可以替换成kDacContentsOffset + 1

{
return false;
}
factoryData->dac_cert.data = buffer + 102;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kDacContentsOffset + 2

@pulin1103 pulin1103 force-pushed the develop_dual_dac_loader branch from acda9b6 to 9f99531 Compare January 9, 2025 07:18

#if CHIP_DEVICE_SECURE_PROGRAMMING

#if defined(CONFIG_SOC_RISCV_TELINK_B92)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是不是可以改成 #ifdef CONFIG_SOC_RISCV_TELINK_B92

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以统一到#ifdef

#include "aes.h"
#endif

#if defined(CONFIG_SOC_RISCV_TELINK_TL321X)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#if defined -> #ifdef

config SECURE_PROGRAMMING
bool "Enable reading DAC and keys from the DAC partition"
depends on CHIP_FACTORY_DATA
default n
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码没对齐

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还有就是,我记得海文说过,Kconfig里面不要Enable xxx,CI会不过,直接Read DAC and keys from the DAC partition会不会简单点

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以看CI结果确认一下。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

刚和海文确认了下,matter这边没这个问题,那应该没什么问题

@pulin1103 pulin1103 force-pushed the develop_dual_dac_loader branch from 9f99531 to f20f19e Compare January 9, 2025 08:05
@pulin1103 pulin1103 force-pushed the develop_dual_dac_loader branch from f20f19e to f23f72a Compare January 9, 2025 08:17
- add plaintext vid, pid & discriminator at the beginning.
- add optional argument --secure-programming-verification and --chip-id to
generate factory data and independent DAC.

Signed-off-by: Damien Ji <[email protected]>
Signed-off-by: Zhenghuan Zhang <[email protected]>
@pulin1103 pulin1103 force-pushed the develop_dual_dac_loader branch from 099e852 to 0abcf93 Compare January 10, 2025 02:04
Zhenghuan Zhang and others added 2 commits January 10, 2025 11:40
Signed-off-by: Zhenghuan Zhang <[email protected]>
- modify mfg_tool code format.
- add merge_factorydata_dac.

Signed-off-by: Damien Ji <[email protected]>
to fix code style issues.

Signed-off-by: Damien Ji <[email protected]>
}
else
{
LOG_ERR("Private key decryption failed.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个错误信息应该改成“Failed to retrieve chip ID.”

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pulin1103 How about we add this change to my next Pull Request?

@damien0x0023 damien0x0023 merged commit 390d6be into develop_dual Jan 13, 2025
64 checks passed
@damien0x0023 damien0x0023 deleted the develop_dual_dac_loader branch January 13, 2025 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants