From patchwork Sat Jun 9 15:45:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Teddy Reed X-Patchwork-Id: 927176 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; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="PgrvSFHm"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 4133Wt577Hz9ry1 for ; Sun, 10 Jun 2018 01:45:30 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 527F2C21DB5; Sat, 9 Jun 2018 15:45:26 +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=FREEMAIL_FROM, 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 C8499C21C27; Sat, 9 Jun 2018 15:45:23 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2E59EC21C27; Sat, 9 Jun 2018 15:45:23 +0000 (UTC) Received: from mail-qk0-f169.google.com (mail-qk0-f169.google.com [209.85.220.169]) by lists.denx.de (Postfix) with ESMTPS id 57C6CC21BE5 for ; Sat, 9 Jun 2018 15:45:22 +0000 (UTC) Received: by mail-qk0-f169.google.com with SMTP id j12-v6so10603137qkk.4 for ; Sat, 09 Jun 2018 08:45:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version :content-transfer-encoding; bh=LphiU4isaNxDB03lru0FD4qYyoYfVA0CPCpagtF0wcg=; b=PgrvSFHmLscb7ksE4Q3tlhHE+Rs1TaXZHdbtn8Pemcx/x4w+bBmIrHLXt/0NvFf++a JQ6fb+HopRTAi7kg9Uqlod8sIOVnAJdvHy3ycJCOaqaurdpU+IBNqikbfg+eBSe6k5P4 pbZQ0Mfs15jdnlIh+QFahtpEHpQ1enAjCtHObP6Zf7ZJcb1R7t/si30mzJid9S89O5YK bu+ypt47xa/LTTyB338MatwMvYEl3GiWcTwOZ9R4swETNbJLiMHXOM38GGMXAjGQU+cd 8rWZCuNS7dFNj1PMAH+5J9Cl9TCQoGOLs0YrxjlKIQTsz3OSB8DkqLSbT3dpbcZcVJuW foeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-transfer-encoding; bh=LphiU4isaNxDB03lru0FD4qYyoYfVA0CPCpagtF0wcg=; b=RMgki3FbjTxWqu2sMfKhHv6nmB3+rf7ToQ2ngaSSqv6O72qjH8HLs338vfjdfY1wka DBKyxYGJJjugftXvV46HKYPcq5rC10AqU9PSlAIXBER8PWscpgX+XiL0H2Nzf8e9SAhZ UsWFnn2wNmsBR9nDkn1T2416lRluc/ikEVxivbkH5bkzcfQ6mUhZARH/gE6VKib0Os+1 Bd3sSZf+0+5xZNjp10NBMyZND7VeGa3Xa3hOZcyiSxuf/gq/w4ntaf/IkoWC5SEZMLfl Cc4nBl3MOgTKKWrUL4Dl9Ct106C1XqGJopQuJp98oD7yGRqrmD0g1e9zmG4mFCzUzjMV SVrA== X-Gm-Message-State: APt69E1vAAEnQQMBzOVBIOFlt1BmO7S6WSRrhZsLSpbOHzL+flH/i21a kd6RvLeAyzSbKm99IGx1GecfNny/ X-Google-Smtp-Source: ADUXVKJL7rkSxE+zZKdLGbniX6HREvYdEUKN328wAB90BnT4OB/q4pA+i5iLRuSs1pk9IKkSMo0+6A== X-Received: by 2002:a37:4142:: with SMTP id o63-v6mr9218666qka.287.1528559121298; Sat, 09 Jun 2018 08:45:21 -0700 (PDT) Received: from maverics (pool-108-35-88-207.nwrknj.fios.verizon.net. [108.35.88.207]) by smtp.gmail.com with ESMTPSA id g18-v6sm13838594qtg.59.2018.06.09.08.45.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Jun 2018 08:45:20 -0700 (PDT) Date: Sat, 9 Jun 2018 11:45:20 -0400 From: Teddy Reed To: u-boot@lists.denx.de Message-Id: <20180609114520.68ab7de771869d9d3ab4a809@gmail.com> X-Mailer: Sylpheed 3.5.0 (GTK+ 2.24.30; x86_64-pc-linux-gnu) Mime-Version: 1.0 Subject: [U-Boot] [PATCH v2] vboot: Do not use hashed-strings offset 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The hashed-strings signature property includes two uint32_t values. The first is unneeded as there should never be a start offset into the strings region. The second, the size, is needed because the added signature node appends to this region. See tools/image-host.c, where a static 0 value is used for the offset. Signed-off-by: Teddy Reed Reviewed-by: Simon Glass --- common/image-sig.c | 7 +++++-- tools/image-host.c | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/image-sig.c b/common/image-sig.c index f65d883..ad571f9 100644 --- a/common/image-sig.c +++ b/common/image-sig.c @@ -372,8 +372,11 @@ int fit_config_check_sig(const void *fit, int noffset, int required_keynode, /* Add the strings */ strings = fdt_getprop(fit, noffset, "hashed-strings", NULL); if (strings) { - fdt_regions[count].offset = fdt_off_dt_strings(fit) + - fdt32_to_cpu(strings[0]); + /* + * The strings region offset must be a static 0x0. + * This is set in tool/image-host.c + */ + fdt_regions[count].offset = fdt_off_dt_strings(fit); fdt_regions[count].size = fdt32_to_cpu(strings[1]); count++; } diff --git a/tools/image-host.c b/tools/image-host.c index 8e43671..be2d59b 100644 --- a/tools/image-host.c +++ b/tools/image-host.c @@ -135,6 +135,7 @@ static int fit_image_write_sig(void *fit, int noffset, uint8_t *value, ret = fdt_setprop(fit, noffset, "hashed-nodes", region_prop, region_proplen); + /* This is a legacy offset, it is unused, and must remain 0. */ strdata[0] = 0; strdata[1] = cpu_to_fdt32(string_size); if (!ret) {