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 6F5B8C46467 for ; Tue, 10 Jan 2023 16:28:10 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 06B5D85600; Tue, 10 Jan 2023 17:28:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=seco.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=seco.com header.i=@seco.com header.b="I0U2vmTs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BBCB685568; Tue, 10 Jan 2023 17:28:06 +0100 (CET) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2058.outbound.protection.outlook.com [40.107.15.58]) (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 C29FA85600 for ; Tue, 10 Jan 2023 17:28:02 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=seco.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sean.anderson@seco.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PWA84SxUjRdjb2PUx1uZ1fVMsQgmc0ntWkqwUm8Nuf26IkDfjVl9xbq58p1WF2Zoa6ihAi6ehgvHhTbTiFl2LlA4l25xRPqAtvwjsZ1N/ghUYPXJiMcXz1HbH+dX5uuhweaWNwnqhpKDWdU/4q6bZay6Y1Z2EGhxvtz1722b8I2gxsMPxPA6q8WteCMxwqHuudQjO2TwgIw/bemeIFhfG4Ib0HKCtMQqAKM96v0E456+unBpdbgtUU//gw3ibhTy9bqUL2Jxlj5kWTyv0viNWfL2lzHZgVVIi4q7orcMVTM12R9n+FaBBKYbjm5jK9TAww37Yq/7wUyxjGQIkePURg== 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=sC2af6BfKtrV5zbikSUwfXZTHCVdV8M/AR5bkQrgnPo=; b=k4BTbkxolyiey2FnMDvlKO9CHKj0ewq1NVsZMaXetkyNXnMTc+4aZ3/5KeTLRTynnUBRVo7TGRRRsV4spdr93ic3+HXe9octLQiv3f7XwzlmKD6kILRRN7ga8cQrHY5I2xcfOfDatJrrp82H+VjBTCbNlI6Xx8+FNjszrddK1mwp+6cGFZpLFy8xuQt/67lbYso/M9MgszA6Jy7d+iBOLEM4hpEKTe3/7UBe3tfbsjXpGRYFS50Gq/5CAkyAG9bSU8fVHEsY9JeFMqwWCcVyjSQwuWaEJSCoDqPJgkWBCHX6oEtvcmGXRmZA7keaJh0QSP0o9FUGFNuAdvpMaLjTxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sC2af6BfKtrV5zbikSUwfXZTHCVdV8M/AR5bkQrgnPo=; b=I0U2vmTscHsyYIZRuh/WkVA1lo1MwAWHMDr9Olfx4nEUCYxj1SRY/TYcyKQthOknrbTUMLeBBhnE6I1Wz3XJD2ISg9KT5UzoZQRwy0m2F9gpD2jwMKnTvpl+cM14tadukKBTSPZPSLOjYbaIen1Yxp61eyg0m2uFE8DJ2IbeQXHPAG8TJVFmhnpCgtPQWGWXNz+Bu5tlpIe6IdVSIqbouCFYgjEq62nVpj3Wx4L2/1d7ebq5jcGzyVmVXsCEkDe8Jd3/L78tdW3aDQ9qjIg+IR0bgQ4aZ5DktHUiWJyFNf/Iunw6BSAeWUIwIZKE11+15ateztGmFC2naYoQM2k5PA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) by AM9PR03MB7169.eurprd03.prod.outlook.com (2603:10a6:20b:266::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Tue, 10 Jan 2023 16:28:01 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::6b03:ac16:24b5:9166]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::6b03:ac16:24b5:9166%2]) with mapi id 15.20.5986.018; Tue, 10 Jan 2023 16:28:00 +0000 Message-ID: <165ab739-bec5-37bc-232e-dfd562c31e6b@seco.com> Date: Tue, 10 Jan 2023 11:27:57 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: u-boot: signature check for u-boot scripts Content-Language: en-US To: hs@denx.de, Simon Glass Cc: "u-boot@lists.denx.de" References: From: Sean Anderson In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BL1PR13CA0100.namprd13.prod.outlook.com (2603:10b6:208:2b9::15) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|AM9PR03MB7169:EE_ X-MS-Office365-Filtering-Correlation-Id: 3b4dd304-5de4-47ba-6941-08daf327a408 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DIwGZwpSmiWnrrVK+mgupNnNwsMoeRK/aNScGmLf2u8PtTx4wgcDxDr11j+YAoduew8fd0Zd2fDn3d3sEgoy5QIldHR8sG7aqh7zJuBfplOGaCzGcpGeP7BIuuS0OmM9N9R6Fkqdp1GlBnNve1xoRj6J1ZHL1zabrk4Q3U7UrB9tu03JZpq6xPiYuB/o4J9S+UVChCJUPwzyjdcniXTbVLcM3+tPO+x69WoRcPX+BWovqvqBCu/TzUDQjUsH4WiKVBodZUox8TEahqKkGjkb0xpLdMdet7aJ6ZKUIsOmotYMSToBZdkXRjt7WYacEZ5o006UgYVKOXbjIseB1w8ZHxbv9pu641qBpnfcPPWAaYeBvbYoFxVFqvYKvtmf1RApIWC4kmWxMyDvkxsqJBlQoeZyMmyy71pmeSZcOyXdpWmwk89VUJWcDQgNNWnZD2/ptd7SfoXwhL9O8k+T+GRZZTmNlguRUVMYMBlog5oNYO4TeSRsmuclzYnEneyOJCzkKI2IWo6keIky67EXzMq7WYOZdpd79dnFG2WDvw335nVOYnUS0S7REgk67aSrhgf3Te8UE0YDFH854NrEtrlCEDQA9/1NxwOxJ8OY55ycJtKzGq0298IyI35tcnDMldEXMhtvbS4LyGsZTx9coRHtTXCjrrxMXY/Ns7Ztivmw+yHcRiAd9zn8lWBCSL8dmB5ZoxaAdIVSgDgu9v8PEEVDyOGsgEKiBqD+26LHbmerIWix0CF0H0WQw1kdeC1HgC5r8/8IvNlzTcr8V2Fi8aExsLf+mPdreD9e6PiPO6SVA4I= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR03MB8847.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(346002)(39850400004)(366004)(396003)(376002)(136003)(451199015)(31686004)(6666004)(186003)(31696002)(38100700002)(36756003)(38350700002)(26005)(86362001)(6512007)(53546011)(6506007)(8936002)(2906002)(52116002)(2616005)(316002)(5660300002)(66556008)(83380400001)(4326008)(66476007)(41300700001)(8676002)(66946007)(478600001)(6486002)(6916009)(44832011)(43740500002)(45980500001)(139555002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ekRnT0tHT3BuUXBuMW1EbHZEd3Zha1JGVzZ5WGJjbWZNWDdQSGFtT0s1QndC?= =?utf-8?B?Y1NwaEdsNDRoa1Ywc014Mnd4WjFaQStEaE4zemxqUFFwVFFwWjRyYUNLTEJr?= =?utf-8?B?bkZkZVp2eThQdFk0eHpRMUVCWitJZ2EwYUlMOFYyTlZWbDh2alZBRUNvTzhl?= =?utf-8?B?cjUwaFIwS3VLcVIzRHFiU20vU0F3TGQ4VWVCZTF6UVlBZnovS0Yrazg3K0NB?= =?utf-8?B?b3Q5OEg2cDg3SXo0ampzTkwvUzdKRFFJQ25WUnlkbjd2THA5QW5hVVJKaDZv?= =?utf-8?B?MHg5U0JiZ3Z3TmViekcrYnh5QVZpVWVscWo0RUN2Smw1Sm1KU29NUXNJZlJz?= =?utf-8?B?RkUzUFhaeGNNWlBCNm5rV2lnblZVM0k5YkRHTnEvTEl1UFFneWVEOUVMTjFY?= =?utf-8?B?SGdoWFpnblgrK0RTQndzclVyRUZLSnVhaEJicndZRHNjV0E4NXF2ZXh1TlRp?= =?utf-8?B?c0VXNW5LbWhOT25aREVGc3M2K1hDQThzcHJLUUVBZEUzOEV3UWs0b2R5Rk0w?= =?utf-8?B?YzB3Y3pTMEdINGw1UUhYaWYzY1FTT0F3YmEyUGl3VjIvTzZGMk14R0lpeDRU?= =?utf-8?B?aElwZlM4WFBSaFgzZjBJOXVUVEM4UVdnVTkzUzFRYlV3UmZhbm9KR2IyQjBY?= =?utf-8?B?OU9OTHlTaGZTQTQ0NDhiRVhueTRuYjVoOXVwNGZCTTgvNzBTeVl4WUtwRm01?= =?utf-8?B?akhtOVFEQ0l0elB0bjVaa0J2SEl1RjJJVjhwZlBqWXh3R2EwMnFJSFdCMktQ?= =?utf-8?B?aUhhZHRRNGR5UCtYTHZXOWh3aWY3dDh5aVdBVWNWcklFM1Fnd25QbTlpR29D?= =?utf-8?B?QWg0WHlKQlR0UEsvYXErZ2RPbHNkRnc2d2FTa0V6M2RqaklCTjFZUXkwelRK?= =?utf-8?B?dndtSU45b1FGL1ZkbGVHVmU0b1ZqYW5KcnJ0SlFIakl0KzBUOFcrZHhQeDFm?= =?utf-8?B?VUsyVmdoR2lIakl3VjR6eDhWWENQaDNxSE9TMytOWG9IT29GUVRWUGtxOTBP?= =?utf-8?B?Wm5yQ2FJYS9QV0htMW1IQ05TNjl3OWxyQnA1TVBmOG44YlBiL1dCTy9ydmNp?= =?utf-8?B?ajNIZytpRXhUbXhvN21SbENmaFJKVENGMnlEN2Z3YnJaMVFsMWY4RVhYRkVs?= =?utf-8?B?N1RBeHBQZTNSQUthb2hQeW1RdHJtUnIzZzN4V2RndmR6SWI2WUYxSXl1cThR?= =?utf-8?B?bVc0L2p2SVd5VVpkUkZnTkQ2bEtrNlVwK0FLeVYybWRNNXZWUXVpcU9ORWVa?= =?utf-8?B?TVFtSEdJRG05OWIxQVJ4YXhvOXBVRm0zYmVYNmI4UUNLMjdsQ2pSVCtBN1FV?= =?utf-8?B?c25BZUVlMnd4VTB2RStGM2prQUM5LzFSZlpKOUh1WmU5RmlVWDRyOUY1NS80?= =?utf-8?B?d1F6UUhBTUxoR0hXUzlCWkw1MW05bng5L3NkcXE1Vy9vUVJEd0M4WWxxNUVv?= =?utf-8?B?MXdGWWt5dXRFUktTY2dJKzN3UWx4MHhyVHlRcFFPZ2pYd1c3YUJpalZlYWZi?= =?utf-8?B?UVRUVURPanNJQWoxSTdFd1l5LzNZS3BaMmphS09SVVZieTRvWmZNdDA3MUFa?= =?utf-8?B?U3dQVEcrTzV1dnM5VmdtRkdqb0FRR2lwd3BLK09LUXI5d0dIRnNXVE1STkZK?= =?utf-8?B?eGIwSkdPbVhMdXBRbVFYS2Q2TGFkSEYwSFZXMnlPdWtVeDd5eWpoSTFzOUpr?= =?utf-8?B?NVVOTlRYY3hDVnhkWWRYaUZMQVV6ZXhmY1BCT3paTWhzNWdHQTZEQmVKRUxn?= =?utf-8?B?VGppSWUwMVRqYnZRb1NNMm1KZFgxRi9VOTcreStNcUNla0FHOUQ4Z1NQUjBG?= =?utf-8?B?d2d1U3pBangxbFlldDJqWGk2U3BwM29sczB3VTFrWWlWc0o2bVpTT3duYVNY?= =?utf-8?B?MVZUK05JTERpcEF4TU9vTlB4R2hBbFkza1pGU3FJYm4zNE5LZ1k3RFJ3Sjky?= =?utf-8?B?N1kzSUtpdWI2RmVlRTRFSDkzZTVPNHNsaUNqcHpQSEw2ZVQzWFpINDgyVmtL?= =?utf-8?B?dkV2UHczbHlRdk02WTZ0eHNQRFNlc3AxbGdDV3E2WWZld2k3bm5OZ01kVHhG?= =?utf-8?B?b3JXNXVHR1VIMGVMbldQb0Z2RXdhd2xCQmpTalhpTjJwc2dRcmpuNTRDNnRL?= =?utf-8?B?M0hiV1JsTnpoUzFzOEExcWNLRVhJaU1WOXR2Z3ZRUktpZGNmR0JDanNXOTh0?= =?utf-8?B?S3c9PQ==?= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3b4dd304-5de4-47ba-6941-08daf327a408 X-MS-Exchange-CrossTenant-AuthSource: DB9PR03MB8847.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2023 16:28:00.9354 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SRhiqK8BDqEy8FS/ouHJ0jGrPx5ypxf2psxx2K8+wHuFeMb8So2ewMJBwlmysKClv15s3+5KFaP6f+RPOWEXmQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7169 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean On 1/10/23 08:18, Heiko Schocher wrote: > Hello Simon, > > I just digging into the topic "check a signed U-Boot script > before sourcing it" ... > > Therefore I have packed the U-Boot script into a FIT image > and enabled FIT_SIGNATURE. In cmd/source.c > > 136 /* verify integrity */ > 137 if (verify) { > 138 if (!fit_image_verify(fit_hdr, noffset)) { > 139 puts ("Bad Data Hash\n"); > 140 return 1; > 141 } > 142 } > > fit_image_verify() gets called which seems fine .. but > fit_image_verify() always returns 0 ... and so, script gets always executed, > also if I source a fitimage containing a script without *any* signature > nodes, see [1]! > > When I source a signed script and changing the hash before calling it, > there is output [2] ... at least it shows "sha256,rsa2048:dev-" ... so > correct detected, that hash is wrong ... but script gets executed... > > comment in boot/image-fit.c fit_image_verify_with_data() > """ > 1388 /* > 1389 * Show an indication on failure, but do not return > 1390 * an error. Only keys marked 'required' can cause > 1391 * an image validation failure. See the call to > 1392 * fit_image_verify_required_sigs() above. > 1393 */ > """ > > Hmm... see dump of signature node from u-boot-dtb [3] > > Hmm... It seems I miss something obvious? > > BTW: checking signature of an fitimage (used for booting kernel/dts/ramdisk) > works fine ... > > May you have an its file as an example for creating a signed script? > (But at least, it should not execute a script, without any signature info!) > > Am I correct? > > While writting this email ... in [3] the line > > require = "conf" > > poped into my eyes .... and in fit_image_verify_required_sigs() there is check: > > if (!required || strcmp(required, "image")) > continue; > > and yes! changing in [3] > > -required = "conf"; > +required = "image"; > > makes sourcing the signed script working (error in case of no > signature or wrong signature)! ... but booting the signed fitimage > now breaks ... so it seems, I cannot use configuration signing with > images signing ? > > I tried to add two key nodes in signature node of u-boot dtb ... one with > require = "conf" and one with require = "image" ... but no luck... > > Also adding a configurations section to scripts its file did not helped > (which will not prevent the problem sourcing a not signed script) As you discovered, you must either have required = "image", in which case source : will be secure. Otherwise, you must use source \# Any other way is not secure. --Sean > Any ideas? > > (In the meantime I mamanged to get it working, by adding also a configuration > node to my its file, and adding configuration parsing in cmd/source.c, see [4], > which solves all above problems ... but no idea if there is an eleganter > solution?) > > Thanks! > > bye, > Heiko > > [1] log (with some printfs in code) > > => tftp 100000 script.bin;setenv verify 1;source 100000 > Speed: 1000, full duplex > Using ethernet@24000 device > TFTP from server 192.168.3.1; our IP address is 192.168.3.40 > Filename 'script.bin'. > Load address: 0x100000 > Loading: # > 150.4 KiB/s > done > Bytes transferred = 464 (1d0 hex) > ## Executing script at 00100000 > image_source_script: fit_uname: script-1 > fit_image_verify_with_data: ------------ > fit_image_verify_required_sigs: ------------ key_node: 96 > fit_image_verify_with_data: ------------ after fit_image_verify_required_sigs verify_all: 1 > fit_image_verify_with_data: ------------ name: hash-1 FIT_SIG_NODENAME: signature > sha256+ Hallo from script > => fdt addr 100000 > Working FDT set to 100000 > => fdt print > / { > timestamp = <0x63bd2ea4>; > description = "Bootscript"; > #address-cells = <0x00000001>; > images { > default = "script-1"; > script-1 { > data = "echo Hallo from script > "; > type = "script"; > compression = "none"; > hash-1 { > value = <0x4f9ef4c9 0x64b6027a 0xc0bf7019 0x2f21411f 0x3a03bb96 > 0x526e6cc0 0x172a6203 0x07ebd90e>; > algo = "sha256"; > }; > }; > }; > }; > => > > [2] executing signed script but with changing hash > > => tftp 100000 script.bin.signed;setenv verify 1;mw 001001c0 0 1;source 100000 > Speed: 1000, full duplex > Using ethernet@24000 device > TFTP from server 192.168.3.1; our IP address is 192.168.3.40 > Filename 'script.bin.signed'. > Load address: 0x100000 > Loading: # > 230.5 KiB/s > done > Bytes transferred = 947 (3b3 hex) > ## Executing script at 00100000 > image_source_script: fit_uname: script-1 > fit_image_verify_with_data: ------------ > fit_image_verify_required_sigs: ------------ key_node: 96 > fit_image_verify_with_data: ------------ after fit_image_verify_required_sigs verify_all: 1 > fit_image_verify_with_data: ------------ name: hash-1 FIT_SIG_NODENAME: signature > sha256+ fit_image_verify_with_data: ------------ name: signature FIT_SIG_NODENAME: signature > sha256,rsa2048:dev- Hallo from script > => > => fdt addr 100000 > Working FDT set to 100000 > => fdt print > / { > timestamp = <0x63bd4956>; > description = "Bootscript"; > #address-cells = <0x00000001>; > images { > default = "script-1"; > script-1 { > data = "echo Hallo from script > "; > type = "script"; > compression = "none"; > hash-1 { > value = <0x4f9ef4c9 0x64b6027a 0xc0bf7019 0x2f21411f 0x3a03bb96 > 0x526e6cc0 0x172a6203 0x07ebd90e>; > algo = "sha256"; > }; > signature { > timestamp = <0x63bd4956>; > signer-version = "2023.01"; > signer-name = "mkimage"; > value = <0x2e93fd56 0xe68c3438 0x29440a3d 0x96a84453 0xfbf74c67 > 0x1ca47d4c 0xe712e5b0 0xa02a20ee 0xeda24836 0xab68efda 0xdae0e1a6 0x40b084e8 0x3adf3f72 0x977167dc > 0x222b8897 0xb04323da 0x48b00d5a 0x00000000 0x23589310 0x8e5c84d1 0xf1b90ae0 0x37a96c48 0x1de295ed > 0xdd02fbc4 0x7d97da60 0x2bfb9254 0xafff2fe9 0xb49034b5 0xc709f2aa 0xb7035c1c 0xc4219f9c 0x68f68b7d > 0x8be03f02 0x83dc2a25 0x7b9056c0 0x1f6dbb5d 0xdc409948 0x9265fd61 0x10e78ef6 0xd7d6ba6a 0x0f45f622 > 0xaee09fee 0x65347dcd 0xbf1e640a 0x91f2aa7d 0x6a1aad9e 0x40edda89 0x7b4e1074 0xf0bda924 0xff8f95bf > 0x6a743aa6 0x739cf6cc 0x77455534 0x958a79b0 0xf58a0f77 0x546d55ae 0xb4332204 0x2b69d4bf 0xcf2277b3 > 0xe6a5b9fa 0xbe0c2984 0x2a9b3a06 0xb1bfee79 0x1719227f>; > algo = "sha256,rsa2048"; > key-name-hint = "dev"; > sign-images = "script"; > }; > }; > }; > }; > => > > [3] u-boot.dtb > signature { > > key-dev { > required = "conf"; > algo = "sha256,rsa2048"; > rsa,r-squared = < 0x4d76ec8 0x32c73f36 0x1885a88a 0x38c5f9da 0x76058623 > 0x144a9f4e 0x3b68693 0x12a3a7c3 0x63fe3d39 0x64050d31 0x3b4d47ec 0x43c0d6c0 0x5b473005 0x6ba07db0 > 0x834b69cf 0xc77d3d18 0x90a16449 0xca7ea292 0xbd5c7e8d 0xb12873b2 0xbd9854e6 0xa12bd2ca 0x49524aca > 0x666fa5ad 0x60b46068 0xf8beb7 0x4f035cac 0x3d7f0d00 0x307cb78a 0xf7d69d41 0x4458b11e 0x796593b4 > 0x70f5d606 0x730a7eea 0xfacdf9c 0x944a88a0 0x91485179 0x86f28224 0xc753ad58 0xa108107c 0x7211253d > 0x48c11ce4 0xaabdd41f 0x867090c 0x908feb8b 0x2eb6c136 0x723d4628 0xfa398444 0x5ce50ddc 0xf213d06e > 0x5109ec8d 0xa7aa27ec 0x31877d93 0x140a82b8 0x5637d12e 0x1df9457d 0xfa461126 0x284b3222 0x40251e90 > 0x921ed1cb 0xeb1d610a 0xa4350b0a 0x35c82d04 0x6d1de495 >; > rsa,modulus = < 0xb389fbdd 0xeac4c5c2 0xd5cdc76d 0x6bc8baef 0xcb1ccbb8 > 0xb045b4bc 0x61050af2 0x6fb72ee2 0x2cd1ebda 0x1935151a 0x1737507b 0xd99d7fcc 0xf7260741 0xcf27e93c > 0x20e10005 0xa50b6358 0x6d5425d0 0x46668c49 0xa0e6d424 0x58be4ea2 0xd150aad9 0x15e48d65 0x96015d2e > 0xf51eff2b 0x60490625 0xfa3e9e42 0x7c73be97 0x45e478be 0x52f57239 0x1682038d 0xd967dabc 0xafda9fd7 > 0xfe33a251 0xa5dc776c 0x966b36ab 0xeff0e172 0xdd3ab637 0xd061cbbd 0x5f498c4b 0xfdbb51df 0xb2dd74c4 > 0x98211ba0 0x3f711d0a 0xdf10c112 0x482ad0b2 0x7e48cea4 0x98ad8437 0x3aa3da75 0x3054d5fd 0x23c77cc5 > 0x3bc2ba2e 0x303d7d57 0x2a2d54e0 0xf740c870 0x1df2aca7 0x456dd158 0xe41796a 0xec9a7d09 0xad858e31 > 0xc95e53f9 0x5384346f 0x31f05039 0xe1121bd4 0x6c039a05 >; > rsa,exponent = < 0x00 0x10001 >; > rsa,n0-inverse = < 0x38aadd33 >; > rsa,num-bits = < 0x800 >; > key-name-hint = "dev"; > }; > }; > > [4] hack to get signed scripts working > diff --git a/cmd/source.c b/cmd/source.c > index 698d9f86d9..c658a77ea3 100644 > --- a/cmd/source.c > +++ b/cmd/source.c > @@ -134,10 +134,23 @@ int image_source_script(ulong addr, const char *fit_uname) > > /* verify integrity */ > if (verify) { > + int cfg_noffset; > + > if (!fit_image_verify(fit_hdr, noffset)) { > puts ("Bad Data Hash\n"); > return 1; > } > + > + cfg_noffset = fdt_path_offset(fit_hdr, "/configurations/conf-1"); > + if (cfg_noffset < 0) { > + puts("no config node\n"); > + return 1; > + } > + > + if (fit_config_verify(fit_hdr, cfg_noffset)) { > + puts("Bad Data Hash\n"); > + return 1; > + } > } > > /* get script subimage data address and length */ > > [5] its file to get [4] working > $ cat temp/script.its > /dts-v1/; > > / { > > description = "Bootscript"; > #address-cells = <1>; > images { > default = "script-1"; > script-1 { > data = /incbin/("/work/big2/hs/temp/script.scr"); > type = "script"; > compression = "none"; > hash-1 { > algo = "sha256"; > }; > }; > }; > > configurations { > default = "conf-1"; > conf-1 { > description = "First signed script"; > script = "script-1"; > signature { > algo = "sha256,rsa2048"; > key-name-hint = "dev"; > sign-images = "script"; > }; > }; > }; > };