mirror of
https://github.com/tsl0922/EPD-nRF5.git
synced 2025-12-06 15:42:48 +08:00
disable dfu ecc validation
This saves 4KB of space
This commit is contained in:
@@ -276,8 +276,8 @@
|
|||||||
</OCR_RVCT3>
|
</OCR_RVCT3>
|
||||||
<OCR_RVCT4>
|
<OCR_RVCT4>
|
||||||
<Type>1</Type>
|
<Type>1</Type>
|
||||||
<StartAddress>0x3ac00</StartAddress>
|
<StartAddress>0x3bc00</StartAddress>
|
||||||
<Size>0x5000</Size>
|
<Size>0x4000</Size>
|
||||||
</OCR_RVCT4>
|
</OCR_RVCT4>
|
||||||
<OCR_RVCT5>
|
<OCR_RVCT5>
|
||||||
<Type>1</Type>
|
<Type>1</Type>
|
||||||
|
|||||||
@@ -276,8 +276,8 @@
|
|||||||
</OCR_RVCT3>
|
</OCR_RVCT3>
|
||||||
<OCR_RVCT4>
|
<OCR_RVCT4>
|
||||||
<Type>1</Type>
|
<Type>1</Type>
|
||||||
<StartAddress>0x28000</StartAddress>
|
<StartAddress>0x29000</StartAddress>
|
||||||
<Size>0x6000</Size>
|
<Size>0x5000</Size>
|
||||||
</OCR_RVCT4>
|
</OCR_RVCT4>
|
||||||
<OCR_RVCT5>
|
<OCR_RVCT5>
|
||||||
<Type>1</Type>
|
<Type>1</Type>
|
||||||
|
|||||||
@@ -167,10 +167,10 @@ extern "C" {
|
|||||||
#ifdef S210
|
#ifdef S210
|
||||||
#define NRF_CLOCK_LFCLKSRC NRF_CLOCK_LFCLKSRC_XTAL_20_PPM
|
#define NRF_CLOCK_LFCLKSRC NRF_CLOCK_LFCLKSRC_XTAL_20_PPM
|
||||||
#else
|
#else
|
||||||
#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_SYNTH, \
|
#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_RC, \
|
||||||
.rc_ctiv = 0, \
|
.rc_ctiv = 16, \
|
||||||
.rc_temp_ctiv = 0, \
|
.rc_temp_ctiv = 2, \
|
||||||
.xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}
|
.xtal_accuracy = 0}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -270,54 +270,54 @@ static nrf_dfu_res_code_t dfu_handle_prevalidate(dfu_signed_command_t const * p_
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Check the signature
|
// Check the signature
|
||||||
switch (p_command->signature_type)
|
// switch (p_command->signature_type)
|
||||||
{
|
// {
|
||||||
case DFU_SIGNATURE_TYPE_ECDSA_P256_SHA256:
|
// case DFU_SIGNATURE_TYPE_ECDSA_P256_SHA256:
|
||||||
{
|
// {
|
||||||
// prepare the actual hash destination.
|
// // prepare the actual hash destination.
|
||||||
hash_data.p_le_data = &hash[0];
|
// hash_data.p_le_data = &hash[0];
|
||||||
hash_data.len = sizeof(hash);
|
// hash_data.len = sizeof(hash);
|
||||||
|
|
||||||
NRF_LOG_INFO("Init command:\r\n");
|
// NRF_LOG_INFO("Init command:\r\n");
|
||||||
NRF_LOG_HEXDUMP_INFO(&s_dfu_settings.init_command[0], s_dfu_settings.progress.command_size);
|
// NRF_LOG_HEXDUMP_INFO(&s_dfu_settings.init_command[0], s_dfu_settings.progress.command_size);
|
||||||
NRF_LOG_INFO("\r\n");
|
// NRF_LOG_INFO("\r\n");
|
||||||
|
|
||||||
NRF_LOG_INFO("p_Init command:\r\n");
|
// NRF_LOG_INFO("p_Init command:\r\n");
|
||||||
NRF_LOG_HEXDUMP_INFO(&p_init_cmd[0], init_cmd_len);
|
// NRF_LOG_HEXDUMP_INFO(&p_init_cmd[0], init_cmd_len);
|
||||||
NRF_LOG_INFO("\r\n");
|
// NRF_LOG_INFO("\r\n");
|
||||||
|
|
||||||
err_code = nrf_crypto_hash_compute(NRF_CRYPTO_HASH_ALG_SHA256, p_init_cmd, init_cmd_len, &hash_data);
|
// err_code = nrf_crypto_hash_compute(NRF_CRYPTO_HASH_ALG_SHA256, p_init_cmd, init_cmd_len, &hash_data);
|
||||||
if (err_code != NRF_SUCCESS)
|
// if (err_code != NRF_SUCCESS)
|
||||||
{
|
// {
|
||||||
return NRF_DFU_RES_CODE_OPERATION_FAILED;
|
// return NRF_DFU_RES_CODE_OPERATION_FAILED;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// prepare the signature received over the air.
|
// // prepare the signature received over the air.
|
||||||
memcpy(&sig[0], p_command->signature.bytes, p_command->signature.size);
|
// memcpy(&sig[0], p_command->signature.bytes, p_command->signature.size);
|
||||||
|
|
||||||
NRF_LOG_INFO("Signature\r\n");
|
// NRF_LOG_INFO("Signature\r\n");
|
||||||
NRF_LOG_HEXDUMP_INFO(&p_command->signature.bytes[0], p_command->signature.size);
|
// NRF_LOG_HEXDUMP_INFO(&p_command->signature.bytes[0], p_command->signature.size);
|
||||||
NRF_LOG_INFO("\r\n");
|
// NRF_LOG_INFO("\r\n");
|
||||||
|
|
||||||
crypto_sig.p_le_data = sig;
|
// crypto_sig.p_le_data = sig;
|
||||||
crypto_sig.len = p_command->signature.size;
|
// crypto_sig.len = p_command->signature.size;
|
||||||
|
|
||||||
NRF_LOG_INFO("signature len: %d\r\n", p_command->signature.size);
|
// NRF_LOG_INFO("signature len: %d\r\n", p_command->signature.size);
|
||||||
|
|
||||||
// calculate the signature
|
// // calculate the signature
|
||||||
err_code = nrf_crypto_verify(NRF_CRYPTO_CURVE_SECP256R1, &crypto_key_pk, &hash_data, &crypto_sig);
|
// err_code = nrf_crypto_verify(NRF_CRYPTO_CURVE_SECP256R1, &crypto_key_pk, &hash_data, &crypto_sig);
|
||||||
if (err_code != NRF_SUCCESS)
|
// if (err_code != NRF_SUCCESS)
|
||||||
{
|
// {
|
||||||
return NRF_DFU_RES_CODE_INVALID_OBJECT;
|
// return NRF_DFU_RES_CODE_INVALID_OBJECT;
|
||||||
}
|
// }
|
||||||
|
|
||||||
NRF_LOG_INFO("Image verified\r\n");
|
// NRF_LOG_INFO("Image verified\r\n");
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
default:
|
// default:
|
||||||
return NRF_DFU_RES_CODE_OPERATION_FAILED;
|
// return NRF_DFU_RES_CODE_OPERATION_FAILED;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Get the update size
|
// Get the update size
|
||||||
m_firmware_size_req = 0;
|
m_firmware_size_req = 0;
|
||||||
|
|||||||
@@ -545,14 +545,14 @@ nrf_dfu_result_t nrf_dfu_validation_prevalidate(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate signature.
|
// Validate signature.
|
||||||
if (signature_required(p_command->init.type))
|
// if (signature_required(p_command->init.type))
|
||||||
{
|
// {
|
||||||
ret_val = nrf_dfu_validation_signature_check(signature_type,
|
// ret_val = nrf_dfu_validation_signature_check(signature_type,
|
||||||
p_signature,
|
// p_signature,
|
||||||
signature_len,
|
// signature_len,
|
||||||
m_init_packet_data_ptr,
|
// m_init_packet_data_ptr,
|
||||||
m_init_packet_data_len);
|
// m_init_packet_data_len);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Validate versions.
|
// Validate versions.
|
||||||
if (ret_val == NRF_DFU_RES_CODE_SUCCESS)
|
if (ret_val == NRF_DFU_RES_CODE_SUCCESS)
|
||||||
@@ -639,7 +639,7 @@ static bool nrf_dfu_validation_hash_ok(uint8_t const * p_hash, uint32_t src_addr
|
|||||||
|
|
||||||
nrf_crypto_hash_context_t hash_context = {0};
|
nrf_crypto_hash_context_t hash_context = {0};
|
||||||
|
|
||||||
crypto_init();
|
// crypto_init();
|
||||||
|
|
||||||
if (little_endian)
|
if (little_endian)
|
||||||
{
|
{
|
||||||
@@ -971,15 +971,16 @@ bool nrf_dfu_validation_boot_validate(boot_validation_t const * p_validation, ui
|
|||||||
return nrf_dfu_validation_hash_ok(p_validation->bytes, data_addr, data_len, false);
|
return nrf_dfu_validation_hash_ok(p_validation->bytes, data_addr, data_len, false);
|
||||||
|
|
||||||
case VALIDATE_ECDSA_P256_SHA256:
|
case VALIDATE_ECDSA_P256_SHA256:
|
||||||
{
|
// {
|
||||||
nrf_dfu_result_t res_code = nrf_dfu_validation_signature_check(
|
// nrf_dfu_result_t res_code = nrf_dfu_validation_signature_check(
|
||||||
DFU_SIGNATURE_TYPE_ECDSA_P256_SHA256,
|
// DFU_SIGNATURE_TYPE_ECDSA_P256_SHA256,
|
||||||
p_validation->bytes,
|
// p_validation->bytes,
|
||||||
NRF_CRYPTO_ECDSA_SECP256R1_SIGNATURE_SIZE,
|
// NRF_CRYPTO_ECDSA_SECP256R1_SIGNATURE_SIZE,
|
||||||
p_data,
|
// p_data,
|
||||||
data_len);
|
// data_len);
|
||||||
return (res_code == NRF_DFU_RES_CODE_SUCCESS);
|
// return (res_code == NRF_DFU_RES_CODE_SUCCESS);
|
||||||
}
|
// }
|
||||||
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
|
|||||||
@@ -5155,12 +5155,12 @@
|
|||||||
// <2=> NRF_CLOCK_LF_SRC_SYNTH
|
// <2=> NRF_CLOCK_LF_SRC_SYNTH
|
||||||
|
|
||||||
#ifndef NRF_SDH_CLOCK_LF_SRC
|
#ifndef NRF_SDH_CLOCK_LF_SRC
|
||||||
#define NRF_SDH_CLOCK_LF_SRC 2
|
#define NRF_SDH_CLOCK_LF_SRC 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// <o> NRF_SDH_CLOCK_LF_RC_CTIV - SoftDevice calibration timer interval.
|
// <o> NRF_SDH_CLOCK_LF_RC_CTIV - SoftDevice calibration timer interval.
|
||||||
#ifndef NRF_SDH_CLOCK_LF_RC_CTIV
|
#ifndef NRF_SDH_CLOCK_LF_RC_CTIV
|
||||||
#define NRF_SDH_CLOCK_LF_RC_CTIV 0
|
#define NRF_SDH_CLOCK_LF_RC_CTIV 16
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// <o> NRF_SDH_CLOCK_LF_RC_TEMP_CTIV - SoftDevice calibration timer interval under constant temperature.
|
// <o> NRF_SDH_CLOCK_LF_RC_TEMP_CTIV - SoftDevice calibration timer interval under constant temperature.
|
||||||
@@ -5168,7 +5168,7 @@
|
|||||||
// <i> if the temperature has not changed.
|
// <i> if the temperature has not changed.
|
||||||
|
|
||||||
#ifndef NRF_SDH_CLOCK_LF_RC_TEMP_CTIV
|
#ifndef NRF_SDH_CLOCK_LF_RC_TEMP_CTIV
|
||||||
#define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 0
|
#define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// <o> NRF_SDH_CLOCK_LF_ACCURACY - External clock accuracy used in the LL to compute timing.
|
// <o> NRF_SDH_CLOCK_LF_ACCURACY - External clock accuracy used in the LL to compute timing.
|
||||||
@@ -5187,7 +5187,7 @@
|
|||||||
// <11=> NRF_CLOCK_LF_ACCURACY_1_PPM
|
// <11=> NRF_CLOCK_LF_ACCURACY_1_PPM
|
||||||
|
|
||||||
#ifndef NRF_SDH_CLOCK_LF_ACCURACY
|
#ifndef NRF_SDH_CLOCK_LF_ACCURACY
|
||||||
#define NRF_SDH_CLOCK_LF_ACCURACY 7
|
#define NRF_SDH_CLOCK_LF_ACCURACY 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// </h>
|
// </h>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user