From mboxrd@z Thu Jan 1 00:00:00 1970 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 20870ECAAD8 for ; Fri, 16 Sep 2022 12:23:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AF91184BC3; Fri, 16 Sep 2022 14:22:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="aIFpqvAp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5E90784ACA; Thu, 15 Sep 2022 21:44:58 +0200 (CEST) Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B71E88419E for ; Thu, 15 Sep 2022 21:44:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=fr0st61te@gmail.com Received: by mail-lj1-x22e.google.com with SMTP id s10so22813120ljp.5 for ; Thu, 15 Sep 2022 12:44:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date; bh=LgLdQ5npePXVdYhDliSEYiondLeOg20pDkSn2BJrXGw=; b=aIFpqvAppr/FDXxs83Uvo3k5vU3dNQFIdSJHIcQHID4tsMcLIxDz6hbUjlCCRQ6ujl v+dpKPksIgiCPIu85zBDtcfi5MqCtmzxzBjKhbEE/6rpydB9OAvEnIs0suBEjrUapq1v 1S3CDbh7JAao7oeQyLD5NXAsEYQPNApkLF/8+1woBBBPX8NXT7ed1N6nx4wFu8f+0RJp agDPtFMlsofjfixqpg6z/ocfvLuPln5nMZnvKEkw4af18bSjpNLyZtKx2K/aNo8gwW3k XSvyBbUZCfnKYngAz1vCGSXZErjuT9g2yNsMpb2bJp8Vt2AJGv9I9gHZFDq5qUe8anBi UUhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date; bh=LgLdQ5npePXVdYhDliSEYiondLeOg20pDkSn2BJrXGw=; b=EAdWB1irm3nqn47p1ypSzOcwBVoknEI/HBVVQt138jSHlBG1CJCysH9ZEVvOqAqbUU utyQcNs+YYSsyZ29+QslRggfIB3FQaVKil6iWaHuNJdoobK4ddZf4f35boR+/eDe1sMn ReRMLXMJ0fBe/10tIjIiqiqY4daBC3z4GqXnZRimMB3qUmIaO97oP/flI3BHrBn3UOTb axVO5v23HmbXNMrnvj2GJXkd73BWx858ZocvDgSwtPXB/5vTgF02H+cYjf3FRFuuFYya tsdQl4X1Yw+ONESUstN262/LNkaZyAiWz+xqaOFgvb/H+bEGSwOLWUYwDWsUwHmQ8ZqK 2+zA== X-Gm-Message-State: ACrzQf0kLscYRAmDrwUbfmjwMEVPJd4iBP6gTvHSe4wCV2QjJWY20/yT P6Z9xJPnnoHTKdMAjusq400= X-Google-Smtp-Source: AMsMyM6b9rmOZqTVLF6jqWncoxzuhXP3QFO33uU+b1/d4VHf2wc86AFkVMcWqvN6UgihyOgsVJXlXQ== X-Received: by 2002:a2e:960e:0:b0:26b:e5ae:cd78 with SMTP id v14-20020a2e960e000000b0026be5aecd78mr402321ljh.129.1663271094886; Thu, 15 Sep 2022 12:44:54 -0700 (PDT) Received: from [100.119.237.241] (93-80-67-239.broadband.corbina.ru. [93.80.67.239]) by smtp.gmail.com with ESMTPSA id w9-20020ac254a9000000b00497b198987bsm3104841lfk.26.2022.09.15.12.44.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 12:44:54 -0700 (PDT) Message-ID: <8bf99a710da222864dd608f9cd05dc0f1c5dbda1.camel@gmail.com> Subject: Re: [PATCH 1/3] binman: add sign option for binman From: Ivan Mikhaylov To: Simon Glass Cc: Alper Nebi Yasak , U-Boot Mailing List , Ivan Mikhaylov , Jan Kiszka Date: Thu, 15 Sep 2022 22:44:53 +0000 In-Reply-To: References: <20220321214319.33254-1-fr0st61te@gmail.com> <20220321214319.33254-2-fr0st61te@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 16 Sep 2022 14:22:08 +0200 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 Wed, 2022-09-07 at 15:10 -0600, Simon Glass wrote: > Hi Ivan, >=20 > Section data comes from the BuildSectionData() method, so you could > try calling that. >=20 > See also collect_contents_to_file() >=20 > Regards, > Simon Simon, I've tried both these ways and they both don't work to me. What I've got: def SignEntries(image_fname, input_fname, privatekey_fname, algo, entry_paths): image_fname =3D os.path.abspath(image_fname) image =3D Image.FromFile(image_fname) state.PrepareFromLoadedData(image) image.LoadData() 1. BuildSectionData =20 for entry_path in entry_paths: entry =3D image.FindEntryPath(entry_path) try: entry.BuildSectionData(True) except Exception as e: logging.error(traceback.format_exc()) ERROR:root:AttributeError: 'NoneType' object has no attribute 'run' 2. collect_contents_to_file for entry_path in entry_paths: entry =3D image.FindEntryPath(entry_path) try: entry.collect_contents_to_file([entry.name], "prefix", 1024) except Exception as e: logging.error(traceback.format_exc()) ERROR:root:AttributeError: 'str' object has no attribute 'ObtainContents' 3. GetData for entry_path in entry_paths: entry =3D image.FindEntryPath(entry_path) print("--- DATA ---") data =3D entry.GetData(True) print(data) print("~~~ DATA ~~~") --- DATA --- Node '/fit/images/u-boot-1/u-boot': GetData: size 0x4 Node '/fit/images/u-boot-1': GetPaddedDataForEntry: size None Node '/fit/images/u-boot-1': GetData: 1 entries, total size 0x4 Node '/fit/images/fdt-1/u-boot-spl-dtb': GetData: size 0x4f7 Node '/fit/images/fdt-1': GetPaddedDataForEntry: size None Node '/fit/images/fdt-1': GetData: 1 entries, total size 0x4f7 Deleted temporary directory '/tmp/binman.z81eqcfz' binman: 'NoneType' object has no attribute 'run' There is no problem with getting data from GetData around start of the year. Maybe some regression? All this ran with this: binman -v5 sign -i image.bin -k test_key.key -a sha256,rsa4096 fit `fit` in entry_paths and image contains FIT section with name `fit`. binman ls -i image.bin Name Image-pos Size Entry-type Offset=20 Uncomp-size ----------------------------------------------------------------------- -------- main-section 0 100000 section 0 fit 10000 c0a fit 10000 u-boot-1 10104 4 section 104 u-boot 10104 4 u-boot 0 fdt-1 101c8 4f7 section 1c8 u-boot-spl-dtb 101c8 4f7 u-boot-spl-dtb 0 fdtmap 10c0a 4f5 fdtmap 10c0a Seems something went wrong, any ideas? Or did I misuse? Thanks.