From patchwork Fri Oct 27 04:25:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 831055 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b="NYqk2WtL"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yNW6K73kgz9t2d for ; Fri, 27 Oct 2017 15:26:32 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 83E6CC21DCE; Fri, 27 Oct 2017 04:26:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id F0572C21C34; Fri, 27 Oct 2017 04:26:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 288A1C21C34; Fri, 27 Oct 2017 04:26:21 +0000 (UTC) Received: from conuserg-07.nifty.com (conuserg-07.nifty.com [210.131.2.74]) by lists.denx.de (Postfix) with ESMTPS id D5DA2C21C29 for ; Fri, 27 Oct 2017 04:26:19 +0000 (UTC) Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v9R4PRCB009776; Fri, 27 Oct 2017 13:25:27 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v9R4PRCB009776 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1509078328; bh=ovLN2SYYNAuKBcb99nVmJm8N3R6kCwHnoCetkAZXGTQ=; h=From:To:Cc:Subject:Date:From; b=NYqk2WtLkMefBCKDXCIsxJs6lI4QHh4WomK6gm9nYWmzSF+qiNiamjrxduP3oE+EE pCS1Nmnexnrue7hGm/1/ld71WZN+Ll4iIRsi3Pz9AodyixaHUwJACkUS3iiLthvpcd 52HWYZfZBYZvL14Q/4PLaAXdNUWoTu4B2xtEz4QmmAMypk6yOLatME7TZJNCkc3dox 3QewR2MzyGR9O6zqH7u4qK0iioKiVQRx0jjpr0hE2djxBSrkLRBsWcNH3sQHnLqSV4 2w16OcFLFFWO2GqPZShAV8DeajNka9Zt1ApFXgZI5yiloiMANM/KKZMYeh25dGaONH baG0LS/7CYOkA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Fri, 27 Oct 2017 13:25:21 +0900 Message-Id: <1509078321-7694-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Cc: Tom Rini Subject: [U-Boot] [PATCH] tools: image: fix "algo" property of public key for verified boot X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The "algo_name" points to a property in a blob being edited. The pointer becomes stale when fit_image_write_sig() inserts signatures. Then crypto->add_verify_data() writes wrong data to the public key destination. Signed-off-by: Masahiro Yamada --- tools/image-host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/image-host.c b/tools/image-host.c index c60d4ad..ad9a73a 100644 --- a/tools/image-host.c +++ b/tools/image-host.c @@ -166,7 +166,7 @@ static int fit_image_setup_sig(struct image_sign_info *info, info->keyname = fdt_getprop(fit, noffset, "key-name-hint", NULL); info->fit = fit; info->node_offset = noffset; - info->name = algo_name; + info->name = strdup(algo_name); info->checksum = image_get_checksum_algo(algo_name); info->crypto = image_get_crypto_algo(algo_name); info->require_keys = require_keys;