From f9f561ad1485da9e1926e9486e8063568b36a085 Mon Sep 17 00:00:00 2001 From: x00405909 Date: Thu, 20 May 2021 20:49:24 +0800 Subject: [PATCH] update sign len Change-Id: I76ae051727d9f34fa48c1af9475794e34f97bb82 --- .../product/hiupdate/auto_update_adaptation.c | 11 ++++++++--- .../product/hiupdate/ota_update/ota_update.c | 7 ++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/u-boot-2020.01/product/hiupdate/auto_update_adaptation.c b/u-boot-2020.01/product/hiupdate/auto_update_adaptation.c index 0d7ffbd3b2..306d320dcc 100644 --- a/u-boot-2020.01/product/hiupdate/auto_update_adaptation.c +++ b/u-boot-2020.01/product/hiupdate/auto_update_adaptation.c @@ -1093,6 +1093,9 @@ static int update_to_flash(void) cnt = 0; do { res = au_do_update(i, (unsigned long)sz); + if (!res) { + printf("%s write success!\n", aufile[i]); + } #ifdef CONFIG_AUTO_OTA_UPDATE if (g_is_ota) break; @@ -1108,10 +1111,12 @@ static int update_to_flash(void) } while (res < 0); } - if (uboot_updated == 1) + if (uboot_updated == 1) { + printf("update success!\n"); return 1; - else - return -1; + } + + return -1; } #else void get_sparse_header(int file_idx, struct seg_update_parm *update_parm) diff --git a/u-boot-2020.01/product/hiupdate/ota_update/ota_update.c b/u-boot-2020.01/product/hiupdate/ota_update/ota_update.c index 1fe4bf610c..a9305c692e 100644 --- a/u-boot-2020.01/product/hiupdate/ota_update/ota_update.c +++ b/u-boot-2020.01/product/hiupdate/ota_update/ota_update.c @@ -32,7 +32,8 @@ #define PACKAGE_HEADER_FILE "infocomp.bin" -#define SIGN_DATA_LEN 256 +#define SIGN_DATA_LEN 640 +#define SIGN_RSA2048_LEN 256 #define BASIC_VERSION_OFFSET 76 #define VERSION_LEN 64 #define COMPONENT_INFO_START 176 @@ -255,7 +256,7 @@ static int verify_package_sign(const unsigned char *info_buf, { int ret; unsigned int header_len; - unsigned char sign[SIGN_DATA_LEN]; + unsigned char sign[SIGN_RSA2048_LEN]; unsigned char *info_header = NULL; if (info_len <= SIGN_DATA_LEN || info_len > 2 * 1024 * 1024) { @@ -264,7 +265,7 @@ static int verify_package_sign(const unsigned char *info_buf, } header_len = info_len - SIGN_DATA_LEN; - memcpy(sign, info_buf + header_len, SIGN_DATA_LEN); + memcpy(sign, info_buf + header_len, SIGN_RSA2048_LEN); info_header = malloc(header_len); if (!info_header) { UPD_LOGE("malloc fail"); -- Gitee