Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ECE87C433F5 for ; Wed, 8 Dec 2021 18:10:29 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EC27282F96; Wed, 8 Dec 2021 19:10:26 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=softathome.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=softathome1.onmicrosoft.com header.i=@softathome1.onmicrosoft.com header.b="RQRf1W67"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3BAE98309E; Wed, 8 Dec 2021 19:10:25 +0100 (CET) Received: from FRA01-MR2-obe.outbound.protection.outlook.com (unknown [IPv6:2a01:111:f400:7e19::626]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CF0F282F91 for ; Wed, 8 Dec 2021 19:10:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=softathome.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=philippe.reynes@softathome.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LXLArETFRgLMQUA8LNgfA7PacQ/ahcPbAw/ck7Y2QwrU0qsH9d3RK99ifbOpJbwYrS2iRMk4XuZrXRM6Exg73k7oy69p6qlmbuBLERwtyCIDdpd4UJX/c3HzHE30G0ocG3aIuN/DORJqex0Jj1pfuO8xnoYTUY17A5GyWa3AFzY8JOFRdMLzq95iwHiTQIo4I2B7V6rL/9DwHfO5D/L11NUJn+WV8JsE5+ggsvYOhCmpyvoD5jds35ocZjerAlbbi9CVpMH8SITMqEnQT9zx88o9qvCsL46RUZdPgRT42e620q4keiAzSUv2L++9xzBKq5beyGZhHSacSfQoKjpAYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4wnu0HvFX3DbD/7O45DppCNPZ5y/Ll6/4s1sETUi6ms=; b=NQCFTI3hzW/8JNMleSL1TFoCVBwS6Y+4NAo0IgP8Tlk5smD4uTG3tgJ5fhCEAmMEqJLcczcV/MFKM59m+hS4bQwmtDrHWdsKeKEmQ/moshRDKu6djA7iTenqZAT81YIESj4l7+9JHCV9i9DYIyKGfREbiKE8hhyCaNeNzDSQjab23uEOJNi4qUOZ3xe9/M66583LCzwpZthjkktEajg3YI3Aw0qeF+H7q9Xwf97W2BHHaas9N0TiZpN1wcVxvytSyCauGayCVoEeGkbsoJbI210ubXo+QwMbFBPWomyw+E5YGtkSoxN40eMSjZTjX5z46hNw7oeJAsRFUNYmaXV+cg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=softathome.com; dmarc=pass action=none header.from=softathome.com; dkim=pass header.d=softathome.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=softathome1.onmicrosoft.com; s=selector1-softathome1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4wnu0HvFX3DbD/7O45DppCNPZ5y/Ll6/4s1sETUi6ms=; b=RQRf1W67AiZC5QlOl0/D+Gy+2a3em23EgFuxCzNEnK8DPzVLIF8dtXGXIG/nZZ7ZIFQA1EuWHeE1k62UnQ5ZyS6XVNhq6NLIELcLKbqjHm3sNUoQGVA4FV3WqRAp7FQB33JLJzxmEF6/SHZZSY1FvbwIe5tl8no9foXR5WFEH0BPf1/cikdRlGaODJk2cWXlGgtsimYrGmxzPNOvZkWSJJy16taNBEAYEoVbWGdthL5wEazVQC8uiyclwL6BlXiag3G0jFYzqsQvB2SPrOls3Hz5ntc0H5uL7PXwgTLIXwa6NtwI1bCdE8+DtInBk5XrYZl77tnD8qPcATOZV9/pCQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=softathome.com; Received: from PR0P264MB2741.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1d0::9) by PR1P264MB2015.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:192::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.20; Wed, 8 Dec 2021 18:10:18 +0000 Received: from PR0P264MB2741.FRAP264.PROD.OUTLOOK.COM ([fe80::7d78:b0f1:3f80:46df]) by PR0P264MB2741.FRAP264.PROD.OUTLOOK.COM ([fe80::7d78:b0f1:3f80:46df%9]) with mapi id 15.20.4755.023; Wed, 8 Dec 2021 18:10:18 +0000 Subject: Re: [RFC PATCH v3 8/8] tools: gen_pre_load_header.sh: initial import To: Rasmus Villemoes , sjg@chromium.org, mr.nuke.me@gmail.com, joel.peshkin@broadcom.com Cc: u-boot@lists.denx.de References: <20211117175215.24262-1-philippe.reynes@softathome.com> <20211117175215.24262-9-philippe.reynes@softathome.com> From: Philippe REYNES Message-ID: <38d15e93-d7bd-aabb-230e-0de702ca996a@softathome.com> Date: Wed, 8 Dec 2021 19:10:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-ClientProxiedBy: PR0P264CA0077.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:18::17) To PR0P264MB2741.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1d0::9) MIME-Version: 1.0 Received: from [192.168.75.141] (149.6.166.170) by PR0P264CA0077.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:18::17) with Microsoft SMTP Server (version=TLS1_2, cipher=) via Frontend Transport; Wed, 8 Dec 2021 18:10:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 898296c3-56eb-457b-0588-08d9ba75fd9a X-MS-TrafficTypeDiagnostic: PR1P264MB2015:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1060; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8vh1TXHsvS2cay5GiFbwCdC/WwU2qMGnt2U5xP2bS0nw+HR7XRvI/OLPJhV5fpPIQe+PlhxTrPu0VL4q2wASpC3t87LYU3uZPYTxfaSPPGaFbLrR+5+EnXi4ax6C6K94XiOAOgIS9bpQvSP3W9OBOnF4yfr8uBPqmi4zDCUJ3fTJSdjAcTao9XSv3++cqq43vxNUYKO7fRAHuUZuofvFEz6lDu4vrRwbHhYCNyIMwELR3MMICEmMefKfRW+Csx2/8OGv0lk4si4JsD88+qL3IqvXW9JA0HbvWIzYwFiZcN6s/jQ7ngD1M7ihLK17JTISRyFAqPvG5K2ktD5IYeQUDyMojGHFO0E9/+XI6ZsWaSSPNO4fVkasnqh7396xmOJ2dyIoR3xMIPc0a2x4LXAfQjs+K6pl+JVES6OQruFGhwYKe6u/OUOF18tHg0NJsaXJrdsn8lm+b9FefCtFWF5JT8IYWCG99XkI+foL/x71HsVO/+JS34V3p96+qRLd7tgda2Bkoc0qywWjxD4HMEBH1Ic6GOxkzdUhNhReIz9NMHOuifkTGoeIQpTjaWHzxqXOM8d5M31TtwgtKkAZgjy1gu+GaZJlVqaJVm2ChbYCA54i1uFUWh9VD/1d4vhD4HiMJ8vZZ7VwUMS+tZMpN2Ss13tgIfZztmqC1x41rNZ3WD8H73s6/uo0hIs4xiD+3ZUQpPoXke28tLoAm7ffC9Mo+cPAjmXTcXyUIJwkJF/owCM= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PR0P264MB2741.FRAP264.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(4636009)(366004)(16576012)(66556008)(66476007)(66946007)(2616005)(83380400001)(66574015)(4326008)(82960400001)(38100700002)(956004)(316002)(36756003)(508600001)(5660300002)(31696002)(2906002)(186003)(86362001)(26005)(8936002)(31686004)(8676002)(6486002)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?Windows-1252?Q?58pU2faYWcoFbSwI63pEK4NisUFk+G8Swn0HO9WzBJzTdWNqgnKNNPNs?= =?Windows-1252?Q?ALz3oGmIlAwVVVCNv8l+RJXT/p92F1nH7sK6MTwoNJseoUb5w18AqKDz?= =?Windows-1252?Q?t8t3Mr0R6cLyM9312lRURTNELi+xQvr7rGQgBJZl+XtvbmzQP3cI3YRf?= =?Windows-1252?Q?WuaFJ0m1LSKYufpeQCOkigVd6xyUoru3NFFih6LVM0HVJ24Qr0MtiO1Q?= =?Windows-1252?Q?M+UJalxdjwfJ/paOnlFHnx04HJsvDaFFBvqM8LUi2SdHosfVF4e9vGbh?= =?Windows-1252?Q?xGbVlyr1DrVnWB/4bky2tPUAmMb/uJ/g58BjsQ6aeS2MsbPeU2wb3hpd?= =?Windows-1252?Q?yJPUkRpbNrVUJdiUuoxz+9RMiWNyMQyNoB4IOz5Ssdbv+ImtURjkBolM?= =?Windows-1252?Q?6JuU84JL6d9cIIoBVVmZdVgwatf5dfZgpXITjWBkyjqRwNM8V5RONZ62?= =?Windows-1252?Q?pm74Ft0muuVeOP1ChD/LUQePSvAvOkDaOnE4tlAfDCoRPDHakatnKTX8?= =?Windows-1252?Q?/w1PfX1PF53jPydicxeq0zYDCUCgj/NXeyfREe81NCs9J9ctlazLutjZ?= =?Windows-1252?Q?Dh/V2xv0K1MjYeQbCC0oDY5svvXZxQGoezm33+DlvS7ocCD0xkdEbhoD?= =?Windows-1252?Q?5aMVJxbXAtLoHBUwsL1FOplme3uA3c9gCx/T85BCh1IFhEb2enXtPdBQ?= =?Windows-1252?Q?7vmdbGNR2NWHwTg/u9byEiTa25lIMdo553cAOu6uz60sFPK9jX2UL8gt?= =?Windows-1252?Q?LkeGQOfl5ALr6ZgNfSZJ5Y6JCEPj36PttqO85qIhe8dztM2vVuJ3OTtd?= =?Windows-1252?Q?1i4eiQkyYXIYbayXNBH9inUGOnmQ6SkjDQleZB9uFCR82Gq4DJ1QJyXS?= =?Windows-1252?Q?D0CoMfzRihxmXA42Gci5M1DPFewp2nzvHpPIIf4HeGgLo0mN26yYRC7T?= =?Windows-1252?Q?XAkvFWnuSf+VZ4xRyO5lIxrWj8pxDlSSOvDx349E/khbFkW1Apww+4WH?= =?Windows-1252?Q?zRGQHXFfVXZGvMHPqRI9mQiThvFdJyES6oF9zbpFz8sUlTDCJh2+rsoB?= =?Windows-1252?Q?RnP0v6sLljTiif/6fWFen5VFDbpcfUWdlD8ko5YTIc+QUop2gEkiOm8G?= =?Windows-1252?Q?dDyb181dD2Qd8wzA4pWOqhb8rXoGczXmv9xmHxocwCvVDs6+guTM9Fk0?= =?Windows-1252?Q?B+4tYGYbBSOHXY3ziYAf2yA+ndBd3iCpxrlCk2nZAU0v+hIvbVAghGUx?= =?Windows-1252?Q?ghe2X84FOfbShiu+R0Npg9EFhO3aBohyUKq/uuvMxUREk+yMvws58xqY?= =?Windows-1252?Q?/rvpI6hwKD+HbqyTh9ozkz32vYgALQU2gijeLCodsi/FJQxL7EwJCIEV?= =?Windows-1252?Q?c38QCzwBzZPEMcUlGz8RgI4SXr3mMmbWWAK3KFYh2Rm7L3ypTt8jFRqN?= =?Windows-1252?Q?COXYgj21cN4qsnlPmnNJcAlhiE6KsxZpGksis5Lq4kmUBGllsGdZyrzv?= =?Windows-1252?Q?CwYtgOkd/mPrqxi0QM1Klo4B5e3sFnEW+XfCGXEBpKtwUBDkwgkKKBcI?= =?Windows-1252?Q?ilhj6+3xggPjNmMJoAOG7orJBfybEN6M0pfFNaM5EbW25+Xly5bPuxbz?= =?Windows-1252?Q?xQfCF2HuR7bNdSlgXHzf2p73mMp+gA3Bl3JCHvDXwCWuF7Sz9fpKmes+?= =?Windows-1252?Q?SwB4bAhYOqPmXIngbMEe9PSNOcNuHj/j3+6flqifeSQG+uDslC3Izxf0?= =?Windows-1252?Q?Z2L8lcbK8PHgpY9ykg3sJcx86dwZBmuW8vvsO0RdIFLFXx4+qM383Fw1?= =?Windows-1252?Q?eTB6QA=3D=3D?= X-OriginatorOrg: softathome.com X-MS-Exchange-CrossTenant-Network-Message-Id: 898296c3-56eb-457b-0588-08d9ba75fd9a X-MS-Exchange-CrossTenant-AuthSource: PR0P264MB2741.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2021 18:10:17.9878 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: aa10e044-e405-4c10-8353-36b4d0cce511 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: g3PmdEeYXhtQGsmHxKkOoME9Vr/7SqusDn4Yzj9LImA5MmgwiBmZh/Wtjg0C9geuYOiImpAQUNTydWNEAu/tBkcJzn+GpeRlC4rMXHXfoHo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR1P264MB2015 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Hi Rasmus, First, thanks for the feedback. Le 06/12/2021 =E0 09:23, Rasmus Villemoes a =E9crit : > On 17/11/2021 18.52, Philippe Reynes wrote: >> This commit adds a script gen_pre_load_header.sh >> that generate the header used by the image pre-load >> stage. >> >> Signed-off-by: Philippe Reynes >> --- >> tools/gen_pre_load_header.sh | 174 +++++++++++++++++++++++++++++++++++ >> 1 file changed, 174 insertions(+) >> create mode 100755 tools/gen_pre_load_header.sh >> >> diff --git a/tools/gen_pre_load_header.sh b/tools/gen_pre_load_header.sh >> new file mode 100755 >> index 0000000000..8256fa80ee >> --- /dev/null >> +++ b/tools/gen_pre_load_header.sh >> @@ -0,0 +1,174 @@ >> +#!/bin/bash >> +# SPDX-License-Identifier: GPL-2.0+ >> + >> +# >> +# default value >> +# >> +size=3D'4096' >> +algo=3D'sha256,rsa2048' >> +padding=3D'pkcs-1.5' >> +key=3D'' >> +verbose=3D'false' >> +input=3D'' >> +output=3D'' >> + >> +usage() { >> + printf "Usage: $0 -a -k [-p ] [-s ] [-v= ] -i -o \n" >> +} >> + >> +# >> +# parse arguments >> +# >> +while getopts 'a:hi:k:o:p:s:v' flag; do >> + case "${flag}" in >> + a) algo=3D"${OPTARG}" ;; >> + h) usage >> + exit 0 ;; >> + i) input=3D"${OPTARG}" ;; >> + k) key=3D"${OPTARG}" ;; >> + o) output=3D"${OPTARG}" ;; >> + p) padding=3D"${OPTARG}" ;; >> + s) size=3D"${OPTARG}" ;; >> + v) verbose=3D'true' ;; >> + *) usage >> + exit 1 ;; >> + esac >> +done >> + >> +# >> +# check that mandatory arguments are provided >> +# >> +if [ -z "$key" -o -z "$input" -o -z "$output" ] >> +then >> + usage >> + exit 0 >> +fi >> + >> +hash=3D$(echo $algo | cut -d',' -f1) >> +sign=3D$(echo $algo | cut -d',' -f2) >> + >> +echo "status:" >> +echo "size =3D $size" >> +echo "algo =3D $algo" >> +echo "hash =3D $hash" >> +echo "sign =3D $sign" >> +echo "padding =3D $padding" >> +echo "key =3D $key" >> +echo "verbose =3D $verbose" >> + >> +# >> +# check if input file exist >> +# >> +if [ ! -f "$input" ] >> +then >> + echo "Error: file '$input' doesn't exist" >> + exit 1 >> +fi >> + >> +# >> +# check if output is not empty >> +# >> +if [ -z "$output" ] >> +then >> + echo "Error: output is empty" >> + exit 1 >> +fi >> + >> +# >> +# check that size is bigger than 0 >> +# >> +if [ $size -le 0 ] >> +then >> + echo "Error: $size lower than 0" >> + exit 1 >> +fi >> + >> +# >> +# check if the key file exist >> +# >> +if [ ! -f "$key" ] >> +then >> + echo "Error: file $key doesn't exist\n" >> + exit 1 >> +fi >> + >> +# >> +# check if the hash is valid and supported >> +# >> +print_supported_hash() { >> + echo "Supported hash:" >> + echo "- sha1" >> + echo "- sha256" >> + echo "- sha384" >> + echo "- sha512" >> +} >> + >> +case "$hash" in >> + "sha1") hashOption=3D"-sha1" ;; >> + "sha256") hashOption=3D"-sha256" ;; >> + "sha384") hashOption=3D"-sha384" ;; >> + "sha512") hashOption=3D"-sha512" ;; >> + *) echo "Error: $hash is an invalid hash" >> + print_supported_hash >> + exit 1;; >> +esac >> + >> +# >> +# check if the sign is valid and supported >> +# >> +print_supported_sign() { >> + echo "Supported sign:" >> + echo "- rsa1024" >> + echo "- rsa2048" >> + echo "- rsa4096" >> +} >> + >> +case "$sign" in >> + "rsa1024") ;; >> + "rsa2048") ;; >> + "rsa4096") ;; >> + *) echo "Error: $sign is an invalid signature type" >> + print_supported_sign >> + exit 1;; >> +esac >> + >> +# >> +# check if the padding is valid and supported >> +# >> +print_supported_padding() { >> + echo "Supported padding:" >> + echo "- pkcs-1.5" >> + echo "- pss" >> +} >> + >> +case "$padding" in >> + "pkcs-1.5") optionPadding=3D'' ;; >> + "pss") optionPadding=3D'-sigopt rsa_padding_mode:pss -sigopt rsa_ps= s_saltlen:-2' ;; >> + *) echo "Error: $padding is an invalid padding" >> + print_supported_padding >> + exit 1;; >> +esac >> + >> + >> +# >> +# generate the sigature >> +# >> +sig=3D$(openssl dgst $optionHash -sign $key $optionPadding $input | xxd= -p) >> + >> +# >> +# generate the header >> +# >> +# 0 =3D magic >> +# 4 =3D image size >> +# 8 =3D signature >> +# >> +h=3D$(printf "%08x" 0x55425348) >> +i=3D$(stat --printf=3D"%s" $input) >> +i=3D$(printf "%08x" $i) >> + >> +echo "$h$i$sig" | xxd -r -p > $output > So this sounds like a completely generic way of prepending a signature > to an arbitrary blob, whether that is a FIT image, a U-Boot script > wrapped in a FIT, some firmware blob or whatnot. So it sounds like it > could be generally useful, and a lot simpler than the complexity > inherent when trying to add signature data within the signed data > structure itself. We plan to use it with FIT, but it is very generic and may be used with any firmware. > So, can we perhaps not tie it to bootm as such? It's not a problem if > bootm learns to recognize 0x55425348 as another image format and then > automatically knows how to locate the "real" image, and/or automatically > verifies it. But I'd really like to be able to > > fatload $loadaddr blabla && \ > verify $loadaddr && \ > source $loadaddr > > where fatload can be any random command that gets a bunch of bytes into > memory at a specific location (tftpboot, mmc read, ubi...). Currently, > we simply don't have any sane way to verify a boot script, or random > blobs, AFAICT. Based on this header, it is quite easy to develop a command verify. It wasn't planned but it is a very good idea. I will add it, in the next version or in another series a bit after. > To that end, it would be nice if the header was a little more > self-describing. Something like > > 0 =3D magic > 4 =3D header size (including padding) > 8 =3D image size > 12 =3D offset to image signature > 16 =3D flags (currently enforced to 0) > 20 =3D reserved (currently enforced to 0) > 24 =3D signature of first 24 bytes > > xx =3D signature of image > > Why do I want the image size signed? Because I'd like to be able to > store the whole thing in a raw partition (or ubi volume, or...), where > there's no concept of "file size" available. So I'd like to be able to > read in some fixed size chunk (24+whatever I expect the signature could > be, so 4096 is certainly enough), and from that compute the whole size I > need to read. But I don't want to blindly trust the "image size" field. > So, for such a case, I'd also like a "verify header $loadaddr" > subcommand (and "verify image $loadaddr", with "verify $loadaddr" being > shorthand for doing both). I understand why you want to add a signature for the header and I agree. But if we add a signature for the header, I think that we should sign everything (even the signature) or include a hash of the image signature in the header. So I would suggest something like: 0 =3D magic 4 =3D header size (including padding) 8 =3D image size 12 =3D offset to image signature 16 =3D version of the header 20 =3D flags (currently enforced to 0) 24 =3D reserved (currently enforced to 0) 28 =3D reserved (currently enforced to 0) 32 =3D sha256 of the signature 64 =3D signature of the first 64 bytes .. xx =3D signature of the image Another solution would be to keep the header size in the u-boot device tree and add the signature of the header at the end of the header. It would become something like: 0 =3D magic 4 =3D image size 8 =3D offset to image signature 12 =3D version of the header 16 =3D flags (currently enforced to 0) 20 =3D reserved (currently enforced to 0) 24 =3D reserved (currently enforced to 0) .. xx =3D signature of the image .. header_size - sig_size =3D signature of the header (without the header signature) As you can see I also propose to add the header version. I prefer the second solution. Everybody agrees with this proposal ? > > And continuing the wishlist, it could be even better if we had > > verify load $loadaddr 'mmc read %l% 0 %s512%' > > i.e. we could pass a "parametrized shell command" to verify for it to > use to read in a bunch of bytes to a given address - with %l% being > substituted by the address and %s% by the size to load, > optionally specified in the given unit. I agree, it would be nice. But I think it could be done in a second step. > > Rasmus Regards, Philippe -- This message and any attachments herein are confidential, intended solel= y for the addressees and are SoftAtHome=92s ownership. Any unauthorized use= or dissemination is prohibited. If you are not the intended addressee of t= his message, please cancel it immediately and inform the sender.