From patchwork Thu Dec 5 10:58:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffy Chen X-Patchwork-Id: 1204582 X-Patchwork-Delegate: ykai007@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47TCr85L1Kz9sP6 for ; Thu, 5 Dec 2019 22:17:56 +1100 (AEDT) Received: by phobos.denx.de (Postfix, from userid 109) id 61B298175E; Thu, 5 Dec 2019 12:17:51 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.denx.de X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_SORBS_WEB,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from phobos.denx.de (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F367281740; Thu, 5 Dec 2019 12:11:14 +0100 (CET) Authentication-Results: mail.denx.de; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id DB82681700; Thu, 5 Dec 2019 12:09:26 +0100 (CET) Received: from lucky1.263xmail.com (lucky1.263xmail.com [211.157.147.132]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 30E278187A for ; Thu, 5 Dec 2019 11:58:37 +0100 (CET) Authentication-Results: mail.denx.de; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.denx.de; spf=fail smtp.mailfrom=jeffy.chen@rock-chips.com Received: from localhost (unknown [192.168.167.16]) by lucky1.263xmail.com (Postfix) with ESMTP id 07058828C7; Thu, 5 Dec 2019 18:58:35 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P30014T140341247948544S1575543515183407_; Thu, 05 Dec 2019 18:58:35 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: X-RL-SENDER: jeffy.chen@rock-chips.com X-SENDER: cjf@rock-chips.com X-LOGIN-NAME: jeffy.chen@rock-chips.com X-FST-TO: u-boot@lists.denx.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 From: Jeffy Chen To: u-boot@lists.denx.de Subject: [PATCH v2 3/3] rockchip: mkimage: fix wrong range of rc4 encoding for boot image Date: Thu, 5 Dec 2019 18:58:29 +0800 Message-Id: <20191205105829.14715-4-jeffy.chen@rock-chips.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191205105829.14715-1-jeffy.chen@rock-chips.com> References: <20191205105829.14715-1-jeffy.chen@rock-chips.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andy.yan@rock-chips.com, Jeffy Chen Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at mail.denx.de X-Virus-Status: Clean The rc4 encoding should cover spl header as well, and the file_size contains spl header too. Signed-off-by: Jeffy Chen Reviewed-by: Kever Yang --- Changes in v2: None tools/rkimage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/rkimage.c b/tools/rkimage.c index ae50de55c9..1c5540b1c3 100644 --- a/tools/rkimage.c +++ b/tools/rkimage.c @@ -18,7 +18,7 @@ static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd, memcpy(buf, rkcommon_get_spl_hdr(params), RK_SPL_HDR_SIZE); if (rkcommon_need_rc4_spl(params)) - rkcommon_rc4_encode_spl(buf, 4, params->file_size); + rkcommon_rc4_encode_spl(buf, 0, params->file_size); } static int rkimage_check_image_type(uint8_t type)