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: 117282 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp320143qgn; Thu, 26 Oct 2017 21:26:26 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Qs+yhhEvLMqo893yMWr4QOa9EbhV/xQFZQur1hPeA1+PiAAMxWGQXtDn3GGklM7FIWCUZM X-Received: by 10.80.136.49 with SMTP id b46mr26467828edb.238.1509078386479; Thu, 26 Oct 2017 21:26:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509078386; cv=none; d=google.com; s=arc-20160816; b=lMNMrnDRTVfWrmgIzxJcXYOR2jP/JL+lyyWtxgXEQkGURTEIXPKUNp4tSXK72OlWGb y2/+BMlsUJxoP9zVtoZDX4i/gnwjt04+s1bn0Ib4nhQ7OFx7Tk9izQLWbY4Y8rMU9HId WW3UoUjLYdDQV4+cz/9abx/JFXxeEFraJ7b+I/CHH6D50xYn0j/1Vo4cGEqUbxbO+KzM A/os8E/+M0Q/4St/Vy08PKHf+yX3i36lwdQxV/pVPra+HqMaqebzSHm8jzRGhivlfivj 3GBDT1bXrtQPWVtJc9W0L6RKLtASM4h9EWIEWgMfMZctFlb92Z4OTVEqwO7OqMAT2n4B V4xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :dkim-signature:dkim-filter:arc-authentication-results; bh=OxdTdSdcD1btjpz0Ofhylel65qDAD3MZzsXBN46urSM=; b=WdGpwzfsmwe+fslRxW7gnXymRznaDvk7IVMsKh1kongVV0/My7nL/rxKk7HYCrhSy5 9/HglbTdTyz8oJb3Ll8px3wyxdb9D0LAl7rsNvaWYpZ3dUUMMjTqeUbmseS9ELlfQw5r wtle3kYPwUfSQ9dbzbF0QgVy4xqgzwSk2LV5cdfy5JLXfPZ3RQciQeBS+QqqFuoEgrAw 6+KaSEn/gBK99+K2MfvqRDQ+klDV0gzcvNaqh43sCIARtyrjx13OLhtGzOOuJVUZ8xF4 nDiY9fqPAgiRJxpF95vRhYyZkoGKmCtV+xHBEeS220v8lMj0Gp/tCuv2P0E6vlsTBJMw 8kHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=NYqk2WtL; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 36si4351027ede.33.2017.10.26.21.26.25; Thu, 26 Oct 2017 21:26:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=NYqk2WtL; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id B8EB1C21DA9; Fri, 27 Oct 2017 04:26:23 +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;