From patchwork Fri Jul 19 12:43:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 813380 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp731770wro; Fri, 19 Jul 2024 05:44:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXA+spvAuPFmBLw3JiHEfc9ycYE6k2bxUQ7+iNQTFkHJwJXo62Gfv8sQzb9uZzmfPupuk3m3SlgHqcTAXzAyvR9 X-Google-Smtp-Source: AGHT+IH7eulUzZH4pKCrAThSORmiJhYpGH3t0W6s31uBcWoPvUe45J/XlVdOcvJFN8dpZiR8vkxA X-Received: by 2002:a05:651c:2213:b0:2ee:d5c3:3109 with SMTP id 38308e7fff4ca-2ef05d4405amr38725211fa.45.1721393044199; Fri, 19 Jul 2024 05:44:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721393044; cv=none; d=google.com; s=arc-20160816; b=alUMP67rOMmMlkTJCQibvYffAZUnjIDZsaOQFrRHQuNdGsj4EDIlGDRJIDwa21Ztqc Z/tfi36UuewnUx2il01sjQ38AbtsR2cKZsk8dn+xBXl82iuD90DvE1Wtr5Lkh+g/BVw3 D6GWo7qpNvo+hZ9lK+205LfQZsE4idgFJS36+j1fqI1iHQHzSplSBisf0kmN9XYI2TId v0vrM2CeirVNf3azSojmmx3y7q0v88BjonulH0NcDGcysCdEKB2j8ZAK48G4SvAwWmoN 1foVjEwPka7e2yk31oQS5Z4vr7GDTsyNUWrAKJezDXE7lOrgOefKfHQkIN3m7x6pNpo4 QLBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=nScEoNskmv45Lt2tjO7j1jnaqGA5YnHfESShhKL5dEw=; fh=SFj0aT9cyReSRKWe5Pb5kBmqOB49tOYOp4n78bWqlI8=; b=NQyEGF4HxYPkpT6JgoxJyT91hdIs3ZFdk6iAc/tP+Br72ufbw8zheTz8fk8ORXZGkL 8cWNxQUgG1soEfbMJQB8qbPkMc0ar/hKUP2XynuSAtELNr19YuZwRkGz+70IiSLrNPZJ uT6gPyZPnPqtCQmQKbQPEGHhhJTFLOEwvRDJ1urat2nk6bk1VX2cDFmMeKJsfb1TZb6t TOQkvzbHCZbjHkXuy+Ec2CFbfRQWDtHRc1dq8tsvtSx9VoRzEqCyUaA5YXG3eTgHXbJ/ VIak/ywH1JUR7CmEQLoMV0nFj+IW8v3LkV76PwfHEU10IEUbNJr+bn+UOJ3XDB3KLdmV dpUw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IoBhqVKq; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 38308e7fff4ca-2ef0fd0d55bsi3324951fa.436.2024.07.19.05.44.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:44:04 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IoBhqVKq; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3266E88BB3; Fri, 19 Jul 2024 14:43:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="IoBhqVKq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 998EF887CE; Fri, 19 Jul 2024 14:43:50 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) (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 A717388B94 for ; Fri, 19 Jul 2024 14:43:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-52e9a920e73so1817885e87.2 for ; Fri, 19 Jul 2024 05:43:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721393028; x=1721997828; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=nScEoNskmv45Lt2tjO7j1jnaqGA5YnHfESShhKL5dEw=; b=IoBhqVKq6Lav8jILfWG1UuAxsDJI7Tapf5G0vIbjkNeLroaFN6r04I7eOiJLRQGSng xNzR6JZzGXJ17novaORAvAbr+KoIRPMmCq+owoNhJtip8aQ7FmpEUgllTyM6YBwkbVAA 2X7wI/z8nhpw92hFWSOye2KZIsVc+QjV7R46Lg1G0X5YG3Nrb8g70Ikxmi8VVtAQ8cto jQa1yhM96cVikLo8wlpaQcxFduYIGIfaYmyn8gmFw49XLzS30PMK1pxDt1o+IXnnW7LT TmvWQH10d2tFr1TOBbh1PdtH+uYHerBq7BskjaFp2vFZRIWJFD84mvW/0t8vnge26g0h oAKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721393028; x=1721997828; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nScEoNskmv45Lt2tjO7j1jnaqGA5YnHfESShhKL5dEw=; b=jLC6h21YJMw898rLYP2Y2lRZEtNs031sAjjABxDN8IocQaKhURDoBen6+dfQwCugF5 HQTSWpqy5HPkg9dSdDeXFJp/DyzjMQdzfAIKsobRJ8dSNHzOj9pCAFdhSv3pdvRZISI8 YpzBSaD+e8Woa/wKimHxkJn/jhZVYEl5WOTbxSQ71eg8PfnRUVreeL7aFvke+poIJupu DEJcAtw/3g+ReOoTEn5OB4oW1YN13l5edOJ/QeNJq8iLenPykbJKPzwJdcbVR+2ETzC5 aOQKW/hOn0GDSrMz7kRP6VegUqcsSS6k9NMaE+yNWhNerEBecV3ZxRLi20G79+mxGwHD IioA== X-Forwarded-Encrypted: i=1; AJvYcCVscia4CMR/TY2h9Ad6Nce4LZIN/u9knL4wgxQ8hOcJGTc7I2GYow19FREUgjdk1KqU46iqtadDLHik20QFqhB/IBvpew== X-Gm-Message-State: AOJu0YxwguSf088VPdMrc21HjJ6BmXP5g0Z8yQXoXAKpmHFnM0xuo3f9 s9FtcxHMhm9HKHHNARKJg29cJZwAaPRwWvVJfJjb3DgGSCBn+NDTtwrUKokWOMM= X-Received: by 2002:a05:6512:2211:b0:52c:d085:9978 with SMTP id 2adb3069b0e04-52ee543f3eemr5062935e87.62.1721393027918; Fri, 19 Jul 2024 05:43:47 -0700 (PDT) Received: from [192.168.2.172] ([90.187.152.45]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7a3c785e97sm28577466b.39.2024.07.19.05.43.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:43:47 -0700 (PDT) From: Caleb Connolly Date: Fri, 19 Jul 2024 14:43:41 +0200 Subject: [PATCH v5 01/11] efi: define struct efi_guid MIME-Version: 1.0 Message-Id: <20240719-b4-dynamic-uuid-v5-1-8a83de3fe3dc@linaro.org> References: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> In-Reply-To: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1137; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=b3W8BuVY9KVN80vqbSH3Ez6m6ALhP6/nGoPftuCgZMA=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmml+AENfu72Cw5/lmy7c3mHdO6I+6h2dYknnRM aR8uMVx9TuJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZppfgAAKCRAFgzErGV9k tij6D/oCJu+VOIVx+ms8ZQt/QU2455ezOverRmUUj+d3rSnDgSB9I9aamQOXsx9NKK2cyhf08Be y94qCcVCeu1Tg3j6G4NETYBNFSLCWSf0OyaRagbbxAjBknPBkWYBYs7kpiFk7UrJXvadeF07X5x KXbBbLjUtDLry5tTwbMvyt0T3l5swci7lHtzqGPFhxB/SeEgMIcjBzRofoOQnOg+IE+jZC5XDpz K6u0f2OTDQSL3WRQgWl9452JsSxJu/SbIYeA5vh1CTiFASTWJgAPbJm3lyY6/51dS3UGPX0uF2g C6u9akS8Cef/cpv3NHGUJpYKbtS4uOabuBTpQAvg2/dMbRZtltUNbHErq8YrRrI+gtS5xq57zsc O6h0qgOJw9aiXd8R0wC1z4KUzU9r5EYLFWXTCmqfo+Ejdzb9jsxO5nGVVJvua35+V7BFGHYxX8f GX/ZfeWB3+qB64RPxd6Wtpn9bSSTvpbBWma9XNAxiuxIY+E+bJTAM0atL+oSyrYsL2kwBmZXLcq epTSGcB6et8x8WjRNfdU2D0Hkt8UUd6+2veRg+Z/beCEA5R2UY3G5UKj6+h4fsCuRrHdA1o/Ao3 m69gIL/k8JY+RsdNzuaLUMeTW4+DLQy+vq53fzizYIS/otxorwYzoKSJIXFmZ+5LssmEFmo+lnf IjxKziDwTQZLVYg== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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.8 at phobos.denx.de X-Virus-Status: Clean This let's us forward declare efi_guid_t in the UUID code without pulling in efi.h Signed-off-by: Caleb Connolly Reviewed-by: Ilias Apalodimas --- include/efi.h | 2 +- tools/eficapsule.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/efi.h b/include/efi.h index c3c4b93f860a..b92c961a2afd 100644 --- a/include/efi.h +++ b/include/efi.h @@ -73,9 +73,9 @@ struct efi_device_path { * EDK2 reference implementation both define EFI_GUID as * struct { u32 a; u16; b; u16 c; u8 d[8]; }; which is 4-byte * aligned. */ -typedef struct { +typedef struct efi_guid { u8 b[16]; } efi_guid_t __attribute__((aligned(4))); #define EFI_BITS_PER_LONG (sizeof(long) * 8) diff --git a/tools/eficapsule.h b/tools/eficapsule.h index 6efd07d2eb6b..97d077536d5b 100644 --- a/tools/eficapsule.h +++ b/tools/eficapsule.h @@ -23,9 +23,9 @@ #endif #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -typedef struct { +typedef struct efi_guid { uint8_t b[16]; } efi_guid_t __aligned(8); #define EFI_GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ From patchwork Fri Jul 19 12:43:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 813381 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp731836wro; Fri, 19 Jul 2024 05:44:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXNLwbRxgKGw5a6OTm52A8W96eN+hKU37MYsTLsRZjHzD6RXQoxjeaGUSmGuYevKRsD8yQhevC2Fi6Gwto9sRjh X-Google-Smtp-Source: AGHT+IHyhaBAz56KlSv4jd0aIOU9yK8mnwb1GQtyV7K6c6A3py0Q/olGScy3EvwPtQ/3aKU5crPu X-Received: by 2002:a05:6512:33d1:b0:52b:839c:78dc with SMTP id 2adb3069b0e04-52ef5751022mr1012599e87.29.1721393056018; Fri, 19 Jul 2024 05:44:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721393055; cv=none; d=google.com; s=arc-20160816; b=aDQBb9NyPdtEM2f05VvYilsK3vopsdnzFuEP7az0do0DszA24os61O2oiOzu/FhFRW 1VDESrKwvvBQabHU9TZffFl4N+c2d7p9BdyCFBbWo15yto+LdRJB/aEu13nLDfShh6/N C7bEYDGtRVGGRy0JZDxX1XKXOhZrjsNcmE9XOLc8dblFl+C7erET31EFM7hCv6YS0sc4 BqKMYrjY4u0xpwTvwgCKyv7FnVpsk/Ks13j0PFkV/CpCFMGBjAkFp/HwJZwJ/dK2wUFn +znS3YCNV7FQrjPPs2aCmd8udFiImJFbi/YN2RSXjM/B613vXkmEmygc2/fNTNhHVpCq iXUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=06LSf+ZyzKrtlsGlKlD4mrfB2zoy30M7cflm2gOS32s=; fh=cWXPzJstJ9XZjW7KCj7YfdpKRDH5bqutjkCSN2rRWfA=; b=LfPYJozgPVkoSHsVSQJgRndq6I4HV4QMxERTZEGW/EPIJK2UdFxZQLDiWU8x+l4GNm d4JOTo2spGis6MBy/YSwhT1dYcEhPj8VQ9IksDKypIcpAYdy7D4O1zkVQZqgP9KDkjKg 6uMXS6ZK+U6C9l0NfokfYNFTa4AcJ7oYjseor5i9GBKLDzyrQjnxsfAZNGOS8szWOE30 rjk4cw8IFBwFg4Ey7FEc3jK9+M1W5M7lHoX84cmhACjpSIOMIDTuZlTDGBHV8EntdzVB mOncFKAG+X0VfNKtjdsptJz9ofvg1Yk2xovlx+9TsrhI35RPp2auw/NxRiMtaiXNb4SA 1n5g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qA2MJlVz; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 2adb3069b0e04-52ef54f81aasi396627e87.24.2024.07.19.05.44.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:44:15 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qA2MJlVz; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 916C688BBA; Fri, 19 Jul 2024 14:43:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="qA2MJlVz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3A91788BB4; Fri, 19 Jul 2024 14:43:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) (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 C3F8E88B98 for ; Fri, 19 Jul 2024 14:43:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-52eafa1717bso1412327e87.2 for ; Fri, 19 Jul 2024 05:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721393029; x=1721997829; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=06LSf+ZyzKrtlsGlKlD4mrfB2zoy30M7cflm2gOS32s=; b=qA2MJlVzuz/1dz4/kf18a9ad8xbyjJ+g4FWKw5tX0XGoC8qC/WzQ4y88WGkThnJzI4 JWAnTCXtSJR6k/XYegQ6s9Ix0zL+53uj4ugavFD9e8THaMA27hzCWNQ/6dkfQsqweis/ ohJRGcUA9AMzo1zVgtb1TPr9UYlDvqwKg2p0+lMtqrpduPvkZFH1X5K1JasGJ5E/jes9 5Rp9qv5ne+SNM2J8UsbbxnayEm8lqtYuwlASCY4jIKMofTvLLblAg9agc6tReZeIQuVD 018uGjp4xo4sLA/5dRQ8XkOyfyKp9Cv+bPm1w5Ta7mqm8r6wWTLZ4Mon9IYrSATdQUr0 2YFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721393029; x=1721997829; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=06LSf+ZyzKrtlsGlKlD4mrfB2zoy30M7cflm2gOS32s=; b=gfxKTiXK6AhFCtzFqeKPDTDZ7uoXsicHwhfAFK8z1kHwBcWgidYfW3H3Z91dk1Zv3T c17W1/nUkD4C4vZjID53ng2yrLiY4OK/rxKBjACvMssf864B8LyiX2OhSIY5T7gzAyBn MvM5GZcS4CfFSEI0o0+J1zy/0Fpny9ngp3NsBKv+rFY0sImQXlvNg4BT+20LqUaFftJK 1WH472cC2NDO2u4ZUjMeUAJlSkuJqj7l9lNXcD9tkQRlRDTVTB4qQ2FKKe8rgEKVf7GW IO8aif29kGmF+r6kFr3ocqNO44/mER96okBnLsS8y11Jh1AepBoWeroXV9kcW0Z7C3kM DKPQ== X-Forwarded-Encrypted: i=1; AJvYcCXWF4vcM10pT2eUV7oP126yxi9g+2Ul3ffYFrFjo71g6N1CK0qoEqGzHR3gmtwZcmWO7GkV/6ndUvknPrefZeZTMU6jhQ== X-Gm-Message-State: AOJu0YwwDnLYUqZRLPPVb7mYsWx8vmYh961SSq9Dku/5tB/Yi0PTuoBi h+xuQJkk+Fo9QJ1P0A7/tw127xAv/90pfB2XwRdXmiRFTzV5GUxBKGUk+vieMS8= X-Received: by 2002:a05:6512:3ca2:b0:52e:969c:db8a with SMTP id 2adb3069b0e04-52ef5874cb2mr1201801e87.44.1721393029096; Fri, 19 Jul 2024 05:43:49 -0700 (PDT) Received: from [192.168.2.172] ([90.187.152.45]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7a3c785e97sm28577466b.39.2024.07.19.05.43.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:43:48 -0700 (PDT) From: Caleb Connolly Date: Fri, 19 Jul 2024 14:43:42 +0200 Subject: [PATCH v5 02/11] lib: uuid: add UUID v5 support MIME-Version: 1.0 Message-Id: <20240719-b4-dynamic-uuid-v5-2-8a83de3fe3dc@linaro.org> References: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> In-Reply-To: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=5402; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=MVJj99WzRHX1hE7msxJdeDXlzUMLrmHd8cNxyX2SDck=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmml+A9jZ4PYfULAWz7uy5oXXrh2qVWea2sYzjH cwYzxDncNmJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZppfgAAKCRAFgzErGV9k tjmGD/46etIjPTLaZeJR6F5hhaZ7b7qBxS6Yc+DjLr5MvmrwQJyq7WEIibVdBnOpIRtfu011cxB GfHgy5F+zYG+G/KECpXABpszdAtRkfvVE0IQBGRZK1tbpQNO313j0/ujJ1+S3aLjbEgIdiSEItj fNxzuiVVWovry1S42fuB7pYeJFELyIZFp6CjNUR/YX9zdjsc6ImyWTrlkPB9aPY9J5xZ6TzDg03 ZpZvPQJrdHb9SimujXTGjiVV6qNVF6p3j/uztravhy6jI8AmDG6KcU/Jae1INQ9O3t5iUjmA0id XzZZtCuJjY24PT6lLEC20dHWL2jAoKRIfCcg1LMjhiqibqDnl7g5t6IV3fid1mP8l6aT3AKYXNE /FFwC9//Y0+9/IGxdg5lrPus0GScxlHzkOqnw0jp025sCIICd9nGdYXCVanotPdBSYrOZrcgUgP w4SagtF+efrhlSXFgdVNNg0HLsVvyUP7UBbEuM1kFjp5U2/Juvuv2u/FO8Ea1wNqptUOe/2A21f u+kf84spcNDOd/DZbcfjg3fmTXCSYjEEal/OdlP7iZgq4LxR17NJeLIuToxfSIIyfRsaLv2JOam ImAB0aYL9/pU0NlqgAwzZqUmBsMen6YvbV76FmqBEm9qCxYtWeaEMA15O+m+6elnH5A6tMk7BnK 2hiFuOY8/Pd62xw== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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.8 at phobos.denx.de X-Virus-Status: Clean Add support for generating version 5 UUIDs, these are determistic and work by hashing a "namespace" UUID together with some unique data. One intended usecase is to allow for dynamically generate payload UUIDs for UEFI capsule updates, so that supported boards can have their own UUIDs without needing to hardcode them. In addition, move the common bit twiddling code from gen_ran_uuid into a separate function and rewrite it not to use clrsetbits (which is not available when building as part of host tools). Tests for this are added in an upcoming patch. Signed-off-by: Caleb Connolly --- include/uuid.h | 17 +++++++++++++++-- lib/Kconfig | 1 + lib/uuid.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 67 insertions(+), 9 deletions(-) diff --git a/include/uuid.h b/include/uuid.h index f5a941250f48..1f4fa103b5e9 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -10,8 +10,9 @@ #ifndef __UUID_H__ #define __UUID_H__ #include +#include /* * UUID - Universally Unique IDentifier - 128 bits unique number. * There are 5 versions and one variant of UUID defined by RFC4122 @@ -45,10 +46,10 @@ * where x is a hexadecimal character. Fields are separated by '-'s. * When converting to a binary UUID, le means the field should be converted * to little endian and be means it should be converted to big endian. * - * UUID is also used as GUID (Globally Unique Identifier) with the same binary - * format but it differs in string format like below. + * UUID is also used as GUID (Globally Unique Identifier) with the same format + * but with some fields stored in little endian. * * GUID: * 0 9 14 19 24 * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx @@ -142,8 +143,20 @@ void gen_rand_uuid(unsigned char *uuid_bin); * @param - uuid output type: UUID - 0, GUID - 1 */ void gen_rand_uuid_str(char *uuid_str, int str_format); +struct efi_guid; + +/** + * gen_v5_guid() - generate little endian v5 GUID from namespace and other seed data. + * + * @namespace: pointer to UUID namespace salt + * @guid: pointer to allocated GUID output + * @...: NULL terminated list of seed data as pairs of pointers + * to data and their lengths + */ +void gen_v5_guid(const struct uuid *namespace, struct efi_guid *guid, ...); + /** * uuid_str_to_le_bin() - Convert string UUID to little endian binary data. * @uuid_str: pointer to UUID string * @uuid_bin: pointer to allocated array for little endian output [16B] diff --git a/lib/Kconfig b/lib/Kconfig index 2059219a1207..5a48c016d2c5 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -72,8 +72,9 @@ config HAVE_PRIVATE_LIBGCC bool config LIB_UUID bool + select SHA1 config RANDOM_UUID bool "GPT Random UUID generation" select LIB_UUID diff --git a/lib/uuid.c b/lib/uuid.c index dfa2320ba267..7d0a8273d157 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -21,8 +21,9 @@ #include #include #include #include +#include int uuid_str_valid(const char *uuid) { int i, valid; @@ -368,8 +369,57 @@ void uuid_bin_to_str(const unsigned char *uuid_bin, char *uuid_str, } } } +static void configure_uuid(struct uuid *uuid, unsigned char version) +{ + uint16_t tmp; + + /* Configure variant/version bits */ + tmp = be16_to_cpu(uuid->time_hi_and_version); + tmp = (tmp & ~UUID_VERSION_MASK) | (version << UUID_VERSION_SHIFT); + uuid->time_hi_and_version = cpu_to_be16(tmp); + + uuid->clock_seq_hi_and_reserved &= ~UUID_VARIANT_MASK; + uuid->clock_seq_hi_and_reserved |= (UUID_VARIANT << UUID_VARIANT_SHIFT); +} + +void gen_v5_guid(const struct uuid *namespace, struct efi_guid *guid, ...) +{ + sha1_context ctx; + va_list args; + const uint8_t *data; + uint32_t *tmp32; + uint16_t *tmp16; + uint8_t hash[SHA1_SUM_LEN]; + + sha1_starts(&ctx); + /* Hash the namespace UUID as salt */ + sha1_update(&ctx, (unsigned char *)namespace, UUID_BIN_LEN); + va_start(args, guid); + + while ((data = va_arg(args, const uint8_t *))) { + unsigned int len = va_arg(args, size_t); + sha1_update(&ctx, data, len); + } + + va_end(args); + sha1_finish(&ctx, hash); + + /* Truncate the hash into output UUID, it is already big endian */ + memcpy(guid, hash, sizeof(*guid)); + + configure_uuid((struct uuid *)guid, 5); + + /* Make little endian */ + tmp32 = (uint32_t *)&guid->b[0]; + *tmp32 = be32_to_cpu(*tmp32); + tmp16 = (uint16_t *)&guid->b[4]; + *tmp16 = be16_to_cpu(*tmp16); + tmp16 = (uint16_t *)&guid->b[6]; + *tmp16 = be16_to_cpu(*tmp16); +} + #if defined(CONFIG_RANDOM_UUID) || defined(CONFIG_CMD_UUID) void gen_rand_uuid(unsigned char *uuid_bin) { u32 ptr[4]; @@ -394,15 +444,9 @@ void gen_rand_uuid(unsigned char *uuid_bin) /* Set all fields randomly */ for (i = 0; i < 4; i++) ptr[i] = rand(); - clrsetbits_be16(&uuid->time_hi_and_version, - UUID_VERSION_MASK, - UUID_VERSION << UUID_VERSION_SHIFT); - - clrsetbits_8(&uuid->clock_seq_hi_and_reserved, - UUID_VARIANT_MASK, - UUID_VARIANT << UUID_VARIANT_SHIFT); + configure_uuid(uuid, UUID_VERSION); memcpy(uuid_bin, uuid, 16); } From patchwork Fri Jul 19 12:43:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 813382 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp731900wro; Fri, 19 Jul 2024 05:44:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXJczbfc1QaZJvGo0rbpAS82Il9Ue9bQMwkSvhKpeNuqd5umHvqGIPjZCCcCDXAppBntNDmQa0ZabGlH/ZirUDw X-Google-Smtp-Source: AGHT+IEzmMpRe6GySIjGW4L+j7DVAHhLJOL0Elo0kVz+c8rjiA/W/6nNPGUU9WmuwDFRsv2y89B8 X-Received: by 2002:a05:6512:3a8f:b0:52e:bf53:1c13 with SMTP id 2adb3069b0e04-52ee53ac941mr5377514e87.7.1721393066744; Fri, 19 Jul 2024 05:44:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721393066; cv=none; d=google.com; s=arc-20160816; b=V6Te2FigmY3d58TQlxHRSZqkygpRZny3OzmR4QvBog10XSVQQwq3hDycFnKCnpv7/R JFO0WFrmInKi4R0PPCBchRxGKD+VbLaZErQxUcFkgfmlbpw8yyCKnUngsfLAHHM5laLP Z+pObtFhxHB3C8MyDGG7jrXn+EijWAQQL0ji51WBTiCH7GEJ0/xNCO1QZxjcz0lxNiV6 o1C4d47qytMsr8kOZHaQDIbexlGgP0TG4JNdbgvnKsZ4lCogeya9UgDs7gGSZL/b2Hze +PREPOCPe8BeCFdIDh/8be9MbJU6kBCb8JUEMDftnHgxChnVmZnoU+7iLtIn7gwLDynC qgmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=exuUqCZhdw0E2T7u3FlM18c6PlVREGJqtpCJYiJqOKI=; fh=TXKs2LrNKvxuG/cX2CZTrga+3z9DY8xvVnTzadwkxhM=; b=OKBwuJ5loWF7hCOHE8DN1eb0rn1UE3um73lmaOQcDe5mwgT2Pn0fNBpZtIt7Z+uTb7 6X4raneZH/zZTiAb1gvU8DJ2zzuoyqfEzJX8nCaAQAJmQNZ8cm/0KY3o9UrdM7IKiG2O 9Hb1EWRXvV9HLaIFag21JDZz1DINKYp7lRu8nu/n064zpNJqbduba/fRxpmfGxfzkNzx wxkJ8yQRDFynWrxwU2zFSp58btYH+toZBeTI47Yv3AENy3Erv3uZmB2nIgdXuMs5wXBN IJpExOm6h1P8Nm0NDJHW1ajibvL6jy2GycusRd8Qx2Yq9xUioRh28nOgdKx1B4WRZ+Sa 3QGQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PVz6kVYi; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 2adb3069b0e04-52ef5531904si371851e87.304.2024.07.19.05.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:44:26 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PVz6kVYi; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1143488BC0; Fri, 19 Jul 2024 14:43:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="PVz6kVYi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CAA3588BB8; Fri, 19 Jul 2024 14:43:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) (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 B9498887CE for ; Fri, 19 Jul 2024 14:43:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-52ea0f18500so1620852e87.3 for ; Fri, 19 Jul 2024 05:43:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721393030; x=1721997830; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=exuUqCZhdw0E2T7u3FlM18c6PlVREGJqtpCJYiJqOKI=; b=PVz6kVYio0GjptUk4vI96nCk6dcAuTYdQKCKxFXUv+MuRj6sW/VQkvk5Bt6niWUGWa VQS/Hm5lAktlf4Dmq7qDz4TFMaXrYgVr18KwcMwDpjACPcVTno5UtJUGM1aIYbnUdvzT pnm7SJ5BKGaR2lIHWzaUgD7L9bE+bUNye60N7g04mhMmDe5PFgkuszbxX85CBmQpavQI 1f9isRX9chGZVXv31ZK99r6fzreaCwd+iddE06yIu4jja46MbOFi7VSaSYj187Eocmow te/Tpzq9ri0tHWeNeGxZvcLMvnnrTS+3IddG8DA2Q9ixvP2X2IKhJW+OhYBE6ll6gR8J v6NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721393030; x=1721997830; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=exuUqCZhdw0E2T7u3FlM18c6PlVREGJqtpCJYiJqOKI=; b=ewLmI+qylWfzbEnkO/FS2p6BmaBbzpdrygaVp6RCKNtzk8LR1ue49CNLxfetYPBqAx uwg9E2X+atklgRTszot2XE76/VA6Zkd2AkDvEBqxb5IjiUrNLjSzXVV4zjO7jkYCW7Eb qCqKHBBpgLGU8lcuhrW9bazLvHAO+DVv2k1WYQW8xMBUOWQ6AOQh9MujsFie2KY4F0Eb U6yRaGyHR2+qgzuTy9LJxF4z84QWt6cWaYLrAuNNuJ7W+W3V5xyV+EOjW3p+U9rnnTBK f4hDGiGU9vTugTqU/8SMAG4/wGLPU8JSxOAMycvTtW2+GiFpwP/mhePa6Vj5SvfhVYjf gUxQ== X-Forwarded-Encrypted: i=1; AJvYcCXYOrjMIUCZ/ujyYrbZvsT8FjVMqxtqcypWQXTJIkc1cHh5wXn+p1W0Pq+VzYYQ0zekPtZ0xAt9L4YPYLVPr1a8Y99P3A== X-Gm-Message-State: AOJu0YzEdy+fqf305GihZFUAOkRO18AnoqsEUWmq4iml2AilAHGd+3vK CLOP6iGD/IChuLu1X216ok94HZODxTHwD1Nbi9CFM44nK9T4PIBbG31Oq5cNFiQ= X-Received: by 2002:a05:6512:2247:b0:52e:9b4f:cfdc with SMTP id 2adb3069b0e04-52ee53bd259mr5445868e87.26.1721393030158; Fri, 19 Jul 2024 05:43:50 -0700 (PDT) Received: from [192.168.2.172] ([90.187.152.45]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7a3c785e97sm28577466b.39.2024.07.19.05.43.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:43:49 -0700 (PDT) From: Caleb Connolly Date: Fri, 19 Jul 2024 14:43:43 +0200 Subject: [PATCH v5 03/11] efi: add a helper to generate dynamic UUIDs MIME-Version: 1.0 Message-Id: <20240719-b4-dynamic-uuid-v5-3-8a83de3fe3dc@linaro.org> References: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> In-Reply-To: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=4574; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=vORDiZ07Z5TkZufbWhFIR52ZdH7ILrIzNN1l2jnt5D4=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmml+A0NbdiAFHtsFjsP0l4pOhItUlYV5xtXvNL tfQazksCheJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZppfgAAKCRAFgzErGV9k tgpvD/0bNDa/0RfNvaS/jsmv9gAmrlXQhqFKLc9ZZYfAZtlBaMloYrhozVw++5HmpjFvcnbLtxO E/eyk0IE+O3Hoq7wYqBNxirHnkOwXl35qiQggW9JCS/RnbonR8gu5VXXioriGel69I7+xtzjivJ rDFNZvEUVqBaVHRN4eCzUz1qgXUg82fREaxllBgWRDZRTeUuYQdJFjC5nTfE3DLR9jbtBhdNMJF 6R1VDkGGDHKeHPTmbhYTl/z/okUczkyZoBngDkTAQCjZpHZo4wD/qQLyPHLB94raHxgu9b7DZwu ZQiYpceVOcQptqpO3z/dRAQ1T6N6qcYkao3Gur/rEyLK4RmqWOzhsNeqIeDqRUx5B71et6JweqL /7Ks/1otEYhtxcKc9qRoD0WAqt7ZxUMk4XWbQRqwk8PXlheJ0USQKRFF0qnk1pE/sisanRNTnbp 91G+mWtW6ec+z2kzw+wc3kR02G/rW8GvfIOkkGNz/BrM0IO4oChQ3qQM4WYfTznNAVjDcFcJy/F ZUJWJfpgdrnBptoqjf+/tlJN+O8w3531XZDU1OQ7RYQXcQ4uA96nVGVYtZYsGEIStdckWhvgTbf MxmkCFPBKej7KMg6gGiEwjuN38c8ohPn8qEFw8fmZplDkyZp+gywYAEgJLxE9zvncRjBwqR9f7a iYNiSdvKvA7YoKw== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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.8 at phobos.denx.de X-Virus-Status: Clean Introduce a new helper efi_capsule_update_info_gen_ids() which populates the capsule update fw images image_type_id field. This allows for determinstic UUIDs to be used that can scale to a large number of different boards and board variants without the need to maintain a big list. We call this from efi_fill_image_desc_array() to populate the UUIDs lazily on-demand. Signed-off-by: Caleb Connolly --- lib/efi_loader/Kconfig | 12 ++++++++++ lib/efi_loader/efi_capsule.c | 1 + lib/efi_loader/efi_firmware.c | 52 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 2fb24d7af9a4..4735f877c709 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -235,8 +235,20 @@ config EFI_CAPSULE_ON_DISK_EARLY If this option is enabled, capsules will be enforced to be executed as part of U-Boot initialisation so that they will surely take place whatever is set to distro_bootcmd. +config EFI_CAPSULE_NAMESPACE_GUID + string "Namespace for dynamic capsule GUIDs" + # v4 UUID as a default for upstream U-Boot boards + default "8c9f137e-91dc-427b-b2d6-b420faebaf2a" + depends on EFI_HAVE_CAPSULE_SUPPORT + help + Define the namespace or "salt" GUID used to generate the per-image + GUIDs. This should be a GUID in the standard 8-4-4-4-12 format. + + Device vendors are expected to generate their own namespace GUID + to avoid conflicts with upstream/community images. + config EFI_CAPSULE_FIRMWARE bool config EFI_CAPSULE_FIRMWARE_MANAGEMENT diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index 635088f25a13..f3a2388506cc 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -19,8 +19,9 @@ #include #include #include #include +#include #include #include #include diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c index ba5aba098c0f..81d060b47a34 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -244,8 +244,57 @@ void efi_firmware_fill_version_info(struct efi_firmware_image_descriptor *image_ free(var_state); } +/** + * efi_capsule_update_info_gen_ids - generate GUIDs for the images + * + * Generate the image_type_id for each image in the update_info.images array + * using the first compatible from the device tree and a salt + * UUID defined at build time. + * + * Returns: status code + */ +static efi_status_t efi_capsule_update_info_gen_ids(void) +{ + int ret, i; + struct uuid namespace; + const char *compatible; /* Full array including null bytes */ + struct efi_fw_image *fw_array; + + fw_array = update_info.images; + /* Check if we need to run (there are images and we didn't already generate their IDs) */ + if (!update_info.num_images || + memchr_inv(&fw_array[0].image_type_id, 0, sizeof(fw_array[0].image_type_id))) + return EFI_SUCCESS; + + ret = uuid_str_to_bin(CONFIG_EFI_CAPSULE_NAMESPACE_GUID, + (unsigned char *)&namespace, UUID_STR_FORMAT_GUID); + if (ret) { + log_debug("%s: EFI_CAPSULE_NAMESPACE_GUID is invalid: %d\n", __func__, ret); + return EFI_UNSUPPORTED; + } + + compatible = ofnode_read_string(ofnode_root(), "compatible"); + if (!compatible) { + log_debug("%s: model or compatible not defined\n", __func__); + return EFI_UNSUPPORTED; + } + + for (i = 0; i < update_info.num_images; i++) { + gen_v5_guid(&namespace, + &fw_array[i].image_type_id, + compatible, strlen(compatible), + fw_array[i].fw_name, u16_strlen(fw_array[i].fw_name) * sizeof(uint16_t), + NULL); + + log_debug("Image %ls UUID %pUl\n", fw_array[i].fw_name, + &fw_array[i].image_type_id); + } + + return EFI_SUCCESS; +} + /** * efi_fill_image_desc_array - populate image descriptor array * @image_info_size: Size of @image_info * @image_info: Image information @@ -282,8 +331,11 @@ static efi_status_t efi_fill_image_desc_array( return EFI_BUFFER_TOO_SMALL; } *image_info_size = total_size; + if (efi_capsule_update_info_gen_ids() != EFI_SUCCESS) + return EFI_UNSUPPORTED; + fw_array = update_info.images; *descriptor_count = update_info.num_images; *descriptor_version = EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION; *descriptor_size = sizeof(*image_info); From patchwork Fri Jul 19 12:43:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 813383 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp731974wro; Fri, 19 Jul 2024 05:44:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW4ssOH/M35JUHDeNZ8MFpBbXH+SB+9yigAV8yIxXDWeVMK/6XYk+e1356pWffAsiNgNTsEyCmH5J5OUVXsbSLL X-Google-Smtp-Source: AGHT+IFIgS9rJbwPZ+puzaCRFjBGDYfXMH+b20s1a1DoXD4b9/CljRttVv4vvWcRpYQwD2SRInte X-Received: by 2002:a2e:a582:0:b0:2ec:53ad:464 with SMTP id 38308e7fff4ca-2ef05d32fa9mr43446531fa.34.1721393077783; Fri, 19 Jul 2024 05:44:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721393077; cv=none; d=google.com; s=arc-20160816; b=oLp263gTAm6U2W/GOGQiHniKT3IArRSh65rdUez1NU+zqAqgbtPXr1HCjcr1annvxb U7IWsIqON7lzrz46YiFfuBrsEIAVec4tGaY7zocr0N60onkANbkMWQD7KN3M04H/nGIo RMv7X2wRlSRBJSDSEGGjI2E3W81AyK7HKaO2aGxShCcghlMj7R67R1WLYqVuZBTXp3Cn wsgNUnXtfELRYXucICHwckm+HPMVZglyrz8h6h73+Y3eIE9wnC9nRRuEk71d8umCsgC6 Jsh/vNLMj38vQWExPlnKca43LxGFlvOiO5bkMi8ZKSn3EB+RXLvsPFeGqwsKSUQ1VQIC 7g6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=SevkwiymWliOTfLXzsoNS1778V3aELJp2f6GPtw2PGQ=; fh=j1aWgtXUCRRTDshUXUvfPJgcwcOUhdyHYURKjntyUgE=; b=0w++peF41fWiH2xbM22++7/RpEI6RV9RVF+Afo1hL3AnYAh61RdT8TAHkkQPZ50NXx bYa1lzOqIrihCv4N63gLO9xPBT8nIq1r5qzQeUpdoJ5aEgATdfzvx1lNjGSPvq6qjLS2 Aff8zkcXei2Ia9OVFp+Y8yVCaOPnyCBSqPrF0TTCGQ+6Pyhl8WP6N0Tqvg7uL/xXszes Qqhh3nbMy5zivh54xP7VWb7nfRLYbP0zWa1T5RuAegK+HnwUh5bIQ3WO1pGAi6Pu5Kbd fz/+DPGpl2EBdkGDEXD2x8D8n751DK0+Zb2aUBfNgjJSy5CAgi9j3ofEmWKcxyXoArRj VYqA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rq928mbd; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 38308e7fff4ca-2ef0fd0c20csi3339551fa.388.2024.07.19.05.44.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:44:37 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rq928mbd; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 71CB588BC2; Fri, 19 Jul 2024 14:43:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="Rq928mbd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F08BD88BA8; Fri, 19 Jul 2024 14:43:53 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) (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 F173F88BA8 for ; Fri, 19 Jul 2024 14:43:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a7523f0870cso216885466b.3 for ; Fri, 19 Jul 2024 05:43:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721393031; x=1721997831; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=SevkwiymWliOTfLXzsoNS1778V3aELJp2f6GPtw2PGQ=; b=Rq928mbdb8Wvark9fzeg6q1GFFn1X6oTazJheSzYnqLruIAXOf0VYrok//uTC9OiUv B5Z+vN+JPr2jgZTo/SEWPjdhfyjm+8lzwP4r6FT3Uioh+ToK+1eY4caEwo8YLRyN6vBU X2McYHGwTljEGbFVNWiQEzgAieBOajQJM4cyIqt3vgLsv+Q78C1s1M7d3631Hilbduew oA0LQvnmDDvSA6SDxjEvYfQ4Z4ci18dmMtyYjA4/kw3V/Yc6oERLg+nUZ+Dtsk6e3Qkl RN5P5hCNg3k4EE24BUVBJ+S4/CNothTppGTSCyBniS8e7E0imV4hpE8aYYNXF4bnmXyM HRCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721393031; x=1721997831; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SevkwiymWliOTfLXzsoNS1778V3aELJp2f6GPtw2PGQ=; b=bElArJTK0YxVj9AQglHDGqtIqb0d824XH0XIOuahLgsF2RgzD9CX/J5Hq6XrCkwUk5 Inm0L7uyYTG08Uc8Gu4x6cmVZvdYvbnNNVjcZD7T8EGGgsXvUqRoJi2gwe+I5vxVrJLj WpDURBkNX0BbQENS2hW6kJ+FdKvkem3jzRPupOqicrrfRDbuwF6gGi5IeqrPofg0fQvl 9HLdNv3f9kb/AQDvux8CNQAuyZtijES336REQgftJ7i/Fx68H9mYu85AYgGOskd9ue/C ZXB+uHWEtoeHBCpnvLHG/nbY40o6qoZaPGF51Bqr9lqTNKVQsWegIDzfddGrGwuSnCIg 1K/g== X-Forwarded-Encrypted: i=1; AJvYcCVP3mWDiOGg7HSMj+GrTyqOsIOeKyHN4entCJjvrIs718uF8aVlTMFtItxAsewJ70FJAoHocC5Bt3IkNAFen57mBq7K3A== X-Gm-Message-State: AOJu0Yym0OUwdXOPQ1EZy/wSAYAhPC8Q1ee++eSfnd1B5ORHoa81xDo8 yxmyxD904FXMBRPPfaOjijatLaK7cvt2uABDTHgwKuPxnk3l7+I7OG8L3EImW2E= X-Received: by 2002:a17:906:11c4:b0:a77:cdaa:88a7 with SMTP id a640c23a62f3a-a7a01349b37mr438203066b.48.1721393031276; Fri, 19 Jul 2024 05:43:51 -0700 (PDT) Received: from [192.168.2.172] ([90.187.152.45]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7a3c785e97sm28577466b.39.2024.07.19.05.43.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:43:50 -0700 (PDT) From: Caleb Connolly Date: Fri, 19 Jul 2024 14:43:44 +0200 Subject: [PATCH v5 04/11] doc: uefi: document dynamic UUID generation MIME-Version: 1.0 Message-Id: <20240719-b4-dynamic-uuid-v5-4-8a83de3fe3dc@linaro.org> References: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> In-Reply-To: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2204; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=QSNObyu22LJKw0rqXvvMxjl3Wcj3sXgYDSrg4en4GNc=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmml+AEKvYAG1y+bi7QP/5PPqnJHl9eeGI8gFt1 2kZ4hrctHuJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZppfgAAKCRAFgzErGV9k trYAD/4+o0TJkebVYtHRuF+9+j3MrimduaJ2kfJ7N+5/2HxwiiYKNmTFl3zje/KZCha1Z8Rk8BW 0aTnKm7q3ZRhniqyzG9YktyhecLDaVpJfyet/hooV6rthdPhYUXgB9UA9xOGn5/Jzn7oDdzu18Z jsoZWlaRKqBDSeYkwSPQz05t5lecSIeFCoAO2vLVOqOhIX1OkihWmCr+732x0aHJCrpsjEk2Icu faGF75dqI7ThwRlItmH5VrPbxtnnOT+fciz1M7xyopxXOKTNAc87mAJ8AsT8RQtySfIwxuBzme9 oaF2BBryhAYJTiMNcEkyhBHCENfViD3UMWRos4FP/i5aitQtJDeq8zeF8yu/Desr9TjjxWKvYOi FzXWwlaJ1KbIQRMISn18VbqyvlMm6AMZsoYYNjQoDhgcVTR19bMCKAGUORv3pc7KMLw9Ky0Uibe 9mYujlGWz2sY0d5TzbUBus7F0ALTqQXeQ4nbUH/TtGUJPg+RUGsYdlw28H7QyDiHEhQQNiIY1da 3hccsHXgy1UxTXweHcsQW5eNS/1YIe8H9jZF0UjnRQoltyKBmX9J+4ZZnt3rFB+hwqmPlGGm9v/ UWfpSjjMBOiwceYOs9ZQ4bEiEW4bCalQ+W2fj06AZDZUca1RJW1epUS+1jcLxsbdSURd173mUEX 7Cvt54dc0MTzW2A== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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.8 at phobos.denx.de X-Virus-Status: Clean Document how platforms can generate GUIDs at runtime rather than maintaining a list of UUIDs per-board. Reviewed-by: Ilias Apalodimas Signed-off-by: Caleb Connolly --- doc/develop/uefi/uefi.rst | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst index d450b12bf801..b284736cf6c2 100644 --- a/doc/develop/uefi/uefi.rst +++ b/doc/develop/uefi/uefi.rst @@ -448,8 +448,35 @@ the location of the firmware updates is not a very secure practice. Getting this information from the firmware itself is more secure, assuming the firmware has been verified by a previous stage boot loader. +Dynamic FWU GUIDs +***************** + +The image_type_id contains a GUID value which is specific to the image +and board being updated, that is to say it should uniquely identify the +board model (and revision if relevant) and image pair. Traditionally, +these GUIDs are generated manually and hardcoded on a per-board basis, +however this scheme makes it difficult to scale up to support many +boards. + +To address this, v5 GUIDs can be used to generate board-specific GUIDs +at runtime, based on the board's devicetree root compatible +(e.g. "qcom,qrb5165-rb5"). + +These strings are combined with the fw_image name to generate GUIDs for +each image. Support for dynamic UUIDs can be enabled by generating a new +namespace UUID and setting EFI_CAPSULE_NAMESPACE_GUID to it. Dynamic GUID +generation is only enabled if the image_type_id property is unset for your +firmware images, this is to avoid breaking existing boards with hardcoded +GUIDs. + +The mkeficapsule tool can be used to determine the GUIDs for a particular +board and image. It can be found in the tools directory. + +Firmware update images +********************** + The firmware images structure defines the GUID values, image index values and the name of the images that are to be updated through the capsule update feature. These values are to be defined as part of an array. These GUID values would be used by the Firmware Management From patchwork Fri Jul 19 12:43:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 813384 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp732021wro; Fri, 19 Jul 2024 05:44:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUE0FJyFbjiSr6DHAJlUq+7lJGNVNP37oQgv9DYnGppXKHZeBvxcC051h3hZfoXH9NsQJ5Zn4yg9077cZeLMvoS X-Google-Smtp-Source: AGHT+IGmfYCKpwesGbSNYOgPHHHoc2oFZiPvJFPDfbHCXiw8seyAPTMThptxTUVa+IuarA82UZjl X-Received: by 2002:a05:6512:3e18:b0:52c:df55:e11a with SMTP id 2adb3069b0e04-52ee539c1a0mr5947995e87.9.1721393088195; Fri, 19 Jul 2024 05:44:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721393088; cv=none; d=google.com; s=arc-20160816; b=knH+AIkUpaJbbmeMkXjCIKxkn7zyGtW6up6+vaAL6HHD50u0hd2gbU/e3NCunS/eoL huFqIBWlXk97Z5YS12Xio+YIOI/MjmkHcY7nnm6UTHIG6vsVHbEWX9cL7BiGSN3APe75 TdRN+6nFnmDVpggPP/QfkaJVrPAykhzEbbMVVfjBoKThTjN1C/S2j6FydGGQ4FFB/2mz x2O02BSghes9B1RxGkqDhmRzwrEYgaXshO3DnRpdFCSs+rEe+UBaB6Jqlp7eVOnKhlzg 9T6TFNYJV6FYz52uHO5/1RJ2JqRw7fvmIKON+Z0QW0c2y5fslL3Cn6aF/ES2bhXV7XiG TgLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=slrydBxT451ee2noHD42WIxnJtB5G2V4lRIuOaWEQBY=; fh=LaLBwxne8hUU0KXbMkRqPqzxKsh5dXYezK48wAyDGzI=; b=QkwdglapoFN9fGUjvrcgUTCrjbjILGjXIgH6LC7A2GRRERKnK8OT3xSDCKCoTkeczA /bshETWUJmJgaveo4uiKHiOpv+j0c/H9tm8k8LZIIMK3C9l7ey6vDfkumhmtJKme9AGb H0ri8dLO74LXfDApZ/MCBzu9GWqOMW1oOM7FxoWesOsuN1Fr5ugSU1fGDn0pECgCKyFw GcRu7UtxyNxg6C3pZiAURnGDC8xbgnaxM4pZPzWEsiuax0kK8LL20chH37u4Vsr3nEPQ 3ysz8WFC6jspn+Uo8kAlR+IRb2kdRr7eGImb9I3R8s0DsGqcg5No9v+SUhCusLz3dRMJ YWAQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZBFxNpjd; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 2adb3069b0e04-52ef5543c30si359889e87.439.2024.07.19.05.44.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:44:48 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZBFxNpjd; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CB39188BD1; Fri, 19 Jul 2024 14:43:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="ZBFxNpjd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3B6A788BC4; Fri, 19 Jul 2024 14:43:55 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) (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 16961887CE for ; Fri, 19 Jul 2024 14:43:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-57cf8880f95so983791a12.3 for ; Fri, 19 Jul 2024 05:43:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721393032; x=1721997832; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=slrydBxT451ee2noHD42WIxnJtB5G2V4lRIuOaWEQBY=; b=ZBFxNpjdYRdcHOIQUrsPcDpqJd5zjYMzPJftUws4LCHnQuoMyx8Y3VktiV2JQzT8R1 BKtY+Wh8IgrI2C1jwrshRVkvGZ1HvM22zbQH2dh45Jrj71jIIBZ13aol9ST+oKTJJKxY TJgCAHn5i8OsSPySRfb+6HWtnM+ZBJQ4GQmn5a56jdBvy4RlZ4K2JedFuqd0zTXCapZG kdWSiL85b+K5HjEZ8teXbSFc29XJ3lYlGu6/SYdRkaHpU6YUS9UXWMJJmo/KkVLJG9TU dPXhgWUbLaoMF5B7fG3T2z9nQf8SZ1FmKLms5gapWB9pX6CVXACHhr6bH3dz6GIKMuCC HgXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721393032; x=1721997832; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=slrydBxT451ee2noHD42WIxnJtB5G2V4lRIuOaWEQBY=; b=J8lUZ9gbXqoben3/V5ZiV2OqCwh+6WVrO69EIemem4toSYM2XBB1riT6e5MriJCjNB VbqBx+HTl+wl77CDMsqbsF1jcq1p6GMw51zRwQH6YQR9SRBJ2IPG3VlkkCNWMMGtGMTs k6MZQwSmf7Hg9yAZceofxoh7ix+vsy0Wtu+Dx30Gbnh8nT+divRlBfU5zoLkDSw9X7XQ cgRA2csD4CSw6p1n3X3KBS1WydraAO8ZMg5rYsI1A05oz80fxnUizPZ/Xlk+VIcfKslf yscOw8QTuKr7BlshRBv3W26t5xkIaU2T/dhdBjXGZS1WM+F03NnKq0jWplY/QoEq48XP c/SQ== X-Forwarded-Encrypted: i=1; AJvYcCVVZyth17UsnvbYaBKnD0755SQ2YZ0aRWl+pYe+IVyfgujBM9p76B3VW2358cg44X0u5GNmtmgNPhHj0GJCj4fdm7JjCw== X-Gm-Message-State: AOJu0YxsuyCWewikH4u46SNhieKSJUB+ygU8owXTw33TDkAcVme64jqw k0nnI/eBRW5ZoDQzFW0O4oapiPLFcaBhIYhJdUx7wsniDHX0ekHFTyuXGJzZjkI= X-Received: by 2002:a17:906:2c50:b0:a6f:58a6:fed8 with SMTP id a640c23a62f3a-a7a012f3bd6mr611013166b.28.1721393032399; Fri, 19 Jul 2024 05:43:52 -0700 (PDT) Received: from [192.168.2.172] ([90.187.152.45]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7a3c785e97sm28577466b.39.2024.07.19.05.43.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:43:51 -0700 (PDT) From: Caleb Connolly Date: Fri, 19 Jul 2024 14:43:45 +0200 Subject: [PATCH v5 05/11] sandbox: switch to dynamic UUIDs MIME-Version: 1.0 Message-Id: <20240719-b4-dynamic-uuid-v5-5-8a83de3fe3dc@linaro.org> References: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> In-Reply-To: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=10572; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=hcfD1220PUFTgwyapeU1Eesp+6IpzsCEjNL61IBFVB0=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmml+AT50L821FTpVWm+5y3cskh7afuUqC23/vg uI6F6xR9MSJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZppfgAAKCRAFgzErGV9k toD2EACmThzygO8gc8aEdWSckDzJDlqXPpo7pVHPHURsp9A1ukIB+Q0Fcmo1lHvtO2DsuZBfcg5 0Ge1vuV6+YAV0/QJjcdHaDblL9cQpTItdV4PjdNZL7Vp4+t80232V/DnUmFfY/SLMexAGt+rC29 a8j6KOoUwA+lmYPlhoPYlUVpY2TUgcj2RqAgH6SimcbauXZRAf/xvCdPKc3avwqhu2gH17uvSP4 sSAQ5W1qsE9rQbzrS41uaMxuc6oIhLtNvofb6JVoTe01YnvGtfj13pJwPA7P7SyMjhM0wH9FuZS VrXy+XRb3A+OVJYyzR/2N6hJYj8nW3SAuw+DjDJk6rUxLzbq0sXX849dEvlku2ZSNtxumtZWBbo 0lGjeKL8uHZ2EvR/rOLCZBoKIuZvWX/5538kpNc6iuxQNIQ2pA7BvRcMfUDLjmwSsYVPTHhuOFL h++7A1ewLBBBuXyiXIAtz93de9jSoJCTNhxdIR5J+tcPCMZziTb74DBSGgs3ahd0h5bmNFbiccs dsC0PrSvGc2rwHK2BYSArGWWVicRr9qszkO/KA0s806tb2G5bmwOv1tK1PW9f146QAwcV6DnjX/ DAy2Fqmb7GoLDNXyPKZ689DAne1YekGfRYc7ue2YbfKlPEGvULcQy7/BvPrpXmJglWkSOlKWLgL 6yww0bslleO53Zw== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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.8 at phobos.denx.de X-Virus-Status: Clean Migrate sandbox over to generating it's capsule update image GUIDs dynamically from the namespace and board/image info. Update the reference and tests to use the new GUIDs. Signed-off-by: Caleb Connolly Acked-by: Ilias Apalodimas --- board/sandbox/sandbox.c | 16 ---------------- include/sandbox_efi_capsule.h | 6 +++--- .../tests/test_efi_capsule/test_capsule_firmware_fit.py | 2 +- .../tests/test_efi_capsule/test_capsule_firmware_raw.py | 8 ++++---- .../test_efi_capsule/test_capsule_firmware_signed_fit.py | 2 +- .../test_efi_capsule/test_capsule_firmware_signed_raw.py | 4 ++-- test/py/tests/test_efi_capsule/version.dts | 6 +++--- tools/binman/etype/efi_capsule.py | 2 +- tools/binman/ftest.py | 2 +- 9 files changed, 16 insertions(+), 32 deletions(-) diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c index 802596569c64..d97945e58fcf 100644 --- a/board/sandbox/sandbox.c +++ b/board/sandbox/sandbox.c @@ -31,36 +31,20 @@ */ gd_t *gd; #if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) -/* GUIDs for capsule updatable firmware images */ -#define SANDBOX_UBOOT_IMAGE_GUID \ - EFI_GUID(0x09d7cf52, 0x0720, 0x4710, 0x91, 0xd1, \ - 0x08, 0x46, 0x9b, 0x7f, 0xe9, 0xc8) - -#define SANDBOX_UBOOT_ENV_IMAGE_GUID \ - EFI_GUID(0x5a7021f5, 0xfef2, 0x48b4, 0xaa, 0xba, \ - 0x83, 0x2e, 0x77, 0x74, 0x18, 0xc0) - -#define SANDBOX_FIT_IMAGE_GUID \ - EFI_GUID(0x3673b45d, 0x6a7c, 0x46f3, 0x9e, 0x60, \ - 0xad, 0xab, 0xb0, 0x3f, 0x79, 0x37) - struct efi_fw_image fw_images[] = { #if defined(CONFIG_EFI_CAPSULE_FIRMWARE_RAW) { - .image_type_id = SANDBOX_UBOOT_IMAGE_GUID, .fw_name = u"SANDBOX-UBOOT", .image_index = 1, }, { - .image_type_id = SANDBOX_UBOOT_ENV_IMAGE_GUID, .fw_name = u"SANDBOX-UBOOT-ENV", .image_index = 2, }, #elif defined(CONFIG_EFI_CAPSULE_FIRMWARE_FIT) { - .image_type_id = SANDBOX_FIT_IMAGE_GUID, .fw_name = u"SANDBOX-FIT", .image_index = 1, }, #endif diff --git a/include/sandbox_efi_capsule.h b/include/sandbox_efi_capsule.h index 3e288e8a84a2..84d45ec5cfd5 100644 --- a/include/sandbox_efi_capsule.h +++ b/include/sandbox_efi_capsule.h @@ -5,11 +5,11 @@ #if !defined(_SANDBOX_EFI_CAPSULE_H_) #define _SANDBOX_EFI_CAPSULE_H_ -#define SANDBOX_UBOOT_IMAGE_GUID "09d7cf52-0720-4710-91d1-08469b7fe9c8" -#define SANDBOX_UBOOT_ENV_IMAGE_GUID "5a7021f5-fef2-48b4-aaba-832e777418c0" -#define SANDBOX_FIT_IMAGE_GUID "3673b45d-6a7c-46f3-9e60-adabb03f7937" +#define SANDBOX_UBOOT_IMAGE_GUID "985f2937-7c2e-5e9a-8a5e-8e063312964b" +#define SANDBOX_UBOOT_ENV_IMAGE_GUID "9e339473-c2eb-530a-a69b-0cd6bbbed40e" +#define SANDBOX_FIT_IMAGE_GUID "46610520-469e-59dc-a8dd-c11832b877ea" #define SANDBOX_INCORRECT_GUID "058b7d83-50d5-4c47-a195-60d86ad341c4" #define UBOOT_FIT_IMAGE "u-boot_bin_env.itb" diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py b/test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py index 11bcdc2bb293..a726c71c1138 100644 --- a/test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py +++ b/test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py @@ -146,9 +146,9 @@ class TestEfiCapsuleFirmwareFit(): verify_content(u_boot_console, '100000', 'u-boot:Old') verify_content(u_boot_console, '150000', 'u-boot-env:Old') else: # ensure that SANDBOX_UBOOT_IMAGE_GUID is in the ESRT. - assert '3673B45D-6A7C-46F3-9E60-ADABB03F7937' in ''.join(output) + assert '985F2937-7C2E-5E9A-8A5E-8E063312964B' in ''.join(output) assert 'ESRT: fw_version=5' in ''.join(output) assert 'ESRT: lowest_supported_fw_version=3' in ''.join(output) verify_content(u_boot_console, '100000', 'u-boot:New') diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware_raw.py b/test/py/tests/test_efi_capsule/test_capsule_firmware_raw.py index f3a2dff5c2c8..8a790405c7c4 100644 --- a/test/py/tests/test_efi_capsule/test_capsule_firmware_raw.py +++ b/test/py/tests/test_efi_capsule/test_capsule_firmware_raw.py @@ -144,12 +144,12 @@ class TestEfiCapsuleFirmwareRaw: 'env set dfu_alt_info "sf 0:0=u-boot-bin raw 0x100000 0x50000;u-boot-env raw 0x150000 0x200000"', 'efidebug capsule esrt']) # ensure that SANDBOX_UBOOT_ENV_IMAGE_GUID is in the ESRT. - assert '5A7021F5-FEF2-48B4-AABA-832E777418C0' in ''.join(output) + assert '9E339473-C2EB-530A-A69B-0CD6BBBED40E' in ''.join(output) # ensure that SANDBOX_UBOOT_IMAGE_GUID is in the ESRT. - assert '09D7CF52-0720-4710-91D1-08469B7FE9C8' in ''.join(output) + assert '985F2937-7C2E-5E9A-8A5E-8E063312964B' in ''.join(output) check_file_removed(u_boot_console, disk_img, capsule_files) expected = 'u-boot:Old' if capsule_auth else 'u-boot:New' @@ -198,14 +198,14 @@ class TestEfiCapsuleFirmwareRaw: verify_content(u_boot_console, '100000', 'u-boot:Old') verify_content(u_boot_console, '150000', 'u-boot-env:Old') else: # ensure that SANDBOX_UBOOT_IMAGE_GUID is in the ESRT. - assert '09D7CF52-0720-4710-91D1-08469B7FE9C8' in ''.join(output) + assert '985F2937-7C2E-5E9A-8A5E-8E063312964B' in ''.join(output) assert 'ESRT: fw_version=5' in ''.join(output) assert 'ESRT: lowest_supported_fw_version=3' in ''.join(output) # ensure that SANDBOX_UBOOT_ENV_IMAGE_GUID is in the ESRT. - assert '5A7021F5-FEF2-48B4-AABA-832E777418C0' in ''.join(output) + assert '9E339473-C2EB-530A-A69B-0CD6BBBED40E' in ''.join(output) assert 'ESRT: fw_version=10' in ''.join(output) assert 'ESRT: lowest_supported_fw_version=7' in ''.join(output) verify_content(u_boot_console, '100000', 'u-boot:New') diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_fit.py b/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_fit.py index 44a58baa3106..debbce8bdbdf 100644 --- a/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_fit.py +++ b/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_fit.py @@ -156,9 +156,9 @@ class TestEfiCapsuleFirmwareSignedFit(): 'u-boot-env raw 0x150000 0x200000"', 'efidebug capsule esrt']) # ensure that SANDBOX_UBOOT_IMAGE_GUID is in the ESRT. - assert '3673B45D-6A7C-46F3-9E60-ADABB03F7937' in ''.join(output) + assert '46610520-469E-59DC-A8DD-C11832B877EA' in ''.join(output) assert 'ESRT: fw_version=5' in ''.join(output) assert 'ESRT: lowest_supported_fw_version=3' in ''.join(output) verify_content(u_boot_console, '100000', 'u-boot:New') diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_raw.py b/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_raw.py index 83a10e160b8c..439bd71b3a7d 100644 --- a/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_raw.py +++ b/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_raw.py @@ -150,14 +150,14 @@ class TestEfiCapsuleFirmwareSignedRaw(): 'u-boot-env raw 0x150000 0x200000"', 'efidebug capsule esrt']) # ensure that SANDBOX_UBOOT_IMAGE_GUID is in the ESRT. - assert '09D7CF52-0720-4710-91D1-08469B7FE9C8' in ''.join(output) + assert '985F2937-7C2E-5E9A-8A5E-8E063312964B' in ''.join(output) assert 'ESRT: fw_version=5' in ''.join(output) assert 'ESRT: lowest_supported_fw_version=3' in ''.join(output) # ensure that SANDBOX_UBOOT_ENV_IMAGE_GUID is in the ESRT. - assert '5A7021F5-FEF2-48B4-AABA-832E777418C0' in ''.join(output) + assert '9E339473-C2EB-530A-A69B-0CD6BBBED40E' in ''.join(output) assert 'ESRT: fw_version=10' in ''.join(output) assert 'ESRT: lowest_supported_fw_version=7' in ''.join(output) verify_content(u_boot_console, '100000', 'u-boot:New') diff --git a/test/py/tests/test_efi_capsule/version.dts b/test/py/tests/test_efi_capsule/version.dts index 07850cc6064c..3aebb5b64fbd 100644 --- a/test/py/tests/test_efi_capsule/version.dts +++ b/test/py/tests/test_efi_capsule/version.dts @@ -7,18 +7,18 @@ firmware-version { image1 { lowest-supported-version = <3>; image-index = <1>; - image-type-id = "09D7CF52-0720-4710-91D1-08469B7FE9C8"; + image-type-id = "985F2937-7C2E-5E9A-8A5E-8E063312964B"; }; image2 { lowest-supported-version = <7>; image-index = <2>; - image-type-id = "5A7021F5-FEF2-48B4-AABA-832E777418C0"; + image-type-id = "9E339473-C2EB-530A-A69B-0CD6BBBED40E"; }; image3 { lowest-supported-version = <3>; image-index = <1>; - image-type-id = "3673B45D-6A7C-46F3-9E60-ADABB03F7937"; + image-type-id = "46610520-469E-59DC-A8DD-C11832B877EA"; }; }; }; diff --git a/tools/binman/etype/efi_capsule.py b/tools/binman/etype/efi_capsule.py index 751f654bf310..7ed016432074 100644 --- a/tools/binman/etype/efi_capsule.py +++ b/tools/binman/etype/efi_capsule.py @@ -23,9 +23,9 @@ def get_binman_test_guid(type_str): Returns: The actual GUID value (str) """ TYPE_TO_GUID = { - 'binman-test' : '09d7cf52-0720-4710-91d1-08469b7fe9c8' + 'binman-test' : '985f2937-7c2e-5e9a-8a5e-8e063312964b' } return TYPE_TO_GUID[type_str] diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index e4da04030a51..735413ddb0db 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -123,9 +123,9 @@ TEE_ADDR = 0x5678 # Firmware Management Protocol(FMP) GUID FW_MGMT_GUID = '6dcbd5ed-e82d-4c44-bda1-7194199ad92a' # Image GUID specified in the DTS -CAPSULE_IMAGE_GUID = '09d7cf52-0720-4710-91d1-08469b7fe9c8' +CAPSULE_IMAGE_GUID = '985F2937-7C2E-5E9A-8A5E-8E063312964B' # Windows cert GUID WIN_CERT_TYPE_EFI_GUID = '4aafd29d-68df-49ee-8aa9-347d375665a7' # Empty capsule GUIDs EMPTY_CAPSULE_ACCEPT_GUID = '0c996046-bcc0-4d04-85ec-e1fcedf1c6f8' From patchwork Fri Jul 19 12:43:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 813385 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp732106wro; Fri, 19 Jul 2024 05:45:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX+khSNaZbWZJIY+cxEjyohq0laVnkg83Q62NCtXmH24C0bZPV3LFBjQt3tLT9N8cijt1qwLtzSJpabslosXphw X-Google-Smtp-Source: AGHT+IHQEi10PoyXA/VKUjhg/Dj3Gew9wIneOvI6AjQsXbLYUZD+nvuhe+XCWWbv2VblGzq4jLp9 X-Received: by 2002:a05:6512:ad4:b0:52e:933f:f1fa with SMTP id 2adb3069b0e04-52ee545406emr6803371e87.61.1721393100089; Fri, 19 Jul 2024 05:45:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721393100; cv=none; d=google.com; s=arc-20160816; b=PZ2HW4bx9dMXZ4JItZp7TUqOtYpH8K23oPiYucE2Qnic+NeyYWOwUotZPNz0KG/AWB BttP0HETf8MvksHo5IkAfrpmLv7wBT9R2SJ4vodq5IetRabtwvtNK3hZNPKK+24ybzC3 1YxyvHODw4MBPJJcncFx5B6Zfb3x3rYjXXhmLUMIkKUhzsTRVDjAjI58R31kxHRjNFdq 02kcznWSNVT3b+c7guUV4HYN58JeqjRP0ux+JpocHEHjuUVjt2u7ec6ti6f1YpsFFscA s15uXWQNJd3faNbP+npo39hdOoekEvo256mujhtgG1+xBy8dHGE4UQWc8wREIg2dj/AT M36w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=r/tH18cOYdnbYI0rrw7CpCVnGxtTU4g0IPgerw/jV5c=; fh=aTvaGQmYswYYnFj81GmIUtmg9yDY24ylPOr0QqrN5Kk=; b=dY9Pl48VqUEXAZAphdVfUqznFReC2nx85hARVH8hpEn1Vl8LhhFPLlUsDoMIPwqOF7 VNtAEYReMunQ5idCG9bsU3q54qQnbUsoOGhm1zvK/OCDMtQhxGgSa8JJ8dOv0FFerFPY 7uUdMMfgP1oIZm0DZmCec8LVDTKycow8OUV5aYhcAG9AtCvVxWiIJzTX4sn9IwgwYeCl lzoHRjECHeIBUDFKNsqe2bfrvoA519tSqOErMZO+ZVlypHHR3TqB3YLBpy/GbcpHVBHU Lg481xxXpmEm2tkJN2fzXH9vid3hy/z0+OYHt3dl2+RObTlZDlf/zThdzMWyCY4aqY/y BJJg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XodDT9I3; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 2adb3069b0e04-52ef54ff91csi390996e87.169.2024.07.19.05.44.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:45:00 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XodDT9I3; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3BB9688BD4; Fri, 19 Jul 2024 14:44:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="XodDT9I3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5168B88BA9; Fri, 19 Jul 2024 14:43:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) (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 45B8788BC2 for ; Fri, 19 Jul 2024 14:43:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-52ea929ea56so2909390e87.0 for ; Fri, 19 Jul 2024 05:43:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721393033; x=1721997833; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=r/tH18cOYdnbYI0rrw7CpCVnGxtTU4g0IPgerw/jV5c=; b=XodDT9I3Xdp7H0WEmgVo2FYQ5r9kyGF7rb5QayxhGByu5rme9W/RkT4OHN8teR8zWu uuLX9iqpFcZqPwbWiDbU5fzXJdxCvUXF3gEjS3bWL0sP8RArXABUZCBVOGnbVFIH8awU 5tDwS7ZbqphDTzaSqfM1uR1hJqSu2qbHc7ZzJv8kbEjTdzKFAzh5tTtT8mjferbCJQFS L/kKFk6mIH2fSnKBnSePpqyib0Nf6FHBi8Qha+NEkm9icqmyDejp0i8Qig0LUYXr/Za7 WbwJvQ4VQp5S+bAk9veyrqb2PDRKchvwfvQbH6MdHSYYmK8U+Kr9MoavLHJJCGZbFU/b yPKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721393033; x=1721997833; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r/tH18cOYdnbYI0rrw7CpCVnGxtTU4g0IPgerw/jV5c=; b=gzskdjYTeH5+eWCSYj+2VXC2IiZOuoqB/oI0BjCDLD3GTWozGICXJtEzO+PpOK7x7w //tR0amQB1+ath9qjfcgZHPqMAyspg9JHg3xgxieacbm7w1/g1KHyTTOpyl+DlaAegO8 rSZ4+vlEseyXHfYbw7jwXiEV9m/6ayoRBnMzLtze4xgi/ACtJI42gUgDcKfuzRGpcKF7 WJ/a6PiEPHWX3Zd7qnQzjnu6GNcbVD3oPxMUz9XveP5wgA68TS+9GebSqbjDvPyVE8mx kS9J9XBP1IJziXYpS3mBRTBGy1ievpDxq5mNnFvXFDkU1Mmpyf573hGZ6eO2wQyt+bNe ppcA== X-Forwarded-Encrypted: i=1; AJvYcCWjN0YWQSoEWwCBGYp46TXQP1UUSIh2U3amVJP587gKShQbmdfy4OpPTy2u/DtBbV7mIVie9r/k23fv88D+Hcc4IHf+jQ== X-Gm-Message-State: AOJu0YyAPgRhqM1doPN1ggXvtvRh0au4eW6wMYPcjNuk0uygDMqRzQVL yHhee3hvoH/qf2uF76yls/FBV7FqtKpaL/onS4IrbPR7oajfK0Zajh5wuDpuAlQ= X-Received: by 2002:a05:6512:3e03:b0:52e:751a:a172 with SMTP id 2adb3069b0e04-52ee5432a29mr7001799e87.49.1721393033583; Fri, 19 Jul 2024 05:43:53 -0700 (PDT) Received: from [192.168.2.172] ([90.187.152.45]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7a3c785e97sm28577466b.39.2024.07.19.05.43.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:43:53 -0700 (PDT) From: Caleb Connolly Date: Fri, 19 Jul 2024 14:43:46 +0200 Subject: [PATCH v5 06/11] lib: uuid: supporting building as part of host tools MIME-Version: 1.0 Message-Id: <20240719-b4-dynamic-uuid-v5-6-8a83de3fe3dc@linaro.org> References: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> In-Reply-To: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=5243; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=O65GT19i9rQOizkC2sebcSaH7hMe5ytzOraTZ22qXA0=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmml+AT5ph8kG5ncs26AfG+wNlpFYmI+/8iXLQu 7Z54xi3IyWJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZppfgAAKCRAFgzErGV9k tnVbEACEUpyrVTfYjfCtCuyVgGYVicaZkuuVeAPwW+kLk2P7ToGwQ3PU038Sr7CW+y4tTJ8gR82 ekSYglphyDHG2Txy8Y7F3IIFeD3WV934vOH1XgTFUtPqNyHmHTxhEZIbyOwo3Jb17qA7eX/+pxw Vt34Ie12obamYlLdZohVaSFgSkNM+ksGGRf8hq7/3VvRnlxlTKEH59ibQN3mHtey4aHH5ZGgACH a61XZoVPY4ooenOCW3nBtXs74oX0epfSBf+E9IICCFFiP5vF2X+TF6bYD+bmaloKIn5Ko+aieD9 nSqM3DJbiIQjcDaG9C+76pIUYCi/6yqKesNvCZlCS8GH1ZyMUz2j7ETyQgjt5CMUIIFveaiDo7V Cvt0fD4y4zbhbXlvuvDjhC4qTplq1Dgs3lv5eaGMG0tOxEZggMcBTdeHT2DH0hlfW8E556vp74j l60TehWDUbTiJsJjnIeJ1xq1qJBXqce0rtzb0I+WumcwGb4yCz8wb5ez29u83+hJAykmf7hjwYZ ZflcL3YQVNJ2cLoNC1uTnmjtkQikWixLY8WZUY7XAPus94l63Eqt3xZvilx6/bU4ffEQQJsdvnj cSdpiKCfgobifG+07TkrD+ha69anaOjkJ7id/4Hf5oU9EFsD8+eZUIGn8q9J8ZlIhsJ8COQbr/C GNcS4r/+2SGfmiA== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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.8 at phobos.denx.de X-Virus-Status: Clean Adjust the UUID library code so that it can be compiled as part of a host tool. This removes the one redundant log_debug() call, as well as the incorrectly defined LOG_CATEGORY. In general this is a fairly trivial change, just adjusting includes and disabling list_guid. This will be used by a new genguid tool to generate v5 GUIDs that match those generated by U-Boot at runtime. Signed-off-by: Caleb Connolly --- include/uuid.h | 4 ++-- lib/uuid.c | 44 ++++++++++++++++++++++++++++++-------------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/include/uuid.h b/include/uuid.h index 1f4fa103b5e9..7f8414dc906c 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -69,10 +69,10 @@ struct uuid { } __packed; /* Bits of a bitmask specifying the output format for GUIDs */ #define UUID_STR_FORMAT_STD 0 -#define UUID_STR_FORMAT_GUID BIT(0) -#define UUID_STR_UPPER_CASE BIT(1) +#define UUID_STR_FORMAT_GUID 0x1 +#define UUID_STR_UPPER_CASE 0x2 /* Use UUID_STR_LEN + 1 for string space */ #define UUID_STR_LEN 36 #define UUID_BIN_LEN sizeof(struct uuid) diff --git a/lib/uuid.c b/lib/uuid.c index 7d0a8273d157..272e07dc1613 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -6,25 +6,38 @@ * Authors: * Abdellatif El Khlifi */ -#define LOG_CATEGOT LOGC_CORE - +#ifndef USE_HOSTCC #include #include #include #include #include -#include -#include -#include #include #include #include #include #include +#include +#include +#else +#include +#include +#include +#include +#endif +#include +#include +#include +#include #include +#ifdef USE_HOSTCC +/* polyfill hextoul to avoid pulling in strto.c */ +#define hextoul(cp, endp) strtoul(cp, endp, 16) +#endif + int uuid_str_valid(const char *uuid) { int i, valid; @@ -51,8 +64,9 @@ int uuid_str_valid(const char *uuid) static const struct { const char *string; efi_guid_t guid; } list_guid[] = { +#ifndef USE_HOSTCC #ifdef CONFIG_PARTITION_TYPE_GUID {"system", PARTITION_SYSTEM_GUID}, {"mbr", LEGACY_MBR_PARTITION_GUID}, {"msft", PARTITION_MSFT_RESERVED_GUID}, @@ -231,8 +245,9 @@ static const struct { { "EFI_MEMORY_TYPE", EFI_MEMORY_TYPE }, { "EFI_MEM_STATUS_CODE_REC", EFI_MEM_STATUS_CODE_REC }, { "EFI_GUID_EFI_ACPI1", EFI_GUID_EFI_ACPI1 }, #endif +#endif /* !USE_HOSTCC */ }; int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin) { @@ -266,9 +281,8 @@ int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin, uint32_t tmp32; uint64_t tmp64; if (!uuid_str_valid(uuid_str)) { - log_debug("not valid\n"); #ifdef CONFIG_PARTITION_TYPE_GUID if (!uuid_guid_get_bin(uuid_str, uuid_bin)) return 0; #endif @@ -297,19 +311,19 @@ int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin, tmp16 = cpu_to_be16(hextoul(uuid_str + 19, NULL)); memcpy(uuid_bin + 8, &tmp16, 2); - tmp64 = cpu_to_be64(simple_strtoull(uuid_str + 24, NULL, 16)); + tmp64 = cpu_to_be64(hextoul(uuid_str + 24, NULL)); memcpy(uuid_bin + 10, (char *)&tmp64 + 2, 6); return 0; } int uuid_str_to_le_bin(const char *uuid_str, unsigned char *uuid_bin) { - u16 tmp16; - u32 tmp32; - u64 tmp64; + uint16_t tmp16; + uint32_t tmp32; + uint64_t tmp64; if (!uuid_str_valid(uuid_str) || !uuid_bin) return -EINVAL; @@ -324,22 +338,22 @@ int uuid_str_to_le_bin(const char *uuid_str, unsigned char *uuid_bin) tmp16 = cpu_to_le16(hextoul(uuid_str + 19, NULL)); memcpy(uuid_bin + 8, &tmp16, 2); - tmp64 = cpu_to_le64(simple_strtoull(uuid_str + 24, NULL, 16)); + tmp64 = cpu_to_le64(hextoul(uuid_str + 24, NULL)); memcpy(uuid_bin + 10, &tmp64, 6); return 0; } void uuid_bin_to_str(const unsigned char *uuid_bin, char *uuid_str, int str_format) { - const u8 uuid_char_order[UUID_BIN_LEN] = {0, 1, 2, 3, 4, 5, 6, 7, 8, + const uint8_t uuid_char_order[UUID_BIN_LEN] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; - const u8 guid_char_order[UUID_BIN_LEN] = {3, 2, 1, 0, 5, 4, 7, 6, 8, + const uint8_t guid_char_order[UUID_BIN_LEN] = {3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15}; - const u8 *char_order; + const uint8_t *char_order; const char *format; int i; /* @@ -418,8 +432,9 @@ void gen_v5_guid(const struct uuid *namespace, struct efi_guid *guid, ...) tmp16 = (uint16_t *)&guid->b[6]; *tmp16 = be16_to_cpu(*tmp16); } +#ifndef USE_HOSTCC #if defined(CONFIG_RANDOM_UUID) || defined(CONFIG_CMD_UUID) void gen_rand_uuid(unsigned char *uuid_bin) { u32 ptr[4]; @@ -501,4 +516,5 @@ U_BOOT_CMD(guid, CONFIG_SYS_MAXARGS, 1, do_uuid, "e.g. guid guid_env" ); #endif /* CONFIG_CMD_UUID */ #endif /* CONFIG_RANDOM_UUID || CONFIG_CMD_UUID */ +#endif /* !USE_HOSTCC */ From patchwork Fri Jul 19 12:43:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 813386 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp732213wro; Fri, 19 Jul 2024 05:45:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUd8YoZK83/dmdKYSD9Q6K8UOD1KuLNcdUJiFtex8gbqyzwRJxD6HtctyRn/VIngBZyeL5XgWK/Wgxu5LxQzPdf X-Google-Smtp-Source: AGHT+IGftuI8aK2+Dw8/gHKLeEw2+sz8TaGmP5Su9Pr9aE7kuJoJoo3OZrpnEma+nR5cK+ulXUt3 X-Received: by 2002:a05:6512:2247:b0:52e:be1f:bf84 with SMTP id 2adb3069b0e04-52ee5445e86mr5337997e87.53.1721393112801; Fri, 19 Jul 2024 05:45:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721393112; cv=none; d=google.com; s=arc-20160816; b=YaYsp+fW//xraINyDRCGcV/u//Y0hka2mLIg7zJuDmI8pnb0H3yE4R0gdxO67YRAIn ju+BapgSxBeTieYtf+miCx/KGOW1jKKhPf69ZlKL1pkqEyP51TUP6wYzS/t/W53flpKp 53CTORTqyvaidi0H+0niG9Vw8EervqCIvb0WOm5m9hPkthy6DUr/zBCwbRotQ0NKFm0y 0/OMP4CU/XqQGA7Dap/KrmDo+4Hw3L2JSHVP0dgrZlrZXlRDsdOo1FE3Osr8UrkYs9sQ oexuapF2jdTk1Tnyes6J8tDVc9b+Mo4UYJi1a3K3HjE05QEgPUS50ido1kZ2NfEaE5BT C6/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=M7CcGxRGRWQfg7BDqiMqKl5BmEjZsiE6NCLF4VZf/tc=; fh=95yUFkKLw+34RYo5c9GfX4MfKnIhgtd5y4NYHlcLGdU=; b=lOVjW/GZakSdvr/yRwAILSkkCYUDUd8G07ppXHiN3Fu27gAWPHc3dZ4iqh87iWNLIw BqLUJf7frarXSQ67A69ZbjF6uVQaC+t11rTBYDs4Gc5y1MhzYejF6fBWIbjm4/RkiDfF X12+UQZOKKNKKt+a3u//FpBJsT7HCrGp7f7LmB7jB7KyKXeDy5pEkcQxvVOEYcJqDxi+ 9LizBcO5hgVZi3e0sqWcBRIQEaFhi6PIZIHp38GrqX4KL17tS4/G89eAoSANLYTpcinH hZR9yJxHsROpK57EbAlG8c/57LYOIOhjSpy/SBEQ6USBO/Khi+iTDSB5yhGF3tWDgrE5 weiA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pblnx4Oj; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 2adb3069b0e04-52ef5531b3dsi378758e87.225.2024.07.19.05.45.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:45:12 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pblnx4Oj; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A5D7C88BE8; Fri, 19 Jul 2024 14:44:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="Pblnx4Oj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2994B88BE0; Fri, 19 Jul 2024 14:43:58 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) (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 C609E88BC4 for ; Fri, 19 Jul 2024 14:43:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2eede876fcbso21114681fa.2 for ; Fri, 19 Jul 2024 05:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721393035; x=1721997835; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=M7CcGxRGRWQfg7BDqiMqKl5BmEjZsiE6NCLF4VZf/tc=; b=Pblnx4Oj6uEKvGThkAGMs8jMvv1Y3HhgRA6dAEbcuuB7msFBkvDr0xyAJu5qfSxg66 jPFmCvNlDTv/oMW9+YBWsL0w8SNeOfoPi+zuv4zwN7r5gkHk1qJFTM/mqVHlgvYW9xlA 3V1RmM3q8euY68+RUN5IPO8Hgk615SSA/EvBAsMspg2iZw+9b3NwEs8B9Yhwrr87h8N6 uNr5BpFvbQ4su2SmIGhlMdU85uTPY4BNDTGwANPO9ie9k/1ZQBif/Tfy4DfNfSdjQRUS C0Bmi1RGuT0/E7VwlaixaIq524OCIdmuXSESDTMPuGfQJ5kcy7r5mxBwsj4sjHEo+BHp FbBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721393035; x=1721997835; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M7CcGxRGRWQfg7BDqiMqKl5BmEjZsiE6NCLF4VZf/tc=; b=dKhRd2u8fFNLNdcVeIHmXn3eIxl+RvAwcNtStQjKPZ5I3DWzwtimVYGn0kFuxTdDmb RkLo2vgtyCi5z/elpAAZxlz4GP+rnUr4Dj+CSMjFAsTHU4Rn/dVs7AkVunL/AC5sbbPw rxvEhusoqNjgi+bSX3heYpV+pwsg2D89KEKPrgjQS/LPR4l2nz6YOp5uWjKWvzCovQBn oizxc02yq1qDeMI/9v+RLL3ePWRoRpuX5pblPl7cvccWKQ4BUbKnL5IqHHdLZxdPmTcW edvV6Dde/TZe1JfTLAKoaK76HEgZGtoMY4pc8vnGMl0urkZ9Flw0PN2y3e/L2MGrJI0H 7iZw== X-Forwarded-Encrypted: i=1; AJvYcCXs6bQuqnNbngFpQPzJYMr1J5vJW2NHS3+pWGa0j1DhAvyFfIBBpgIvBhb4+/oBuee9HQBs6R2on/1Bmb138ovo39JKLQ== X-Gm-Message-State: AOJu0Yx1IWaidUQV5b1oX3zm48W1w2RMVW83n4OnUOQTFlfDjlk8IEu6 YL77PM/g+ZvZ+S2aQM5pBy2zxytvnVOgbkQjN2SQR7k9xtcZtIdecMhZwZP3CXI= X-Received: by 2002:a05:6512:a8c:b0:52c:e121:c927 with SMTP id 2adb3069b0e04-52ee544669dmr4833021e87.62.1721393035003; Fri, 19 Jul 2024 05:43:55 -0700 (PDT) Received: from [192.168.2.172] ([90.187.152.45]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7a3c785e97sm28577466b.39.2024.07.19.05.43.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:43:54 -0700 (PDT) From: Caleb Connolly Date: Fri, 19 Jul 2024 14:43:47 +0200 Subject: [PATCH v5 07/11] include: export uuid.h MIME-Version: 1.0 Message-Id: <20240719-b4-dynamic-uuid-v5-7-8a83de3fe3dc@linaro.org> References: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> In-Reply-To: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=15727; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=qH3r0Dg/LorphtqiiSLAE0FelhRGtjCh4FMI2EyXgW0=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmml+BT3iiAspnw56f0dkbsQOIJj6TnWOBAmczx fCelZW4w6mJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZppfgQAKCRAFgzErGV9k tk3jD/kBzqBodX6rWdGXt+Cb1K4hzys+3HZTujEv3rXbEk2OF/zIFBYB+/rp/nUQDFx5plaM2RA +Cec8zal9QHJzFkmZmV9cEHQLGUz8AWAMin8TMlz/z4GPb2cG19SuysdSJv6IkPCokZICNvlGDh mtsWYCgHaIEmZmfJ10wWQLWSTggBqHZKlrC5HPd2JBdhAmUUPaiyz1aB99mUlsvnsn4YK0y7Q86 cPdBHTALgTCuDWKLAjdMmN0P9RsSFbHwSk7IiFzFsiiqNjIYB8bIcKa2ufBC/O2vRQpcjRRlAEx 8ds3/RguND5j1b/V90ilxEqN8PitGULLB/t1Yz946X9327l7BfsTDhmsVHK13Uc3/JMQ+BCI/4G dBwhgdjkJ/1CwbVcuSwA6ieq7CpnvRlhwYar4ZkSINPbRICkdxjB6JW/17M8j6eD8sMEeboPXxl EWHIPtzLvbAXLf20E4D+qFgJpmj2Pe6w74MDLDccBm5kLhXTF+eziu+wc1RQLRxJfQOuiyilhzk Nxqhn3rOMSYWHQSqY31gnF19Gej1rH0jXJWJQu+8fWWWa8uVaP6faND6txl4g1AO+CxAWnNXxp9 xVckUrastLxofI8NWPhb4zMILqU1RVEVrnTT/K99uhfdsnaMlZKevLHUIr9U915OzAjRlN4ErSN EUshjRZ858zDpbw== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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.8 at phobos.denx.de X-Virus-Status: Clean Move this header to include/u-boot/ so that it can be used by external tools. Signed-off-by: Caleb Connolly Reviewed-by: Ilias Apalodimas --- arch/arm/mach-rockchip/board.c | 2 +- board/cobra5272/flash.c | 2 +- board/gardena/smart-gateway-mt7688/board.c | 2 +- board/socrates/socrates.c | 2 +- board/xilinx/common/board.c | 2 +- cmd/efi.c | 2 +- cmd/efi_common.c | 2 +- cmd/flash.c | 2 +- cmd/gpt.c | 2 +- cmd/nvedit_efi.c | 2 +- cmd/x86/hob.c | 2 +- common/flash.c | 2 +- disk/part_efi.c | 2 +- drivers/firmware/arm-ffa/arm-ffa-uclass.c | 2 +- env/sf.c | 2 +- fs/btrfs/btrfs.c | 2 +- fs/btrfs/compat.h | 2 +- fs/btrfs/disk-io.c | 2 +- fs/ext4/ext4fs.c | 2 +- include/fwu.h | 2 +- include/part.h | 2 +- include/rkmtd.h | 2 +- include/{ => u-boot}/uuid.h | 0 lib/acpi/acpi_dp.c | 2 +- lib/acpi/acpigen.c | 2 +- lib/efi/efi_app.c | 2 +- lib/efi_loader/efi_capsule.c | 2 +- lib/efi_loader/efi_device_path.c | 2 +- lib/efi_loader/efi_variable.c | 2 +- lib/fwu_updates/fwu_mtd.c | 2 +- lib/uuid.c | 2 +- lib/vsprintf.c | 2 +- net/bootp.c | 2 +- test/dm/acpi_dp.c | 2 +- test/dm/acpigen.c | 2 +- test/lib/uuid.c | 2 +- 36 files changed, 35 insertions(+), 35 deletions(-) diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index 8a57b8217ff2..0fdf9365b41e 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -24,9 +24,9 @@ #include #include #include #include -#include +#include #include #include #include #include diff --git a/board/cobra5272/flash.c b/board/cobra5272/flash.c index 157b71da85e8..0c1b1c7decd8 100644 --- a/board/cobra5272/flash.c +++ b/board/cobra5272/flash.c @@ -10,9 +10,9 @@ #include #include #include #include -#include +#include #include #include #include diff --git a/board/gardena/smart-gateway-mt7688/board.c b/board/gardena/smart-gateway-mt7688/board.c index c6b14bed41fb..eb7fcd630a10 100644 --- a/board/gardena/smart-gateway-mt7688/board.c +++ b/board/gardena/smart-gateway-mt7688/board.c @@ -15,9 +15,9 @@ #include #include #include #include -#include +#include #include #include #define MT76XX_AGPIO_CFG 0x1000003c diff --git a/board/socrates/socrates.c b/board/socrates/socrates.c index 6e6e276cc741..5e5a45ee00db 100644 --- a/board/socrates/socrates.c +++ b/board/socrates/socrates.c @@ -14,9 +14,9 @@ #include #include #include #include -#include +#include #include #include #include #include diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index 0b43407b9e94..8cec455ae984 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -30,9 +30,9 @@ #include #include #include #include -#include +#include #include "fru.h" #if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) diff --git a/cmd/efi.c b/cmd/efi.c index 6bed2d743ba6..687ccb520428 100644 --- a/cmd/efi.c +++ b/cmd/efi.c @@ -10,9 +10,9 @@ #include #include #include #include -#include +#include #include DECLARE_GLOBAL_DATA_PTR; diff --git a/cmd/efi_common.c b/cmd/efi_common.c index c46764e6eea7..d2f2b59e9e3b 100644 --- a/cmd/efi_common.c +++ b/cmd/efi_common.c @@ -7,9 +7,9 @@ */ #include #include -#include +#include void efi_show_tables(struct efi_system_table *systab) { int i; diff --git a/cmd/flash.c b/cmd/flash.c index de0e04f09cfb..fd660ec477c9 100644 --- a/cmd/flash.c +++ b/cmd/flash.c @@ -9,9 +9,9 @@ */ #include #include #include -#include +#include #if defined(CONFIG_CMD_MTDPARTS) #include diff --git a/cmd/gpt.c b/cmd/gpt.c index 86b7701886a3..27aea2df197c 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -18,9 +18,9 @@ #include #include #include #include -#include +#include #include #include #include #include diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c index 64ae2ad2ce24..32b7d0490747 100644 --- a/cmd/nvedit_efi.c +++ b/cmd/nvedit_efi.c @@ -14,9 +14,9 @@ #include #include #include #include -#include +#include #include /* * From efi_variable.c, diff --git a/cmd/x86/hob.c b/cmd/x86/hob.c index 2dd30808bd10..d3713cef3312 100644 --- a/cmd/x86/hob.c +++ b/cmd/x86/hob.c @@ -4,9 +4,9 @@ */ #include #include -#include +#include #include #include #include diff --git a/common/flash.c b/common/flash.c index 24ddc8bee724..226646c6868f 100644 --- a/common/flash.c +++ b/common/flash.c @@ -7,9 +7,9 @@ /* #define DEBUG */ #include #include -#include +#include #include #include diff --git a/disk/part_efi.c b/disk/part_efi.c index bde4adcfa087..f302a2433cb6 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -14,9 +14,9 @@ #include #include #include -#include +#include #include #include #include #include diff --git a/drivers/firmware/arm-ffa/arm-ffa-uclass.c b/drivers/firmware/arm-ffa/arm-ffa-uclass.c index e0767fc75517..96c64964bb73 100644 --- a/drivers/firmware/arm-ffa/arm-ffa-uclass.c +++ b/drivers/firmware/arm-ffa/arm-ffa-uclass.c @@ -10,9 +10,9 @@ #include #include #include #include -#include +#include #include #include #include #include diff --git a/env/sf.c b/env/sf.c index c747e175e31b..bf08764a09f8 100644 --- a/env/sf.c +++ b/env/sf.c @@ -15,9 +15,9 @@ #include #include #include #include -#include +#include #include #include #include #include diff --git a/fs/btrfs/btrfs.c b/fs/btrfs/btrfs.c index 1149a3b20077..350cff0cbca0 100644 --- a/fs/btrfs/btrfs.c +++ b/fs/btrfs/btrfs.c @@ -6,9 +6,9 @@ */ #include #include -#include +#include #include #include "btrfs.h" #include "crypto/hash.h" #include "disk-io.h" diff --git a/fs/btrfs/compat.h b/fs/btrfs/compat.h index 02173dea5f48..4596b9d1dd39 100644 --- a/fs/btrfs/compat.h +++ b/fs/btrfs/compat.h @@ -4,9 +4,9 @@ #define __BTRFS_COMPAT_H__ #include #include -#include +#include /* Provide a compatibility layer to make code syncing easier */ /* A simple wraper to for error() used in btrfs-progs */ diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 34d9d5351216..14efe7218df5 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-2.0+ #include #include -#include +#include #include #include "kernel-shared/btrfs_tree.h" #include "common/rbtree-utils.h" #include "disk-io.h" diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c index da59cb008fce..15587e92e3e7 100644 --- a/fs/ext4/ext4fs.c +++ b/fs/ext4/ext4fs.c @@ -26,9 +26,9 @@ #include "ext4_common.h" #include #include #include -#include +#include int ext4fs_symlinknest; struct ext_filesystem ext_fs; diff --git a/include/fwu.h b/include/fwu.h index 77ec65e61807..c317613eaaab 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -9,9 +9,9 @@ #include #include #include #include -#include +#include #include struct fwu_mdata; diff --git a/include/part.h b/include/part.h index afae51f1b933..678eb4d7ee99 100644 --- a/include/part.h +++ b/include/part.h @@ -7,9 +7,9 @@ #define _PART_H #include #include -#include +#include #include #include #include diff --git a/include/rkmtd.h b/include/rkmtd.h index 145fede6c840..b7479036b397 100644 --- a/include/rkmtd.h +++ b/include/rkmtd.h @@ -10,9 +10,9 @@ #ifndef __RKMTD__ #define __RKMTD__ #include -#include +#include #define LBA 64 + 512 + 33 #define RK_TAG 0xFCDC8C3B diff --git a/include/uuid.h b/include/u-boot/uuid.h similarity index 100% rename from include/uuid.h rename to include/u-boot/uuid.h diff --git a/lib/acpi/acpi_dp.c b/lib/acpi/acpi_dp.c index 6733809986ae..5714acce0882 100644 --- a/lib/acpi/acpi_dp.c +++ b/lib/acpi/acpi_dp.c @@ -8,9 +8,9 @@ #include #include #include -#include +#include #include #include #include diff --git a/lib/acpi/acpigen.c b/lib/acpi/acpigen.c index b95cabb91493..ecff5a50d504 100644 --- a/lib/acpi/acpigen.c +++ b/lib/acpi/acpigen.c @@ -9,9 +9,9 @@ #define LOG_CATEGORY LOGC_ACPI #include #include -#include +#include #include #include #include #include diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c index 88332c3c910a..9b94a93ee4f1 100644 --- a/lib/efi/efi_app.c +++ b/lib/efi/efi_app.c @@ -16,9 +16,9 @@ #include #include #include #include -#include +#include #include #include #include #include diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index f3a2388506cc..a4ea28730387 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -19,9 +19,9 @@ #include #include #include #include -#include +#include #include #include #include diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 0f684590f22a..9de3b95d073b 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -16,9 +16,9 @@ #include #include #include #include -#include +#include #include #include /* U16_MAX */ /* template END node: */ diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index e888c52efe3e..f3533f4def3a 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -15,9 +15,9 @@ #include #include #include #include -#include +#include #include #include #include #include diff --git a/lib/fwu_updates/fwu_mtd.c b/lib/fwu_updates/fwu_mtd.c index ccaba3f3115a..11b42a3d796c 100644 --- a/lib/fwu_updates/fwu_mtd.c +++ b/lib/fwu_updates/fwu_mtd.c @@ -9,9 +9,9 @@ #include #include #include #include -#include +#include #include #include diff --git a/lib/uuid.c b/lib/uuid.c index 272e07dc1613..17d1c4b4a186 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -28,9 +28,9 @@ #endif #include #include #include -#include +#include #include #ifdef USE_HOSTCC /* polyfill hextoul to avoid pulling in strto.c */ diff --git a/lib/vsprintf.c b/lib/vsprintf.c index cfd1f1914edf..e5802866632e 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -17,9 +17,9 @@ #include #include #include #include -#include +#include #include #include #include #include diff --git a/net/bootp.c b/net/bootp.c index 9dfb50749b49..512ab2ed7c81 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -14,9 +14,9 @@ #include #include #include #include -#include +#include #include #include #include "bootp.h" #ifdef CONFIG_LED_STATUS diff --git a/test/dm/acpi_dp.c b/test/dm/acpi_dp.c index 87bd8ae6749b..fe3ffcb2f8bc 100644 --- a/test/dm/acpi_dp.c +++ b/test/dm/acpi_dp.c @@ -6,9 +6,9 @@ * Written by Simon Glass */ #include -#include +#include #include #include #include #include diff --git a/test/dm/acpigen.c b/test/dm/acpigen.c index 7113219792e6..7637ad0e312b 100644 --- a/test/dm/acpigen.c +++ b/test/dm/acpigen.c @@ -8,9 +8,9 @@ #include #include #include -#include +#include #include #include #include #include diff --git a/test/lib/uuid.c b/test/lib/uuid.c index 0914f2c47e77..9629d378c329 100644 --- a/test/lib/uuid.c +++ b/test/lib/uuid.c @@ -7,9 +7,9 @@ * Authors: * Abdellatif El Khlifi */ -#include +#include #include #include #include From patchwork Fri Jul 19 12:43:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 813389 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp732434wro; Fri, 19 Jul 2024 05:45:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUK0MqHB9Et/Vu0h2bdWcZwXFYTSPVy7mbxC6HL9yOm0QuBzBDlldkzOxPI9mRmcEaTWMGGtuKRVs4Ja7Zyooni X-Google-Smtp-Source: AGHT+IFe8NHBBf+eCkraceIeMGjVTiLBNZoW2Df1pWKYM9ropya+D0gXeFH2DyF2hsRcL1q6Fmr2 X-Received: by 2002:a05:6512:b83:b0:52c:dba6:b4c8 with SMTP id 2adb3069b0e04-52ee539bc8amr5581380e87.13.1721393146251; Fri, 19 Jul 2024 05:45:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721393146; cv=none; d=google.com; s=arc-20160816; b=FVZlAEGzWnvq22qK6AQsPINvV7kyglfFqGcEopy5XYS9PORMyI4I/B5NCmDC7CAzK8 CsRwiEUKTHiS/McIqKzPLySAxkqp66eBW4W8ruUfZyptUicSq9wFfumbay33iK6oUzHY +1w1SapcNhceb078sDm5CN4uY2nPumKgsKdap4k0bgdeJmQ/OlM4F8K8NouDclGuoskC C/kH9nC4YQEKNcNFhe9NwdbzP4BZ88WucK+d2VNwzxMdB2K1cCjjj4CBNsBo9PymIkvu S9O4lox62BZ3FdWrIhNlCx/9h8OVL+7YxEBgW/W395e9I4a/0/+s9vmxoe0sz/3sI8fN Ovkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=yjYV9PN0xWDSskdBgidOP6JWHJHFlMDPu72voIUQ+z8=; fh=//MKYDbFD9tEcNg6NGOC3XwNOwu1JZWB6w+VvDUg1kc=; b=PxNvxU99vG+n7XvhB8FbI3/nfolqnkML9aRd8n/XRRMW4/Lr22hFm9iRZ4MgG1o6vU bkXreWFvelXB1iLdACygZf4c3X0bhSzXs3P8/oe8bRhmAa3NbLvc14Kb1VBpPvYy7HFu NnZTGMyITwr+s2aAeZudK4V1yhDbgRENWLSZuuW2x3W97C/975RGVIBn1hqtJ04twgVM Bm2+U9LUpVdrPsiZifp275w7/HwUYJPjCbSmteAe1s3mV1sPc6FEgOgx2KxUPsUc8uvV aJZSGRLCgGquJmt5v9U7ND6EXtVEFLvXZ1J5smQhFpfqJVKXANTBQiH2e5eIrp6O6nEB SM3g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qLR5aozV; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 2adb3069b0e04-52ef5542e6bsi375483e87.392.2024.07.19.05.45.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:45:46 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qLR5aozV; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 06D4988C02; Fri, 19 Jul 2024 14:44:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="qLR5aozV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1793E88BF0; Fri, 19 Jul 2024 14:44:03 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) (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 BF8F088BCF for ; Fri, 19 Jul 2024 14:43:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-52e9fe05354so1968930e87.1 for ; Fri, 19 Jul 2024 05:43:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721393036; x=1721997836; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=yjYV9PN0xWDSskdBgidOP6JWHJHFlMDPu72voIUQ+z8=; b=qLR5aozV4wb1n08Wg342EamYjf2UZ98b7+uGqnInE11mjYBWY6aOaS2y3kEW6y/4qs Wwbo7z+mljU/gcDr0XZl0fd6d78Bn3rWNueph7c1rDR3iImGxgySQ5OM9u3U2Xfj5Fxx JxPlApFyjeXoc6avdooFhLm4ckVOCQCthjTVT0Vq1hfJ7Y4RLG/XtDk4SSPPsdDDxts/ 4R7U3H6nrKuLv2MxkIIha5YrR+1Y9YIFwNELiDCbeJXx/8cyqIKX5/uf3EOn6/a0B9jK KGVNrft82YYMQU701/zjj0XN7hb8QNZP8wyEJezdSYHJQ0CCEAg4XPBjpe+RrQRgYz0G U+ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721393036; x=1721997836; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yjYV9PN0xWDSskdBgidOP6JWHJHFlMDPu72voIUQ+z8=; b=gm67eOeEMIX2qceG491hA0WOBpEt+xDmdxBTNsLkJ0/UgUvSjP+VBZ4mG3Nwg2uYx0 /pClZ3xGjWtT+Tzk8pCgHRflPO6KfLwa2XMIWtzxs1+wI8p6Iqzhl2zWbrpnyQXP31r5 uIY0IyjjBfqMkleSQSSOueAIWx9Jl5mwUhWhUNaG+xMvPCI8MXmBzakVnHPueXoWbBNc AGHMLBtL/2n+HycIApe2/uSEHftR9PS0hIH4D9PproDuDCSmV7ncnX3nzOXqmqlFvsp/ pJmftpBGmbE/bjXHss1p69R0Qu1/lPozW8QNgLI/aWacMc6uQ8Dd9zcnGD9meNbjlOsY PoyQ== X-Forwarded-Encrypted: i=1; AJvYcCXX+sntJzT2+yymYpKdoVqebtzGI7+8jOulWvnbQND8xbGdlezWcw+nyLkib6nw4YaYWYoeUX9CH3b316KRQ5xPyzGBPg== X-Gm-Message-State: AOJu0YzgsPuuWU0NrcB1fLKve4gufER+mpGxSjDsDyFcJtLY+COGZ3BL J0sMrFeJX08juK2nDptEGSvCd0cvjiUhqeDe/W9pwqhbptSPBM9hVeFU6mrMmDs= X-Received: by 2002:ac2:4c43:0:b0:52c:90b6:170f with SMTP id 2adb3069b0e04-52ee53cc000mr5495418e87.29.1721393036151; Fri, 19 Jul 2024 05:43:56 -0700 (PDT) Received: from [192.168.2.172] ([90.187.152.45]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7a3c785e97sm28577466b.39.2024.07.19.05.43.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:43:55 -0700 (PDT) From: Caleb Connolly Date: Fri, 19 Jul 2024 14:43:48 +0200 Subject: [PATCH v5 08/11] tools: mkeficapsule: use u-boot UUID library MIME-Version: 1.0 Message-Id: <20240719-b4-dynamic-uuid-v5-8-8a83de3fe3dc@linaro.org> References: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> In-Reply-To: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=3757; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=aiqd52H8SbFQqjf61URtk1GpaBu2VRarurf54E5zAHs=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmml+BXGPX0nJP+CqlK5L7lIP5BJoxykz/OcyMq xVTDB7I5/+JAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZppfgQAKCRAFgzErGV9k tg1hD/90LXXrmDe29iXgNxk9C+XFwAW0dCK8Nc76fpC1kSE4B39n4i0C6KFMjWDkFoWpmMZXYS1 Wmbqrb6jwVUlYp1B2Wj7Tz8mmnXog/pYq8ani6Tjgr6NYqn2hTYb8Vtx2VDvOYQLUFaVHrsnvYk iI2QVMEAphhPRhfu7dgnQHF0ZY/7weShhJXTr253XbiEQfKzwdmePecJMCP0KHWC21BHld0/IYc d3IpAO9Qb6hWWF14z5Rw9bRXbNRlAsqf7WkZEsd0zXu7PrC66sSQbVRZrDd6RtSBZLz4SJ4HbLZ QRtCebGIXCKsESGhdrTLGzqFQjQxcg/5JuJIQlbwPa+Coni2UUIRjs+4p0kSaHvYw2RD7iXnaUv e7MSyB5CDsePFTwfFyXOBFTzTnd3cTVWM2ZwSEX/kUW44fMsqIPxEIShKz2MMEWuNaxK9QrMO+S E47kuHKWpnOejrVIX4mCIbexNeOM0NAUOUARobg8jKYK4Rchl6ym9VMWk2+pbl5AqDsXwV7N3Nx 1kN0OHXUYLvY8iNhilvX6JS4Gh5Cll9pKQmZl99FQUG2IjXHYNh01Jvv0Jx0jSLRkMW+FLNOIZV IjdWhFGgzwUgJroalscqkFUiJA5/M7GA4XZ8wDD/y9TlzPNiLhUqoiS5AomC0vgrXVIIWOmlAtE O25esJgSyEpLdXg== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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.8 at phobos.denx.de X-Virus-Status: Clean Replace the use of libuuid with U-Boot's own UUID library. This prepares us to add support for generating v5 GUIDs. Signed-off-by: Caleb Connolly --- tools/Makefile | 8 ++++---- tools/mkeficapsule.c | 53 ++++++---------------------------------------------- 2 files changed, 10 insertions(+), 51 deletions(-) diff --git a/tools/Makefile b/tools/Makefile index 6a4280e3668f..ee08a9675df8 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -245,14 +245,14 @@ hostprogs-$(CONFIG_ASN1_COMPILER) += asn1_compiler HOSTCFLAGS_asn1_compiler.o = -idirafter $(srctree)/include HOSTCFLAGS_mkeficapsule.o += \ $(shell pkg-config --cflags gnutls 2> /dev/null || echo "") -HOSTCFLAGS_mkeficapsule.o += \ - $(shell pkg-config --cflags uuid 2> /dev/null || echo "") HOSTLDLIBS_mkeficapsule += \ $(shell pkg-config --libs gnutls 2> /dev/null || echo "-lgnutls") -HOSTLDLIBS_mkeficapsule += \ - $(shell pkg-config --libs uuid 2> /dev/null || echo "-luuid") +mkeficapsule-objs := generated/lib/uuid.o \ + generated/lib/sha1.o \ + $(LIBFDT_OBJS) \ + mkeficapsule.o hostprogs-$(CONFIG_TOOLS_MKEFICAPSULE) += mkeficapsule mkfwumdata-objs := mkfwumdata.o generated/lib/crc32.o HOSTLDLIBS_mkfwumdata += -luuid diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c index 6a261ff549dc..54fb4dee3ee5 100644 --- a/tools/mkeficapsule.c +++ b/tools/mkeficapsule.c @@ -14,14 +14,15 @@ #include #include #include -#include #include #include #include +#include + #include "eficapsule.h" static const char *tool_name = "mkeficapsule"; @@ -573,39 +574,8 @@ err: return ret; } -/** - * convert_uuid_to_guid() - convert UUID to GUID - * @buf: UUID binary - * - * UUID and GUID have the same data structure, but their binary - * formats are different due to the endianness. See lib/uuid.c. - * Since uuid_parse() can handle only UUID, this function must - * be called to get correct data for GUID when parsing a string. - * - * The correct data will be returned in @buf. - */ -void convert_uuid_to_guid(unsigned char *buf) -{ - unsigned char c; - - c = buf[0]; - buf[0] = buf[3]; - buf[3] = c; - c = buf[1]; - buf[1] = buf[2]; - buf[2] = c; - - c = buf[4]; - buf[4] = buf[5]; - buf[5] = c; - - c = buf[6]; - buf[6] = buf[7]; - buf[7] = c; -} - static int create_empty_capsule(char *path, efi_guid_t *guid, bool fw_accept) { struct efi_capsule_header header = { 0 }; FILE *f = NULL; @@ -649,22 +619,12 @@ err: } static void print_guid(void *ptr) { - int i; - efi_guid_t *guid = ptr; - const uint8_t seq[] = { - 3, 2, 1, 0, '-', 5, 4, '-', 7, 6, - '-', 8, 9, '-', 10, 11, 12, 13, 14, 15 }; + static char buf[37] = { 0 }; - for (i = 0; i < ARRAY_SIZE(seq); i++) { - if (seq[i] == '-') - putchar(seq[i]); - else - printf("%02X", guid->b[seq[i]]); - } - - printf("\n"); + uuid_bin_to_str(ptr, buf, UUID_STR_FORMAT_GUID|UUID_STR_UPPER_CASE); + printf("%s\n", buf); } static uint32_t dump_fmp_payload_header( struct fmp_payload_header *fmp_payload_hdr) @@ -902,13 +862,12 @@ int main(int argc, char **argv) fprintf(stderr, "Image type already specified\n"); exit(EXIT_FAILURE); } - if (uuid_parse(optarg, uuid_buf)) { + if (uuid_str_to_bin(optarg, uuid_buf, UUID_STR_FORMAT_GUID)) { fprintf(stderr, "Wrong guid format\n"); exit(EXIT_FAILURE); } - convert_uuid_to_guid(uuid_buf); guid = (efi_guid_t *)uuid_buf; break; case 'i': index = strtoul(optarg, NULL, 0); From patchwork Fri Jul 19 12:43:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 813390 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp732510wro; Fri, 19 Jul 2024 05:45:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXeogtP5YZzgT4lG2aneQekmnYxFnbNBDLdC5+rAKOWsxv8J/U7zBIzjDPVD/CpU5YvGDqVYJRN0pX/fhXdCyIr X-Google-Smtp-Source: AGHT+IHjqNUyvAaHtU4wg7V5A83ws98hFlf9dSWkIGABRppNK1snaF1cAXUWVHwXYFwgPDuoyvS9 X-Received: by 2002:a05:6512:12c2:b0:52e:943c:c637 with SMTP id 2adb3069b0e04-52ee53f7be2mr5653932e87.37.1721393156871; Fri, 19 Jul 2024 05:45:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721393156; cv=none; d=google.com; s=arc-20160816; b=WGC45QwMNC0y6tsItVfX2I9KwNCVWm3hfj2UTUDHcnUg2qq/A1IKnremccK1DhIVgo 4TfBkX3JkUQCTqtbi4N8XPI5AGLV14EdR5QihHZ5va8u4RspYKOwCHj7X6PpAh4A+RBs 4KxW0gw40E9CISSKYHuV1Cd7DCORSUeCnI56YRh4Zx3fvRIkRqx8gaMuRGGj42bLoVW0 2KL+Dah6vBYUZf6zcmHYdGt35O9WCtmOfi4+31VYBtACJPBVz0FK36OHW/lSy83EF1ZY vRVIwrGUtdVyS9KD37aOR7NRcCo/6FtXnRpsMYJxd2mHgeE05WuRu3shnegRM0xziqYY Ma2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=llK4xT0In7ILZ11aux3dptSqD1KXjlG7HnszAqFZZgU=; fh=xlO2XeDYIUznqnWb3ui/fauBE+ChHPdiCaawaEKpn+o=; b=DT+BPadD5D+hWcVju4qYAtTRg07VwZFwf5SZfl1x1ZBm4wdi+FaBHwJ5XIa3vD+F/X SgA6M5r0w9gNa4Cb+jT5c68SBLjDPL9RAKCOIwjkaoggrp/9LdoJ9jb3hmYKWOd1SkTq NCtJ4KvdoK468nSg6um/po0W9a7ncNsWz/ZhMnY2PH+JKFiTBHP0qp4yeK6OK0R7BH4R Wuar3XfTgtubM7cWSUKKqqc2NDu+fS5O897V4Hro9jHkkBxNjNvti9ixtFGLzQE/1Oe8 lIMpkZeh9Qq5BkHQDMBwzs86csaS1QUUp5tr1x6jVuAe51DzrbAgPlQAb+krB/QqWkb6 qmbw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mRJCw6c7; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 2adb3069b0e04-52ef55319c7si374985e87.276.2024.07.19.05.45.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:45:56 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mRJCw6c7; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 648D688C08; Fri, 19 Jul 2024 14:44:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="mRJCw6c7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 28E1C88BC7; Fri, 19 Jul 2024 14:44:05 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) (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 0A05888BD0 for ; Fri, 19 Jul 2024 14:43:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-52ea7bdde68so1745696e87.0 for ; Fri, 19 Jul 2024 05:43:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721393037; x=1721997837; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=llK4xT0In7ILZ11aux3dptSqD1KXjlG7HnszAqFZZgU=; b=mRJCw6c7Vk+2Md0eK9L/MH3H2UPkV7CUvtflOoTgejhMV+D3ULQVFux0ad7yWoByiz aqLCALmSQfnD7Ek2vv7NRgZTVbScu+osQBbB3SGsocn1Amjp8lcH/Zh6938XdD4AJro5 fxwopA2oIh0TgJY9d33L1vfKccaTwrpNvnSbgaHNLWdYU2cU+VKPxrCoEpcLm9C2mNLy kR63ds45hL8l/9RiLyTayvUWDY1eYzVy/LZxSRvwsfpUmdu8tge7bMOlQokdbDvIVSC5 gY9QRotz9bNRKq9HtB2jm9tCbZT3ooGfCnSDyOtiIUMoWjLKvHcfStzjVA55Svj1Fw6E lkFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721393037; x=1721997837; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=llK4xT0In7ILZ11aux3dptSqD1KXjlG7HnszAqFZZgU=; b=ou8Q8bs85O/TZ6cfIcSg0Beqc9ficZvcIMT8+Y9tzVlh6cry+sG0bxyEkgyP3VFvZi Xlejicz/K0muOyKH8ZsKU8WRDKU4TidfbVSFq8TWy+uTl6QnDgVB119Fl2AyhLDkp+cO Mj/DkvDmHgv9dVI4CjQtLtjSh50jkBmwA11c2lJxGR4Uf6UdeujzeEDjWLgEEM22K0uO 3yuQHw/z2YJbe8Lw4fiosaGLZYSmWeacxZ1D34YLO4s4aNPy5iRdBzblz+1y4A64D0PM OcLEXkxqP+sX2SETb7Os33MVP0vLjT0qEBMWK0KKuFamBIKIMP1s6oD2wwJOblD4VTcV WUuA== X-Forwarded-Encrypted: i=1; AJvYcCVNTW6thndF2bA9q+KIDBvOe2lW43pefEV28+QeTtbRI1/wONcHuWDwT1amJgmD10s3c/1QTfKslB/qu7x/HFbcu93NRg== X-Gm-Message-State: AOJu0YxLY3+VxbWoTI8p6ivqYwzFC7a72w+7iWsneE7SMR1E5ugppu+C a01gTwYWvzEWtzFEOfFhTTFow4t1RrVhd5TW7PEP2Qpe9IM4Da4CpNfpc+WCWF0= X-Received: by 2002:a05:6512:33d1:b0:52e:bdd4:610c with SMTP id 2adb3069b0e04-52ee546ca4fmr5358976e87.63.1721393037293; Fri, 19 Jul 2024 05:43:57 -0700 (PDT) Received: from [192.168.2.172] ([90.187.152.45]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7a3c785e97sm28577466b.39.2024.07.19.05.43.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:43:56 -0700 (PDT) From: Caleb Connolly Date: Fri, 19 Jul 2024 14:43:49 +0200 Subject: [PATCH v5 09/11] tools: mkeficapsule: support generating dynamic GUIDs MIME-Version: 1.0 Message-Id: <20240719-b4-dynamic-uuid-v5-9-8a83de3fe3dc@linaro.org> References: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> In-Reply-To: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=8305; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=1C+uaiSfAQ8Egf4zk38nISU8F2OuZnqGH4xxBkBr6jI=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmml+BgwnsgZ82w6oBx0ryJce7YsHt0O8pJSFmv X+i817eiEiJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZppfgQAKCRAFgzErGV9k tlWfD/9ljiN3aIDa4xOczzk0TnsdQUrmdeVvj7Lrr0DJnCBerhnOctca1a2QIxvQzaGDnR3j86Y GlrP7j2o653hd2qqtG6iIA8ucX4t/P8YmSOhF7guev/bzuw4BoWQyW9xZvb3kSexfZIbuRPydPP B010zTe0oH8mWF7kbSYJgU4BIzYDeknn8QAoOFIJN2n7uzPKB2jokzVo0FRsl/8bJcUkc6oT77z SwagvrSDNQyaepb8fBAoDtghQEIP8ZRRECk1ZnjVritSIkZSkhW4rbtqky2bqaSosiQqOIsmDGI Vw0fx/EkZuLbpSqYMOrFgkP+Ha64oPVQiKX6vBOYWcuxwjgmkm22i0U1q8r8HJiRVrdlmPVqwLy 7SXNBGh6cQy+fefaXgj/iy8qyiSfCt1pgrvSwkdyuZPhR1nr3+VWQCYItC3EfWzSRg649JDhmzj guqMbLaiKDm+BeuCbwZkbVJbACfs5mpjHuxIft9oMhvDhGc7THZHvL2P9Ehcb7s0hTaVY3qCgHD hnRN/1xWn4nszyv30bBQTWQft0GabVaQPW1al8YYurf38KasKGiv+OZerm0HTmy9EVfEIUQcOsD FMyi8Al5bW8RJ9R7iBthMToLnU3lKWvM/I/AteEybmYQHcJle2RySkUa6BujvjRMtKrDXzPtey1 BFJo1Ec+99nWwgQ== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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.8 at phobos.denx.de X-Virus-Status: Clean Add support for generating GUIDs that match those generated internally by U-Boot for capsule update fw_images when using dynamic UUIDs. Dynamic UUIDs in U-Boot work by taking a namespace UUID and hashing it with the board compatible and fw_image name. This feature just provides a way to determine the UUIDs for a particular board without having to actually boot U-Boot on it. Signed-off-by: Caleb Connolly --- doc/mkeficapsule.1 | 23 ++++++++ tools/mkeficapsule.c | 156 +++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 174 insertions(+), 5 deletions(-) diff --git a/doc/mkeficapsule.1 b/doc/mkeficapsule.1 index c4c2057d5c7a..bf735295effa 100644 --- a/doc/mkeficapsule.1 +++ b/doc/mkeficapsule.1 @@ -9,8 +9,11 @@ mkeficapsule \- Generate EFI capsule file for U-Boot .SH SYNOPSIS .B mkeficapsule .RI [ options ] " " [ image-blob ] " " capsule-file +.B mkeficapsule +.RI guidgen " " [ GUID ] " " DTB " " IMAGE_NAME... + .SH "DESCRIPTION" The .B mkeficapsule command is used to create an EFI capsule file to be used by U-Boot for firmware @@ -41,8 +44,12 @@ format is the same as used in the new uImage format and allows for multiple binary blobs in a single capsule file. This type of image file can be generated by .BR mkimage . +mkeficapsule can also be used to simulate the dynamic GUID generation used to +identify firmware images in capsule updates by providing the namespace guid, dtb +for the board, and a list of firmware images. + .SH "OPTIONS" .TP .BI "-g\fR,\fB --guid " guid-string @@ -112,8 +119,24 @@ at every firmware update. .TP .B "-d\fR,\fB --dump_sig" Dump signature data into *.p7 file +.SH "GUIDGEN OPTIONS" + +.TP +.B "[GUID]" +The namespace/salt GUID, by default this is EFI_CAPSULE_NAMESPACE_GUID. +The format is: + xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + +.TP +.B DTB +The device tree blob file for the board. + +.TP +.B IMAGE_NAME... +The names of the firmware images to generate GUIDs for. + .PP .SH FILES .TP .I /EFI/UpdateCapsule diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c index 54fb4dee3ee5..8dfc09ffaf4f 100644 --- a/tools/mkeficapsule.c +++ b/tools/mkeficapsule.c @@ -19,12 +19,16 @@ #include #include #include +#include #include #include "eficapsule.h" +// Matches CONFIG_EFI_CAPSULE_NAMESPACE_GUID +#define DEFAULT_NAMESPACE_GUID "8c9f137e-91dc-427b-b2d6-b420faebaf2a" + static const char *tool_name = "mkeficapsule"; efi_guid_t efi_guid_fm_capsule = EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID; efi_guid_t efi_guid_cert_type_pkcs7 = EFI_CERT_TYPE_PKCS7_GUID; @@ -53,11 +57,23 @@ static struct option options[] = { {"help", no_argument, NULL, 'h'}, {NULL, 0, NULL, 0}, }; -static void print_usage(void) + +static void print_usage_guidgen(void) { - fprintf(stderr, "Usage: %s [options] \n" + fprintf(stderr, "%s guidgen [GUID] DTB IMAGE_NAME...\n" + "Options:\n" + + "\tGUID Namespace GUID (default: %s)\n" + "\tDTB Device Tree Blob\n" + "\tIMAGE_NAME... One or more names of fw_images to generate GUIDs for\n", + tool_name, DEFAULT_NAMESPACE_GUID); +} + +static void print_usage_mkeficapsule(void) +{ + fprintf(stderr, "Usage: \n\n%s [options] \n" "Options:\n" "\t-g, --guid guid for image blob type\n" "\t-i, --index update image index\n" @@ -70,10 +86,11 @@ static void print_usage(void) "\t-A, --fw-accept firmware accept capsule, requires GUID, no image blob\n" "\t-R, --fw-revert firmware revert capsule, takes no GUID, no image blob\n" "\t-o, --capoemflag Capsule OEM Flag, an integer between 0x0000 and 0xffff\n" "\t-D, --dump-capsule dump the contents of the capsule headers\n" - "\t-h, --help print a help message\n", + "\t-h, --help print a help message\n\n", tool_name); + print_usage_guidgen(); } /** * auth_context - authentication context @@ -816,8 +833,130 @@ static void dump_capsule_contents(char *capsule_file) exit(EXIT_FAILURE); } } +static struct fdt_header *load_dtb(const char *path) +{ + struct fdt_header *dtb; + ssize_t dtb_size; + FILE *f; + + /* Open and parse DTB */ + f = fopen(path, "r"); + if (!f) { + fprintf(stderr, "Cannot open %s\n", path); + return NULL; + } + + if (fseek(f, 0, SEEK_END)) { + fprintf(stderr, "Cannot seek to the end of %s: %s\n", + path, strerror(errno)); + return NULL; + } + + dtb_size = ftell(f); + if (dtb_size < 0) { + fprintf(stderr, "Cannot ftell %s: %s\n", + path, strerror(errno)); + return NULL; + } + + fseek(f, 0, SEEK_SET); + + dtb = malloc(dtb_size); + if (!dtb) { + fprintf(stderr, "Can't allocated %ld\n", dtb_size); + return NULL; + } + + if (fread(dtb, dtb_size, 1, f) != 1) { + fprintf(stderr, "Can't read %ld bytes from %s\n", + dtb_size, path); + free(dtb); + return NULL; + } + + fclose(f); + + return dtb; +} + +#define MAX_IMAGE_NAME_LEN 128 +static int genguid(int argc, char **argv) +{ + int idx = 2, ret; + unsigned char namespace[16]; + struct efi_guid image_type_id; + const char *dtb_path; + struct fdt_header *dtb; + const char *compatible; + int compatlen, namelen; + uint16_t fw_image[MAX_IMAGE_NAME_LEN]; + + if (argc < 2) { + fprintf(stderr, "Usage: "); + print_usage_guidgen(); + return -1; + } + + if (uuid_str_to_bin(argv[1], namespace, UUID_STR_FORMAT_GUID)) { + uuid_str_to_bin(DEFAULT_NAMESPACE_GUID, namespace, UUID_STR_FORMAT_GUID); + dtb_path = argv[1]; + } else { + dtb_path = argv[2]; + idx = 3; + } + + if (idx == argc) { + fprintf(stderr, "Usage: "); + print_usage_guidgen(); + return -1; + } + + dtb = load_dtb(dtb_path); + if (!dtb) + return -1; + + if ((ret = fdt_check_header(dtb))) { + fprintf(stderr, "Invalid DTB header: %d\n", ret); + return -1; + } + + compatible = fdt_getprop(dtb, 0, "compatible", &compatlen); + if (!compatible) { + fprintf(stderr, "No compatible string found in DTB\n"); + return -1; + } + if (strnlen(compatible, compatlen) >= compatlen) { + fprintf(stderr, "Compatible string not null-terminated\n"); + return -1; + } + + printf("Generating GUIDs for %s with namespace %s:\n", + compatible, DEFAULT_NAMESPACE_GUID); + for (; idx < argc; idx++) { + memset(fw_image, 0, sizeof(fw_image)); + namelen = strlen(argv[idx]); + if (namelen > MAX_IMAGE_NAME_LEN) { + fprintf(stderr, "Image name too long: %s\n", argv[idx]); + return -1; + } + + for (int i = 0; i < namelen; i++) + fw_image[i] = (uint16_t)argv[idx][i]; + + gen_v5_guid((struct uuid *)&namespace, &image_type_id, + compatible, strlen(compatible), + fw_image, namelen * sizeof(uint16_t), + NULL); + + printf("%s: ", argv[idx]); + print_guid(&image_type_id); + } + + return 0; +} + /** * main - main entry function of mkeficapsule * @argc: Number of arguments * @argv: Array of pointers to arguments @@ -840,8 +979,15 @@ int main(int argc, char **argv) char *privkey_file, *cert_file; int c, idx; struct fmp_payload_header_params fmp_ph_params = { 0 }; + /* Generate dynamic GUIDs */ + if (argc > 1 && !strcmp(argv[1], "guidgen")) { + if (genguid(argc - 1, argv + 1)) + exit(EXIT_FAILURE); + exit(EXIT_SUCCESS); + } + guid = NULL; index = 0; instance = 0; mcount = 0; @@ -928,9 +1074,9 @@ int main(int argc, char **argv) case 'D': capsule_dump = true; break; default: - print_usage(); + print_usage_mkeficapsule(); exit(EXIT_SUCCESS); } } @@ -951,9 +1097,9 @@ int main(int argc, char **argv) (capsule_type != CAPSULE_NORMAL_BLOB && ((argc != optind + 1) || ((capsule_type == CAPSULE_ACCEPT) && !guid) || ((capsule_type == CAPSULE_REVERT) && guid)))) { - print_usage(); + print_usage_mkeficapsule(); exit(EXIT_FAILURE); } if (capsule_type != CAPSULE_NORMAL_BLOB) { From patchwork Fri Jul 19 12:43:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 813387 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp732307wro; Fri, 19 Jul 2024 05:45:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWnRjdmNWoDAYkYhnl1d+hXuXsHjcnPIUZiRZS4zyXnhhu2mlvNwgyLWgBMH8XSH71+cvRvn3wCELiqGlWa7bIq X-Google-Smtp-Source: AGHT+IF+OMSHvFi8keko1s+tFP/0DVQMjMfhEgNq+Ncp1i0ImyHXh5Ex/QqG7UW+7PB/SErGmizc X-Received: by 2002:a05:6512:1047:b0:52c:e0bc:ca3a with SMTP id 2adb3069b0e04-52ee5449450mr5242314e87.64.1721393124794; Fri, 19 Jul 2024 05:45:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721393124; cv=none; d=google.com; s=arc-20160816; b=0dIuhtCdaw5vZHEyzDLHqYg5Eb9byUuDz2PAcVWwbxuf7Imh3io+JT2no474wcDJSY 5dL2Ao/4MEcOmgotyThFungEY7MRl/ZxHgaY2oYvWbyaS3yq3EPuNI2IrTwqnaF6VnB2 mgUCuIU6aTb5Hqqu/5DlbO2ygnbwtZVpt6SwFvA81DYLAENY4NJja9Qykmn7U4BdJeBD gy/59VEDWajAZ/s/Fr+eIWFKE+j5RXHJHTdRtoXcZ4Q62Hs90XBSIXmVXPGwZUW8JAcK lAuRMZVQEgcSZdJY5NgCUAiCkGXY9jsOMjOB+UjnqfWm1COVhuDF6Mw7OSEFmbSlKme0 Fx+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=zgTGsECpuui4joumBLRrHZBmSfd26OhIye1/OmJYNpI=; fh=vInp+cB5UpSqHL36SIQgFtEqrn0mFxYi0VYBrX3hI28=; b=AXnWWOKa6kuGiG4yhnVuWuo3OWAZc/A7hhyRYNLlXlkDqKCBWcXeaFsquYfGr8spVA I85Cicu9JSA9ZU5LoLas6aVbK9Fmvnz0t3tAZBbMO5JQH3QcJhhsdnD5grJJicCud83j vZ0Si/Z59iiTOY4sHj1usE6Y5br8VCBAbAkb5oDvSQ9AZk/C6OOd8UxbRsW1SkJHBbg8 afgz+NDoi4k7ylor3KCHUjhl3xTmNSNWq4I5x4prlFbPin/pkw4Hvi7kogutpteog87b dbau4AOlE5sJ8UF3S5ryJE1pkDrXpl7P2kqbSPlZXKHTUj9eUZycXLEjtDe+PRVZQbf8 Yb/w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vxqEaKME; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 2adb3069b0e04-52ef554b3f5si354641e87.494.2024.07.19.05.45.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:45:24 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vxqEaKME; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1F78C88BEF; Fri, 19 Jul 2024 14:44:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="vxqEaKME"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1A38988BEF; Fri, 19 Jul 2024 14:44:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) (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 1AB6B88BA9 for ; Fri, 19 Jul 2024 14:43:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-52ea5dc3c79so2088923e87.1 for ; Fri, 19 Jul 2024 05:43:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721393038; x=1721997838; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=zgTGsECpuui4joumBLRrHZBmSfd26OhIye1/OmJYNpI=; b=vxqEaKMEOX/xe4cT/BGtFdGztmGvvPB98qa25J2QkgskoD+UkgYYVVRScsdezdaaFr FunQ4kMYjJa06cFQ0YbCgHZ7fj79/IQ2WLY+l+vZl0jT3GdTzv2YYzpyyf7JfbBScC7G CmRTbl+n4z2hG4mBPyJS0ObjElOc7n2mFtbfCkmvip+xQgrKJ8MM5e8doJTqJgQuphOx 3fXD/ekFg1zndlcu6q4uKVPGDDEPcGjdCm1waJOxf/HWzIXGglmtXPv77u31aQTD+kSm hCGi4Bk/pZE5flZxOF7fXZxwFpDHMOYvNHlVMVHqidaG2UNTXZvsb9Abdq2Wv6RSLWZC hG7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721393038; x=1721997838; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zgTGsECpuui4joumBLRrHZBmSfd26OhIye1/OmJYNpI=; b=gid/CTHBgdv+toMusU1Pk6045Z1yITgXBTqfCgRAIhm7h5IA9IWVMXvDeoRZ2dXUYH Pw1AUldZxNrH86Dl+Y9IfS34EbaWqVIIQFhCZEwJ/CYAtGpdCVZrIDG34VfkGHQl9bNQ 4MSGfbjGYh/n4SOJx5EsU8N8TBRMVK8de20aYnpviYNeYWVjAsNFa8yBicxR1qvw5Rml xi+BJ4NJTRvO/c2Ez5tpvTh6z4p037lr4SlXHdvVbPH+j0gZQQuNBcaCvCtaNAu6Vyz+ rhVAn2Fu+UGkBEPEGJF0IM/APS9dGuALRbG6n8+eOb+b1/MfsmNyTS46ettZXNxiIpp8 JHrg== X-Forwarded-Encrypted: i=1; AJvYcCXFwBnvPMhgM0vLrACH71RLoKcSKzMqLxGj5Ue2hOnttJERhW/7RnL/+9KLWA/5tnJ5y8S0Q78czhQ1Foy4ogSktcqTQg== X-Gm-Message-State: AOJu0YzEQsfuTovi7E6aFmJ0dgUQUEGH7sM8h7GdvoYalXfCpqhsaUEk uCK49UtoKkk1SSrdEqbTf1KflChwDM07pwqAa1qUAgw8FPGX8l/9yD4iWDmb6i4OJTE/IfeZgZ4 UvHo= X-Received: by 2002:a05:6512:12cd:b0:52c:d76a:867f with SMTP id 2adb3069b0e04-52ee5202eaamr5108569e87.0.1721393038418; Fri, 19 Jul 2024 05:43:58 -0700 (PDT) Received: from [192.168.2.172] ([90.187.152.45]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7a3c785e97sm28577466b.39.2024.07.19.05.43.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:43:57 -0700 (PDT) From: Caleb Connolly Date: Fri, 19 Jul 2024 14:43:50 +0200 Subject: [PATCH v5 10/11] test: lib/uuid: add unit tests for dynamic UUIDs MIME-Version: 1.0 Message-Id: <20240719-b4-dynamic-uuid-v5-10-8a83de3fe3dc@linaro.org> References: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> In-Reply-To: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=3008; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=ZETTwLjb7NljHuT9g0TrbGD3/tc1AKgjAkUPham0EcU=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmml+BIkAI8dVOQ+fpu5SOUgMEzXacZlCoLj9qi vuvt9LBWtaJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZppfgQAKCRAFgzErGV9k tk3vD/4kQCYu7QAvMMAH+XDl5gWMHy8ITCWBQOe5BBr2w3aPyJOfLS2JPLasxX8PGyIFpBcCzW6 zX+zXcgHOOWoqqz1T6a/ljQEAQg2BMnkcB96PphDnAbong+yOERIbKL26ZyByEt1DZD/kJcTErA VXT0h4en61Tgk8VoWCps7ebMZK8+dej7CSf/qxX0RlVRcAUVYzVGu0+TlKK8/MCtVVuWEM5dz1e WbDS+CjtNfoxo+JKuTj1TzpUfff+wv14SX9LU6GCQEu604x0xKMKK4Bz90kOqQCUC6vFfPuYDq1 c55vAZnBs9lQRCAFvdSpWH0VremD4Axy0j0hHcx/b5Mxdvg6EhEQfBs8TdwUb6KUcGqbjgpb+uT Sk0s5GOwgB8qexwHI992XXT63WmceOWtPliK1tz2k4P70Nyxi5pyIS6vs/P03EEiLmSQoAze9BS uQ+NnnxBArW+MjDOO0YyyC8rraC1+HW6vVaSSYDtD+HQ9ZPah2xnJxWlxIG1Ait01sFHOmFHk9H izfNB8Hn2xSta2aKfosDfbYoIkIqp137mqYyrqMMGhqaBO09IMc98DuFJgXGwLQL33c2e7q8/JG PmEHdYmrDgQfxiBIzZLGegaKCDIDSVaLwIUcrfIwIl1OuFGukTASP3xoRTtGcJXmMRTqqX64RhW hE6tzQIpdTOwqZw== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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.8 at phobos.denx.de X-Virus-Status: Clean Add some basic unit tests to validate that the UUID generation behaves as expected. This matches the implementation in efi_loader for sandbox and a Qualcomm board and should catch any regressions. Signed-off-by: Caleb Connolly Acked-by: Ilias Apalodimas --- test/lib/uuid.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/test/lib/uuid.c b/test/lib/uuid.c index 9629d378c329..2c6cfd42ddc3 100644 --- a/test/lib/uuid.c +++ b/test/lib/uuid.c @@ -7,15 +7,20 @@ * Authors: * Abdellatif El Khlifi */ +#include #include #include #include #include +#include + /* test UUID */ #define TEST_SVC_UUID "ed32d533-4209-99e6-2d72-cdd998a79cc0" +/* U-Boot default fw image namespace */ +#define DEFAULT_FW_IMAGE_NAMESPACE "8c9f137e-91dc-427b-b2d6-b420faebaf2a" #define UUID_SIZE 16 /* The UUID binary data (little-endian format) */ @@ -37,4 +42,81 @@ static int lib_test_uuid_to_le(struct unit_test_state *uts) return 0; } LIB_TEST(lib_test_uuid_to_le, 0); + +struct dynamic_uuid_test_data { + const char *compatible; + const u16 *images[4]; + const char *expected_uuids[4]; +}; + +static int lib_test_dynamic_uuid_case(struct unit_test_state *uts, + const struct dynamic_uuid_test_data *data) +{ + struct uuid namespace; + int j; + + ut_assertok(uuid_str_to_bin(DEFAULT_FW_IMAGE_NAMESPACE, (unsigned char *)&namespace, + UUID_STR_FORMAT_GUID)); + + for (j = 0; data->images[j]; j++) { + const char *expected_uuid = data->expected_uuids[j]; + const u16 *image = data->images[j]; + efi_guid_t uuid; + char uuid_str[37]; + + gen_v5_guid(&namespace, &uuid, + data->compatible, strlen(data->compatible), + image, u16_strlen(image) * sizeof(uint16_t), + NULL); + uuid_bin_to_str((unsigned char *)&uuid, uuid_str, UUID_STR_FORMAT_GUID); + + ut_asserteq_str(expected_uuid, uuid_str); + } + + return 0; +} + +static int lib_test_dynamic_uuid(struct unit_test_state *uts) +{ + int ret, i; + const struct dynamic_uuid_test_data test_data[] = { + { + .compatible = "sandbox", + .images = { + u"SANDBOX-UBOOT", + u"SANDBOX-UBOOT-ENV", + u"SANDBOX-FIT", + NULL, + }, + .expected_uuids = { + "985f2937-7c2e-5e9a-8a5e-8e063312964b", + "9e339473-c2eb-530a-a69b-0cd6bbbed40e", + "46610520-469e-59dc-a8dd-c11832b877ea", + NULL, + } + }, + { + .compatible = "qcom,qrb4210-rb2", + .images = { + u"QUALCOMM-UBOOT", + NULL, + }, + .expected_uuids = { + "d5021fac-8dd0-5ed7-90c2-763c304aaf86", + NULL, + } + }, + }; + + for (i = 0; i < ARRAY_SIZE(test_data); i++) { + ret = lib_test_dynamic_uuid_case(uts, &test_data[i]); + if (ret) + return ret; + } + + return 0; +} + +LIB_TEST(lib_test_dynamic_uuid, 0); + From patchwork Fri Jul 19 12:43:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 813388 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp732367wro; Fri, 19 Jul 2024 05:45:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVdBS3kszt2lWemPPrFnTHEDTDQ6mrh/3g2ivJY7nyEzq/Wzj9s9SOXP9kkCKm587HnPO0pwcOhBXyCuRi4/18o X-Google-Smtp-Source: AGHT+IEmzFC/SQ5WzogxpimehkFUJaIl72mSm7tu5HU++lqhjmU5Rfq50sNm/ZhHIIT4q6zIiM6+ X-Received: by 2002:a2e:9eca:0:b0:2ee:86c1:f73d with SMTP id 38308e7fff4ca-2ef05c7aaadmr35972111fa.18.1721393135680; Fri, 19 Jul 2024 05:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721393135; cv=none; d=google.com; s=arc-20160816; b=DMDKjUGqTciQzhxwws/Oulp4sI8hl2Yuq8Gf3fZcckSx5dXTlkkoAvgKU23yvSAVQC S/o/TemNGnJngdBDDE6ZkOYVhNIkxdIU6A0YVS00ypHvxlZrajwVgNDXCVOdDFHuDbV6 duY34YtVmXCy5+W09VyBPw5wE1Byxxd7ZltspGMgAdaFGC4eQehmZjI4dAGWDFHVzv9r udO+0nbhRCudAbeMlu7bAVnzTEz37+Pol3SdTTgXCDxSG+Z4FoqT97bbVyXXEro7zS98 8bmpzwCHKFV9lRst972MNLxtpX/PMVCFUtoBosuSCLJ6V5MZ3OHKPbDsY35/MtrlFMzn e/MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=ANeWJLSnvDLVzkYEaJuKs+4UWkSeDquEqfDFghLMMHY=; fh=VOcyFTUh29YEldJsEiv/kPGQXbvTOkmQS+JoMw1eJ3g=; b=tLsmlXX90GalmHtnH/03JQ6kK49JOTl/oVMiwooqJbi0Z80Z9gADvNBgIW2DQd7W1X WckssGE07Lp3fu9/dPkM3h1bPa3VpNJ8UjLRJ8If/aXepUIm8KxgUI6DIzTEp8a6NAQ1 aMehORtDUMD61RtyF8wee3aC80bcGWD1Mf3NSwGXfJg4OTwqlMqjizBSVHE9cE6Bj/h/ h0ERowrf0naK5+Gi3Lnl1F4TBn99S7LW/ftRxYBAf71Wmx9GY+bD9mOJEhRzZx7kwaMF oepfoTiuw4trR8I6Uw25GF2ndt0ARjV9ap0cy8uEfWnKFaWZ05bayUYWukF8O7LY6g5R anag==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BNkQ/GYq"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 38308e7fff4ca-2ef0fd0d550si3354541fa.425.2024.07.19.05.45.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:45:35 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BNkQ/GYq"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8F74488BF0; Fri, 19 Jul 2024 14:44:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="BNkQ/GYq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 22C5088BA9; Fri, 19 Jul 2024 14:44:02 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) (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 23B2A88B8B for ; Fri, 19 Jul 2024 14:44:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-52ea7d2a039so1480968e87.3 for ; Fri, 19 Jul 2024 05:44:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721393039; x=1721997839; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ANeWJLSnvDLVzkYEaJuKs+4UWkSeDquEqfDFghLMMHY=; b=BNkQ/GYq0mtfKnAjg1xE7IdOr4Q7bPn8EGymNVUaiJwbgPK++Y65fBrlkbaQPkog/6 fTctw3aVIsDWm8b6Pc1PcTatcLs2oasBcgzWwu2P4RFi1sg00LR4jzsdNtUE83KGXnJW ckRaOor41f2ymv86CTlKlJ7TZ7rW0bpHlqPRCUGS2LtXLcHBcwC3+g3UC0X4AubdtwSF 6PrrhrvMe3yOotgMNGfiLbKaqakZ15zOoWW/DCtV8usEdOgXZa/MjEA7tTTVijQ7DZqG S9YLZ/6TKhlUjrhcVO2oWYq4VmojySNXM3gRYZcxoHrACaxSNrqHGEjxU1SE3Sdjl8Fd jNYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721393039; x=1721997839; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ANeWJLSnvDLVzkYEaJuKs+4UWkSeDquEqfDFghLMMHY=; b=w2bUB8DBUFH6RbuaYKpoPEvvAx5n50YlrElaTCpY9R7LTvouIWLcoafCEKHQAqZ0EI QVXhTy12o3+gKJ6HPy4Eahylio8B/GyhTyOBnTBwp/iqcUyXKW3eAdJGyO0TSfpyKy+A hvQfCnAx85Gn9q5jyzP2v295iBUWWaW+0bpX2gwmTJO1gl1b9/sC/lseMZhP3gI5NogZ C3dmy0TjsrLj2G4iQSbW1+VvnXOH6Uy/NTBZX8klxxj5pRlgrifrlLzRE+nJzXEyVaLR impl9fa3t0wqWW8t67QS+mUC6eXHimIRtWq95oeWU5h9aFFnhuWBrsmPMu3tmCClrBz9 taTg== X-Forwarded-Encrypted: i=1; AJvYcCXYmtCuLl59qmsuHKcpvRuKmYT2oEAaaJgGN2POnl1aXI9MUxWTrfX4obp7F7nFwsJA8UdPviwcEkD/cTB/eBifXg96mQ== X-Gm-Message-State: AOJu0YycxgygCDE7mmhx+LWuNRtzbh4oRquc4xgtXCNR4ZFIJfhutZPc 2O21YqQGhSsIca+n/62ma0WEFmVY4EUK1PxH56RUkwt49bf5kwgMSr+5Rf2+klE= X-Received: by 2002:a05:6512:15a4:b0:52e:74d5:89ae with SMTP id 2adb3069b0e04-52ee53d447emr5796360e87.39.1721393039538; Fri, 19 Jul 2024 05:43:59 -0700 (PDT) Received: from [192.168.2.172] ([90.187.152.45]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7a3c785e97sm28577466b.39.2024.07.19.05.43.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 05:43:59 -0700 (PDT) From: Caleb Connolly Date: Fri, 19 Jul 2024 14:43:51 +0200 Subject: [PATCH v5 11/11] test: lib/uuid: add tests for UUID version/variant bits MIME-Version: 1.0 Message-Id: <20240719-b4-dynamic-uuid-v5-11-8a83de3fe3dc@linaro.org> References: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> In-Reply-To: <20240719-b4-dynamic-uuid-v5-0-8a83de3fe3dc@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1713; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=hbA6/H+9tCFtKZr+AsEDLwQ7R+IJkf/hHZEhk5YCMc4=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmml+B2IRIraTAWksJ2+1aPhKLZ4UeYyzkBvtF7 qW06OhCcLyJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZppfgQAKCRAFgzErGV9k tuXGD/90faMRSkJe72+HEK2uM01mQsKVyNyqQ6uN1Scz1cPHFejrZxUyNCB3egGR1MvlKlvnxSG XmOoRQAJ9fsL29zrfUS7S7kj2NGGJqDNpO39ILkGTwuD3CsVOO4HdsH0OELdyxWyEt0L6TO7HYg k7S/iEogPL2EiuDoawxAxgF7R1h3Je9lAP0EinuwpVC6rIfSfdnIUGv7rdri/InY/1Xkc7k6UkP 4HarBRL8gZElXNx92zBUKX9igsmPaTki/G5qUgiHl+/efL+auSkn/X8lkM73Dh7fXPAiU7+Wd60 9uKmhg+ZZWMCclgCKprnaYhn/+Vq33h1E5oyqtAhFVC9gaHuZMStmLzKPWnu1n2ULBCfjNBt1xT 9jpBzj93X31G+wa52XWpb8nfeP4sdHYFn0RB4Np39GuBodl/J0/WfBzre+r7H1ARwXSkCItQ+OA Cw4hHT6M5TPPP6hLJxM9N9Cg0wBzhfHcz4zvczdeq49Uu/vmKdCIp1AOsOOk/N8VR76c1kIwUrB maJUfEt/7NsnPiyMeS2kllDozLcKcpt+U2ZYlhM/3u8HFwz+N1yIJfV2egM/ctTKFU0kdDJDN+c yCkXUT8M5tMXwT9raau+zmDRDJEkXkwzVrcO0BCePZ1mNPkW5F1DF4jzd/C2fGZnjuFljWcsevy tyYNZZgupivLKBA== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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.8 at phobos.denx.de X-Virus-Status: Clean Add a test to check the version/variant bits of v4 and v5 UUIDs. Signed-off-by: Caleb Connolly --- test/lib/uuid.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/lib/uuid.c b/test/lib/uuid.c index 2c6cfd42ddc3..63d36e120623 100644 --- a/test/lib/uuid.c +++ b/test/lib/uuid.c @@ -43,8 +43,44 @@ static int lib_test_uuid_to_le(struct unit_test_state *uts) } LIB_TEST(lib_test_uuid_to_le, 0); +/* Test UUID attribute bits (version, variant) */ +static int lib_test_uuid_bits(struct unit_test_state *uts) +{ + unsigned char uuid[16]; + efi_guid_t guid; + int i; + + /* + * Reduce the chance of a randomly generated UUID disguising + * a regression by testing multiple times. + */ + for (i = 0; i < 5; i++) { + /* Test UUID v4 */ + gen_rand_uuid((unsigned char *)&uuid); + + printf("v4 UUID: %pUb\n", (efi_guid_t *)uuid); + + ut_assert((uuid[6] & 0xf0) == 0x40); /* version 4 */ + ut_assert((uuid[8] & UUID_VARIANT_MASK) == (UUID_VARIANT << UUID_VARIANT_SHIFT)); /* variant 1 */ + + /* Test v5, use the v4 UUID as the namespace */ + gen_v5_guid((struct uuid *)uuid, + &guid, "test", 4, NULL); + + printf("v5 GUID: %pUl\n", (efi_guid_t *)uuid); + + /* This is a GUID so bits 6 and 7 are swapped (little endian) */ + ut_assert((guid.b[7] & 0xf0) == 0x50); /* version 5 */ + ut_assert((guid.b[8] & UUID_VARIANT_MASK) == (UUID_VARIANT << UUID_VARIANT_SHIFT)); /* variant 1 */ + } + + return 0; +} + +LIB_TEST(lib_test_uuid_bits, 0); + struct dynamic_uuid_test_data { const char *compatible; const u16 *images[4]; const char *expected_uuids[4];