
Chengdu Ebyte Electronic Technology Co., Ltd.
E104-BT5040U Datasheet
Copyright©2020, Chengdu Ebyte Electronic Technology Co., Ltd.
4.3The Modified Codes
4.3.Public Key(dfu_public_key.c)
#ifdef NRF_DFU_DEBUG_VERSION
/**
@brief
Public key used to verify DFU images */
__ALIGN
(
4
)
const uint8_t pk
[
64
] =
{
0x1b
,
0x0c
,
0xae
,
0x9f
,
0x22
,
0x80
,
0x60
,
0xa1
,
0x85
,
0xa0
,
0xba
,
0x18
,
0xe7
,
0xaf
,
0xfc
,
0x94
,
0x63
,
0xfb
,
0xd2
,
0x58
,
0xac
,
0xde
,
0x1c
,
0xa0
,
0x1d
,
0x2a
,
0xd2
,
0x0d
,
0x25
,
0x72
,
0x9f
,
0x37
,
0x57
,
0x00
,
0xc4
,
0xf6
,
0x0b
,
0x92
,
0x21
,
0x44
,
0x85
,
0x70
,
0x5d
,
0xbe
,
0x62
,
0x0d
,
0x9e
,
0x09
,
0x82
,
0x02
,
0xf8
,
0xec
,
0x3b
,
0xcd
,
0x06
,
0xb5
,
0xc9
,
0x68
,
0xc7
,
0xff
,
0x2e
,
0xe7
,
0x95
,
0x4a
};
#else
/**
@brief
Public key used to verify DFU images */
__ALIGN
(
4
)
const uint8_t
pk
[
64
] =
{
0xc2
,
0xdf
,
0x7a
,
0x7f
,
0x4a
,
0x64
,
0xcd
,
0x56
,
0x63
,
0x77
,
0x82
,
0x94
,
0x49
,
0x70
,
0xe8
,
0x1b
,
0x8f
,
0x69
,
0x31
,
0xd7
,
0xcb
,
0x71
,
0x0f
,
0x2d
,
0xcc
,
0x03
,
0x7d
,
0x6f
,
0x26
,
0x14
,
0x1d
,
0x32
,
0x55
,
0xa2
,
0x2f
,
0xea
,
0x7e
,
0x1d
,
0xca
,
0x52
,
0xa0
,
0x86
,
0x9f
,
0xee
,
0x16
,
0x43
,
0xc8
,
0x8e
,
0x3f
,
0xbc
,
0xcc
,
0xa3
,
0x2b
,
0x36
,
0xe1
,
0x0e
,
0xdb
,
0xeb
,
0x6f
,
0x7b
,
0x3c
,
0x79
,
0x67
,
0x55
};
#endif
4.3.2 Disable Hash value check function
File Routing
:
“nRF5SDK160098a08e2\components\libraries\bootloader\dfu\nrf_dfu_validation.c”.
Disable below codes.
err_code
=
nrf_crypto_ecdsa_verify
(&
m_verify_context
,
&
m_public_key
,
m_init_packet_hash
,
hash_len
,
m_signature
,
sizeof
(
m_signature
));
//
if (err_code != NRF_SUCCESS)
//
{
//
NRF_LOG_ERROR("Signature failed (err_code: 0x%x)", err_code);
//
NRF_LOG_DEBUG("Signature:");
//
NRF_LOG_HEXDUMP_DEBUG(m_signature, sizeof(m_signature));
//
NRF_LOG_DEBUG("Hash:");
//
NRF_LOG_HEXDUMP_DEBUG(m_init_packet_hash, hash_len);