From patchwork Fri Aug 9 00:56:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 818098 Delivered-To: patch@linaro.org Received: by 2002:a5d:5711:0:b0:367:895a:4699 with SMTP id a17csp89334wrv; Thu, 8 Aug 2024 17:56:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUWuc+onQ3NEefbnOQ8G6s8HZD1ONPPO3fTa6+ekl/Zb773kqBdzq85kmSyUPwzSg2kosmM/g2VswwWlaYGAmRT X-Google-Smtp-Source: AGHT+IEN47axRcGaXCjOksdDtentVQwLj0TxaMMuSBs4DjmZGQ9GuQx+Paf6+xsigrC3n+8eBfRQ X-Received: by 2002:a17:906:cadc:b0:a7a:9c1c:1890 with SMTP id a640c23a62f3a-a80aa65fed1mr531966b.55.1723165005923; Thu, 08 Aug 2024 17:56:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723165005; cv=none; d=google.com; s=arc-20160816; b=0M7klpVrtALig0rLrfltr2bM5Qg9pfKrQHnXk0PFsvLVr9ogdr2TOsuoysHFUuTmIC VkX5S3qRSWfzHcfSvDUyfeG+n9LPPUpPZCQUC2FtmsnwFEKGwCTH7X2p2ENtpUQUnm8L 7UWuKp8CAYevaHvOdlhKdUZ9J3iDOeohEqTr7PcxcoR1t4gcTC3bqjhKEJkc5Cb8JTVF SKlTe1Bvhet5tx1GQi3em4989rIEE3fsxvrGcZorkdFWsVXdTiRbe2WSMtieLQGYdM2U ffI/gjwM0w2EVlzKJJk46BOeasoIGm8wVKQfY8o8om5ezf1F+TwrVBiU823QMz2V90qN sHyw== 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=+/T4cIWM0dAhnhIjw/m7a+fn4ePAgXVQbnkmBMx8NVQ=; fh=OYtm0whMu/gQaKrGi8HVCgwuhvzpwAHfKeadzKS4MlY=; b=teU+cg0iNrwvEhjII3TZH6M1aYls2hNNAHWvI0y6waP6b5AdepBf8B7Y+Uj+IuISRU i52DzSAXcZv0fUWQ0ShyZAq+pB94EVpCH177SarkTG9TTuJPaTwuyEkM6CdNvpZlA8HH wxMbo1bpx5CW7Gvo6LKL1Ievvmf7jTRRcOYvDtawrnEszxEW7k8rb2huWcxnM6pbGvyM 4b4VFqMVQmYhoyZC/OGVO1hS8mB5j4J9ZYY0N7T74KAIzCNr9UidBmLjkNxoTiDlYOye r2sD8tyl20CQYbki5olpnSnVx5Uk9ZP4DJVVUSExoGUgwjxe+O5oev2gfcQyDo8H+ETg id2Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wL4b+vkd; 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 a640c23a62f3a-a7dc9eb4863si907342866b.572.2024.08.08.17.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:56:45 -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=wL4b+vkd; 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 3B7ED88BA5; Fri, 9 Aug 2024 02:56:36 +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="wL4b+vkd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 54AFC88B63; Fri, 9 Aug 2024 02:56:34 +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 669D288B8D for ; Fri, 9 Aug 2024 02:56:32 +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-a7a8553db90so191651066b.2 for ; Thu, 08 Aug 2024 17:56:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723164992; x=1723769792; 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=+/T4cIWM0dAhnhIjw/m7a+fn4ePAgXVQbnkmBMx8NVQ=; b=wL4b+vkdTu82GzwxfSnlkoGXDNdSxyFwvzY8rY8IwC7In6OEAwrwprzuAutapJJb8y 6lzCi7xrxpx5CLbuvxNkTCyVKEs0ZHZA8WYTGs7makQZxqjKMUhiveafVXC++aVw58oH RQ2SBH8MNb87ghqmyai8lsK8O174c7qksYppzHIiXcfJQMLDV6FlcuMPDlMc8J6UhqW/ OryIUad/IIPStIGEwSqhSKgxshfib4aglEqHsZGTu+9sPyA76J4ME6CTzTDsJSU7b167 22py0zuVa3HSBH3aXgvFgJ/gsS1xLRq+0Uddm5xHvElpck3FYehGIT/sKR/SL3KlumBm bnLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723164992; x=1723769792; 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=+/T4cIWM0dAhnhIjw/m7a+fn4ePAgXVQbnkmBMx8NVQ=; b=b5NRjtiH94jHQ2jOKLoB2egpcpuwNocbsA0N0XkSRFznIeyhKOUcXkJPaYcHlayM33 gbGNWcqeRTIg4FhBpshTpK+OyFDFPR8AmQWSyl4GnIWA8sU1VWtvwtcGV99Z8a+kUTwv 7LvhOh2AAUAgCYTnbvK5cUkCAtKVlflB83l2FQQDlGOAR+7uFl6RYO30fw0EAGfRt/Gl lGruwTtMQgWTDGIgf8wf87ME+0d/kNwet85ynK1ircufSzwrcJFYN5xbCyUHns3b1dCs dOQgqSuhuHmM7ybtsB3OHtwbSpQM6HiY5oIXLeLTO+sxPVlvZ0P7j1YX1vMPNmqU9P6p q5VQ== X-Forwarded-Encrypted: i=1; AJvYcCWPeF8DGCVZxn/eVdExLVAn7ftn7MeNVghW4KB9aS1symV6/6yYepxAr0CGODWXrq3Or5Z3aJBFAIt8wJ8NQDyPRQi5zg== X-Gm-Message-State: AOJu0YzKDAKjT4+z7DaVX8pPaHPNlX3pXwUYxsGQX5S1qFKx69Y+7Wqf raEuMvW0tyA60KGnNujMhLHN3yBPFTsQAtrmmwOVoEif9BCrN0NKOrHJTzM0Z+M= X-Received: by 2002:a17:907:f19b:b0:a72:5967:b3a with SMTP id a640c23a62f3a-a80aa5a6576mr990266b.22.1723164991800; Thu, 08 Aug 2024 17:56:31 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7dc9e80e54sm790680266b.167.2024.08.08.17.56.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:56:31 -0700 (PDT) From: Caleb Connolly Date: Fri, 09 Aug 2024 02:56:20 +0200 Subject: [PATCH v7 01/11] efi: define struct efi_guid MIME-Version: 1.0 Message-Id: <20240809-b4-dynamic-uuid-v7-1-8c44ab1f06a5@linaro.org> References: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@linaro.org> In-Reply-To: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@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=1211; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=wX5DcO369Pdn7hiHbsWotgMj71dTc9VuhjXdEd8GBUk=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmtWk8pOGX3nFfx4dlWuMTO2bWOKWjavHnbBc73 P671xE0tvSJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrVpPAAKCRAFgzErGV9k tjZ9D/9ywGNaqUlFsj0UTAoPeqEi9mMT5d3MsDKuHfVf52Yr0mcjfPVS9TlnNk2OhVaif4z+4at Y6IeAZVPBm4z2ZqWTfHMSbP9j4awrQzy1rIFsQIpoh5IocqENITD67CsAisDHNbkgCSNDJetBdG 5T09GJ+fqtjNMYEJ8ACuIK0ruljdceC62VrwXVPATFd8N68Gdrt3pP3hoVZyC67HD9Wndtdn3f2 64yyx/DnqiLKf808s7MypJLZfPKFwv6pLIdrURqjomhWM4S4W3aKxdNQOfC92EyfPy5ZHzDWio+ d/8COPM8rpbtZjquC7+QhU6oG9EPC/6PceAtFo6DWwXwkVv3Q+G5icZn1elCFjJN+aQQNJCMx9r 7GFm9lTs3fxPZCGBEWjoF8BQ1x5IA1jyq6qUNDfoM0pk5PmmtX3pwLHJFGHT0YTKJpvwcdyl6O2 oI5Cnu8Astz886rVL6GHVZyH4gWCoT00b70wmUM5Df2Oe1e3a19PQIjLrFLLIVJjy4+kcX8SzJk yKA0qIMWhbTZC72FbqxfEp6fMxilI/VYvOonEXous82XaERZJAhM9gYDlIfai6QfT9tfC6RVszw CGFuI0jT0MjLf1I9+9WcifbExORQlayx7zMRkQ1PRZ/MAmeipXdMJUKsSqaZvxtdAlGzp+I3sDv 898iunRN8g7r88w== 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 Reviewed-by: Ilias Apalodimas Signed-off-by: Caleb Connolly --- 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 d5af21399468..84640cf7b252 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))); static inline int guidcmp(const void *g1, const void *g2) 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 Aug 9 00:56:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 818099 Delivered-To: patch@linaro.org Received: by 2002:a5d:5711:0:b0:367:895a:4699 with SMTP id a17csp89364wrv; Thu, 8 Aug 2024 17:56:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU+g16jcw73Vio3vlPv1XDJqnabotAUX0+AM5xKFXYjuvr+DOUtFl70fMDXEBHOUDJso3nEfAvquq295cU53u89 X-Google-Smtp-Source: AGHT+IE36RALY/lN/V4EUX/4zEy0S8zifb6DgMEbDMajkiPhkxO0UwaRLfppVZQNqFJ9JP2JNE6J X-Received: by 2002:a17:907:2ce3:b0:a72:6b08:ab24 with SMTP id a640c23a62f3a-a80aa542480mr1306766b.14.1723165017984; Thu, 08 Aug 2024 17:56:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723165017; cv=none; d=google.com; s=arc-20160816; b=RLt3IlJSB37uXjsGwXqbTwGDJl2Jt3mvN3sDPXLIgXtUCPPvgqEcoRVgM+3TKJBc+B A2Sl6KxL/U73Z8GYN5zyayOEj78OOWjZnS+QGCrGtuj49pXMWY45+/CMDjfROmrEdL7O aeNgoBuOjz/KRT4T4LPIzIk8kQY1X0eNDLcWt1F+ibmxSoGAPHweC1zN1adpM/TH2WM4 tJCklLJvMu7Xk1WQOLeMIjlhssgC+/V5+wF/yNE2zm5KymSxwPWRaA0ug4395pJcaYIF WLCS/qPIgL8asTU53PIa/cQjqCyy8IDmld6l30higkRdnE6Sg4b0rjlWBCWJA1rXppIR FQ5Q== 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=egA3xRpkyqDRzibem82Wk57TPGhBhb+v8n5ItP4pcqI=; fh=wQOWrQqqiptQXUP2qmCqOkklso/vMNi9D43Epe16QTw=; b=qppRTh+tWgy+mfJc3vKkC0KH/Jt90wvai3qclyvf/4u4xSwsjK2Ywt/qlRcCVkavjI V70IAmfbxm5qMdFaXJ4C96A6Mpf2Hre8OnLzEA4wiMQfLR83tw4uQyW6pncIOv6ydQDX LTZEYRoaLPOj/c3K5lyxBQ0lJjtku9J2MmkgQiJuzR/J4M0mCDeRUH8lKKUNH/DWsNcz 5PlZAve0SxZaMsqlti7IvnEFg0mrlIwqHDouqi4d8SCQMmMN+FoR9LZojQ+z0yM4vDJi 5QFCxzlSSxDsT54hYdxnDmrVEAU0X7gAnCd9MeKLeAqs6SpnoWvWMLfUscdwY1+2SeYC FWiA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="xW1UebO/"; 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 a640c23a62f3a-a7dc9bd4e01si842092766b.88.2024.08.08.17.56.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:56:57 -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="xW1UebO/"; 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 9C04388BE6; Fri, 9 Aug 2024 02:56:37 +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="xW1UebO/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F06CA88BD1; Fri, 9 Aug 2024 02:56:35 +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-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) (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 6C91C88B9F for ; Fri, 9 Aug 2024 02:56:33 +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-x634.google.com with SMTP id a640c23a62f3a-a7a9185e1c0so152608666b.1 for ; Thu, 08 Aug 2024 17:56:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723164993; x=1723769793; 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=egA3xRpkyqDRzibem82Wk57TPGhBhb+v8n5ItP4pcqI=; b=xW1UebO/JBG4AdfdjR4AtTm6dd3zWNJ002we3lHyhUAONKAid7DD8QzEgkNUTv6PJt F8cq7jYBKBEIOgw7irovxBV3TIplY2Bl5LNECERqFkk0E//klevnWvk+1ifCSOHKlvui zROieo9EerTqlcnS6vI+le0tZCHA+b3ABjYpTdNtM0tStRFspzjXwymR7Li4N/5Q84lg ydkvTvjKJzeiq/cXfEDQTR2dtxfUVtJmNOKCFRR3fu2WqTXjH9DegQWHvKP9zeaBhAWG ZQndTzPrcIWRAuJYd5EvE7MILl0e/xtiXMh8mnDQbsu9n/41ZpNEIsis8c70C5JrRtVd QB/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723164993; x=1723769793; 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=egA3xRpkyqDRzibem82Wk57TPGhBhb+v8n5ItP4pcqI=; b=HcgEEbtnnN+KJRlc7Ui5c666cO6AltoLIgkHVFJPDEQl22xO8Q+Gu4OgOWoYEgxjWm eId3YzElp27BUMAQOxlwm+qwYWz9XYjBwhR2VhKezfvZUyJykEKNqdSioeHHRsfFmtTq tsgOVCP9sDJf1UZ5y808VHiV3yUo6c4pQSKh9dmqsD/vaejmdSNxOIRxRs3jNGgD1Kzb hiF2Wp4WsGwEXc6pZ3jXLpz3MPGeeOT/6dy5bOC9hwi71ON/PdXitzxzgJNeoArLkUM8 Z+qEeoWgjkeq4ryuj8wlgxR26cX6ExsnSbD6qnIbaNNPhkNLdPjjfSt6sNg6G/12kKDg ylXQ== X-Forwarded-Encrypted: i=1; AJvYcCUTjX1v4+g2A76zqgGkuR8MchlsYp308JCF6nsCZiW8CdcEgQOal5usCgJpeZtJmoZAzyLQORCsjVtJbdxkTTo6KVXSbw== X-Gm-Message-State: AOJu0Ywx8TpqyFzTWfM3+t45mmKfkEF9FsUK2gAlwJCjcl9p0WziVrax Wda9RPikBHyQFzzRrWkW3KmwjsFzyoWzHbf+7xFcWlTrYqjRtKP6BMrvdAW4wVE= X-Received: by 2002:a17:907:8690:b0:a7a:847d:63b7 with SMTP id a640c23a62f3a-a80aa67b2eamr92366b.59.1723164992847; Thu, 08 Aug 2024 17:56:32 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7dc9e80e54sm790680266b.167.2024.08.08.17.56.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:56:32 -0700 (PDT) From: Caleb Connolly Date: Fri, 09 Aug 2024 02:56:21 +0200 Subject: [PATCH v7 02/11] lib: uuid: add UUID v5 support MIME-Version: 1.0 Message-Id: <20240809-b4-dynamic-uuid-v7-2-8c44ab1f06a5@linaro.org> References: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@linaro.org> In-Reply-To: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@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=5441; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=JSqqjukXOTthTri0V10jRsBkn3907XaleehDt877lBY=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmtWk8UE9IZvJrFc+fG2gpznFdOyqNTWDT2SVJ7 jfKYMjw3ZmJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrVpPAAKCRAFgzErGV9k tmXqD/9d6aQss7/Kl9KwDShdduArvb90ka2+nX49xpsvlEUosNMCcidS189kHUx/fEJTem9rMF0 grujOsXiJGCFj5a8nrdxIH6k3iwSqSGPt9BjreKw48tBfw4CQxHvMy5x0YgLUVbwXsnI5b5wrp/ P1mA4JE1/s48NrCkcSApGGVHdM1M1MO86alJrYCGF7kOuhTNlMGOI1SrlrjWAtYPkFV3ASYHeqj C50amPorCojAiS7DGD1/zHQsR+vAVQz8H0wrzXv+Le22idUqlv//cJNoS7k2y5L9kZHMBuuUk2o uLRz3SAj0gAz1hu/eGLm0bDEn6+l9Nc+XvzIPCvg39hJbrKN++AqsSlKbZ72n3UfmL4c8UH/Fta gIe29IZJLoMbipfv3tX63ndxPr3P/ATzrqa0hGvUXopZUZ3bY4g0nyqSriOyKGYHYMeuU3EBFtV m/XGMlD56nw5BHcOfYhcVENIOqSgHV/3djPtX6hLBsT87wwTwgodDnKRiIb0vn7aOUNYPbYZbOU Y5u6ixE/ax3hW+06q1SrIFCLQEtHTPb/sDqJKySL4GKZ+sSQW29XHM+3uj5Il8kl8v5z5+KeYt6 heOtI043mlkGbKANvKtm0JY5AD9OOyGPyQEMPjFmraSBLPbdEdUMeucFvcJS+jbWI9ee0N/EVya ZwtwHNe1BL23ALQ== 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 Reviewed-by: Ilias Apalodimas --- 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..24b5881600fd 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 = cpu_to_le32(be32_to_cpu(*tmp32)); + tmp16 = (uint16_t *)&guid->b[4]; + *tmp16 = cpu_to_le16(be16_to_cpu(*tmp16)); + tmp16 = (uint16_t *)&guid->b[6]; + *tmp16 = cpu_to_le16(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 Aug 9 00:56:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 818100 Delivered-To: patch@linaro.org Received: by 2002:a5d:5711:0:b0:367:895a:4699 with SMTP id a17csp89398wrv; Thu, 8 Aug 2024 17:57:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW3c72jFg1gH50AKET1nWtk7X3EABMs53AgJ8qJ1FlOQqLbxxdSXYHXylC8goblyevw6kOxX4QU8alONzzd0pj3 X-Google-Smtp-Source: AGHT+IFGL0cqfpp6A0wRSc4oRgus93L8qP01cZbOA3AkH5JFWKpS2BjGTlpgRww0/GGdkED+gsx9 X-Received: by 2002:a05:6402:51d1:b0:57d:d59:461b with SMTP id 4fb4d7f45d1cf-5bbb3d0f9e8mr3055943a12.13.1723165030348; Thu, 08 Aug 2024 17:57:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723165030; cv=none; d=google.com; s=arc-20160816; b=bFxzHzbPdl99y2zr8UobRIyL8JWyVKtctHfeS2QqLFwhja36VaMBhGTqgve5NaBhvX VmEaD3Y6ZHRTCFsxVskDzu0geJASDQ8xCyRlMyZwTF/0PROz2L/9IJ1WAc6vh73zxP45 8ggamK/5Ye+CKlbjOxq9/pS/TvtZ0LOeWUmT9zD7asQqQJxSZlx6U1+iisQaFU44bKBn 5kYkLZYFcipFpy7Jm0jcc46Es/wgv0Oyfx6FTsrRCK+QU3tiMy+bNqzmM4C1CP+DGy0Y BSZtx2vmeON5Llj7ykGOnjIn1E70YT5np3hACt8oxkusLSj6ELfc7zOtVDOhs/pFbwpX EUhw== 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=gIscCG1WFbxRNqwDTcTD0Z+2J8C6jKPkaxE8BsmFV/U=; fh=au2SXX3Hi0mV6yDvPYGD0gCohtFxH6hKNmMWI42NSbc=; b=Yl+bqZNd1BtFJUrrHQ4Fbd2ehUM0Z39VaQYpT2FfvRr4wpbmkwkQDWC0FEH8AI1P0O GH/oeGEYYGr6ZIO5NwkrV/WCXFNogLE5K/gYMfCNjOkQdYH4R2nCS4o56g66U6ah2X7V x1x+RuTx2HxRuDGTLruFhs8/6NPKCrQvHLDo582i/a1v2sw7vtBODiLkmQUbwee8w8Lu 67sJK2dJ27TJgvALmoPXk576jGjGdSWAfHX5QdxeI91YL8MZ7Kw4uJ/hw4oNse7U4r46 nVOfOCOdoqI21hb8+JJmrgo12N9DQ8LYuEfTqor8c0/KK3FY5ocn1719aPIN3xFltVFe AlCg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="LJb6jb/y"; 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 4fb4d7f45d1cf-5bbb2cfeaa8si1412758a12.327.2024.08.08.17.57.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:57:10 -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="LJb6jb/y"; 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 1E30988BF9; Fri, 9 Aug 2024 02:56:38 +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="LJb6jb/y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A099B88BB0; Fri, 9 Aug 2024 02:56:36 +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-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) (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 914D688B63 for ; Fri, 9 Aug 2024 02:56:34 +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-x533.google.com with SMTP id 4fb4d7f45d1cf-5af326eddb2so4279780a12.1 for ; Thu, 08 Aug 2024 17:56:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723164994; x=1723769794; 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=gIscCG1WFbxRNqwDTcTD0Z+2J8C6jKPkaxE8BsmFV/U=; b=LJb6jb/y572R89DpTiN4DrB1+eiImxCcqwf138vhY36eQ4vm/1thN12oM9LmI2cFqd VU65bNEKe9WLA4vFkSxOAimRDw+ZzGjWdr7uoIXksjXP7UvIKXFF0Bnw69k5vxXkg+UC j1ySnXoViH2wtAAMzp1LUryJzVV6/c1mXyuvYwgXqQWs/CJTMBvhfQA97KkgcTzhUF6e gdKoCvFLWSKhcXK45CjDIBKC28jsVpO1ooCz2hujyPMuQkYXvdZaiCd1b6t8DgzXRCXZ YI2FL1zVSE+El9v246xejFIN1iFEUrrxhd4ZNx/keQHhmFPjp3BqxH+EqbrGggXINqWH G9YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723164994; x=1723769794; 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=gIscCG1WFbxRNqwDTcTD0Z+2J8C6jKPkaxE8BsmFV/U=; b=GAKFLOOLajV7APlVXxeczBTLwCGK6vUOn0/GrXw+cfIw21JiIlgI67WEyzVtA0hdM8 4mjfkAh0Itak08JUoqeMwV7zYL6VvHy/pbnQgSHruq/d/YmFdKY06Yf1LDh+rd/tqihb x3QJkjzUa4FI7iLScVI7fQmYVUeND25rbq/QyuIOoLGrGRjYPM4VUT1YpalW4W2qjon/ Me60E9TuZLrnvNyyMR6KfVadRKPhGRN8dvVXMHatn4K1IDrvHajl1uS/puLgHy+pyfsm 7mjsCwyaSPu5WArpr/qiF6m3BXV5wAzq57UaG8mVrDPkMt68YNt4HqauCp/L2naokovj Jj6w== X-Forwarded-Encrypted: i=1; AJvYcCVRcCUscOOv/0zq3G/ucHz4n5FsrJx/E4mh76+bmtorRVHFCySGUoTcSzR76lpiw/EeZbb6e4TrOWukRHnHHFSEikveRg== X-Gm-Message-State: AOJu0Yys/wCIRlLuiRCnlwWymkZuBoxCBZ/8inLepVi2qkPxz94cMrMz 962JSTrAI4nIhfWV3WhUQx/E+ZxW+IckTs7J7cMgN927u3hBFXDFOzZZDgVwtig= X-Received: by 2002:a17:907:7256:b0:a75:7a8:d70c with SMTP id a640c23a62f3a-a8091ed6f3fmr286400766b.4.1723164993903; Thu, 08 Aug 2024 17:56:33 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7dc9e80e54sm790680266b.167.2024.08.08.17.56.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:56:33 -0700 (PDT) From: Caleb Connolly Date: Fri, 09 Aug 2024 02:56:22 +0200 Subject: [PATCH v7 03/11] efi: add a helper to generate dynamic UUIDs MIME-Version: 1.0 Message-Id: <20240809-b4-dynamic-uuid-v7-3-8c44ab1f06a5@linaro.org> References: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@linaro.org> In-Reply-To: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@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=4865; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=dusThMI9yKohZk7FRpXJrRXE4relVzw/dtal3KcFB+4=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmtWk8BkA+Mppo3GlXF9wXF5Dn6AfCgkUr+PptN hu/l7zmeYqJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrVpPAAKCRAFgzErGV9k tgCpEACX6GiLo50bdnhmVX4Qo6gBoICTXVbHGE8D6c8x0dK0/BCBze9dIfQ2FRLWKaTlmizPnqK LhFuj7K1bwu6ta89N7CgiPpv/Rx3nFpe2x7wHwUbSj2i3/1NQKyqayderYJI6wfl9AZwMmqOqEz irZKJWiSh5qISIwcn89zsdGyD8rT3j5koV5BAwswvJr81PunbYbDLDICE639zE1xX23bOJERJh6 w1NX7zwX3R4IRJEz3qtombFk+16JR8DlUZtm8I1xBd62Qml0fqPqZtYVQeEZcjbYUtACUQ9mISB 82UpUDL0GX+j/ZMtmhXuHNJybOgWjLq/AatKxjh15nTMvbfnVwYCdNHX5ayT8/kIGQsIIc9CtuW aEA9BFwnxtkaBuxp5RTdZRGrIJbD2rsTDydmnARgU0fMYK/h9dinYlhnJXyquJU+1YC4lExh8GP LLLGilL0RufUBWmN4mD/lciQG2SeNZQpbHqEqiR1+plBG6Sk2BENIYUEgh6t06pTH6H7lzAF1oh q0OsjkX5u7MpobgD+Nwgza17q81HOlQJDclRVnqPbsIg7I8QuHqDup1ztbMqB6NRpy3fZdQJyOv dFf3YMOPpfuVbgeA2oAAQV07A+WnGxD2QzJxI/LBU/eCkkXMeNHZLPk9AUFfFp9IEvCJY6woFcD vOmUzqwEFKv9V7g== 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 Reviewed-by: Ilias Apalodimas --- lib/efi_loader/Kconfig | 12 ++++++++++ lib/efi_loader/efi_capsule.c | 1 + lib/efi_loader/efi_firmware.c | 55 ++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 1179c31bb136..85a31113fcf0 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -236,8 +236,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..c0240e95cf13 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_gen_capsule_guids - 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_gen_capsule_guids(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_INVALID_PARAMETER; + } + + compatible = ofnode_read_string(ofnode_root(), "compatible"); + if (!compatible) { + log_debug("%s: model or compatible not defined\n", __func__); + return EFI_INVALID_PARAMETER; + } + + 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 @@ -271,9 +320,9 @@ static efi_status_t efi_fill_image_desc_array( u16 **package_version_name) { size_t total_size; struct efi_fw_image *fw_array; - int i; + int i, ret; total_size = sizeof(*image_info) * update_info.num_images; if (*image_info_size < total_size) { @@ -282,8 +331,12 @@ static efi_status_t efi_fill_image_desc_array( return EFI_BUFFER_TOO_SMALL; } *image_info_size = total_size; + ret = efi_gen_capsule_guids(); + if (ret != EFI_SUCCESS) + return ret; + 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 Aug 9 00:56:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 818101 Delivered-To: patch@linaro.org Received: by 2002:a5d:5711:0:b0:367:895a:4699 with SMTP id a17csp89434wrv; Thu, 8 Aug 2024 17:57:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUei7znx7j2gelF79Zz9nzYjyf31tEc14L7WtBsoHpbdOus68aikkAxdFtECiRbnFSv577nyfc/L0inS1XDmCrV X-Google-Smtp-Source: AGHT+IHfm3/ple9GyRgBliKt2sx84xaypkUw1ZjI4B65n02ZVyQNmaExiiBJgRwtiwkHKcQ/jdUO X-Received: by 2002:a17:907:7204:b0:a7a:a06b:eecf with SMTP id a640c23a62f3a-a80aa53b6bcmr1294566b.3.1723165041996; Thu, 08 Aug 2024 17:57:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723165041; cv=none; d=google.com; s=arc-20160816; b=GZznFcNBtlUsbCcrBKJruJJrRnQx0yT2huHc9iF9TWPZfbmuR6PgEmJ+HDF+x/jePc A/woyQoBKt3lU9eeNXXC1mmUgOMH+kMGVzg0fW6HIsZnWzus3n8suvPoeomD0FCFzpP0 U7i+2uqjhsT1g7FR0Gh/Y7XC41udH78xRN7yNd2zA7B57LDkcjgc5u0/ymdX1n2+FZBU MyIiGvz7Ud0Il/MatzXxdESJ36ihxyB+mI1t9VX0Sh3oVaRgS2EGwjFbssW7W3o2FWfN 780FLVYxSi335ymK/7+krzwsHwx/YpTbTwJejMYIEyE0yOJx4PhPdn2M/jrDpHZFAx2j 6+Qw== 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=XceLW2XqiE7wRlBCScaaKGd8cI0ULr15gEOnMJ3F+Ro=; fh=lA/ssFwW9Mn6s0U90HRVKt1MJwZEYG+9uhnxxTwM+2M=; b=CkiACxHYJhVx80/tVtrWtezBjJ6WhMxYob2CD5d7+TqTTqegsYboiW6q/sZwJv7kz0 5B/qc16WwK90z7+JzvczPNxTDLADkyA4bgtl1Oycp0oEC674vsNW70dFt1DiEwWOgQ/2 m4wbVIWjKFAV9vWF5OtGO6mqxcpb4Dazt2rOhAP/VPpJD9/XZRuSt/pW/UuYBz6CSjez K+oDQ1ziBz48zhU9vr2OuPgfsN7amHP+vKVFwYEkuMDXnrY312iqSR9/PJAIMVOd834Y LI8ggRE6zHDAOTjDvEluJPmpwJPcGydYQ9OdbLgvWS7ZRQFMhETbMQOz4K5g1H7bAsO6 PLFg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="x/iO0nDf"; 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 a640c23a62f3a-a7dc9f12ed6si802427966b.703.2024.08.08.17.57.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:57:21 -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="x/iO0nDf"; 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 805F388BD4; Fri, 9 Aug 2024 02:56:39 +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="x/iO0nDf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A9A5E88BEA; Fri, 9 Aug 2024 02:56:37 +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-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) (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 AB36C88B99 for ; Fri, 9 Aug 2024 02:56:35 +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-x52e.google.com with SMTP id 4fb4d7f45d1cf-5a15692b6f6so1728879a12.0 for ; Thu, 08 Aug 2024 17:56:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723164995; x=1723769795; 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=XceLW2XqiE7wRlBCScaaKGd8cI0ULr15gEOnMJ3F+Ro=; b=x/iO0nDfJ1lFnUUNB7CGZ8+0ffWubeJijPifvtlGDHRkUqqSkwK2ZRynCR/c7Bw36x GfnU73xQbuc8Gw+Tyyuy7188xGUZd+B3D4pCeXXiJaNg3b6BlEpYY/gTdZPKpk1zeQxf kXW2+vrZwkKv1bJAxU2FXVTdIOlMXLn2lBaHJ4wsq6wj4Kwzdl2d0vEgql3G99B6Kzr0 /JLgnwImOf8XTOwKOVPko5uqXO6vA66qxb70+MrTuiHAqY/R7QOa2wLopSnj6SiqFAdV hsrCp9HPI0DH1Lt33E7CYd5oYKQXYSxHoB6wQ5Dv32+mw3IRfBJi8VlLTlM8LQl8wapO ozhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723164995; x=1723769795; 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=XceLW2XqiE7wRlBCScaaKGd8cI0ULr15gEOnMJ3F+Ro=; b=Jde/+cHz/nqIOYOuZtGo9eJocW4IgJsNoEqA3lef3HkcdGEUrn+5nSW3ogthCVc3jU Bwd4TGzKYwByvAFCzLeycdxRAccmwnyDP9B8K4V8rdWU4PloeeuHGkPru1o5AlnE1h7x 85NtXr3OwF1ngP025giEiusOQYeokN0AypbzJQqIum7HxxSkxd32ppeTN3Gmi9mmRtWk ZBmjRG/4aVPPt3JciTGn7rT7PRTy1kB7wa5ReWl6yiAVQpWudYV0UuHVpUGee75G45L5 TMXlYMd0j4l9tjduJl/FwfRrvAiH/f8JvU849imm9eSdZv4wU67jQmDTVVc7EqH0Y+pO Q4gw== X-Forwarded-Encrypted: i=1; AJvYcCVyQD85y3GYvqWtmqi74vVP3+dnL0l4aoCIr+eYiHigv+OBDtYzpskHPRPmIwqM+ZdggHQfNPjan5+1GSDIayvB56aDuA== X-Gm-Message-State: AOJu0YztZwdL0zohLftOi0h2JuxYQ24agI8h62ZV0gHpacC/2ocuXlNZ 4js0k6ByE2ssPf/PyvWHZU6+KuS5CxYRACA64JbJgmCUHYUM3Vd2OUj/zlwl6Vo= X-Received: by 2002:a17:907:f1cb:b0:a7d:e41e:6bbf with SMTP id a640c23a62f3a-a80aa65eed5mr369566b.50.1723164995007; Thu, 08 Aug 2024 17:56:35 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7dc9e80e54sm790680266b.167.2024.08.08.17.56.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:56:34 -0700 (PDT) From: Caleb Connolly Date: Fri, 09 Aug 2024 02:56:23 +0200 Subject: [PATCH v7 04/11] doc: uefi: document dynamic UUID generation MIME-Version: 1.0 Message-Id: <20240809-b4-dynamic-uuid-v7-4-8c44ab1f06a5@linaro.org> References: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@linaro.org> In-Reply-To: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@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=2228; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=CnoU4+NAjPfmPO7lw0mrd3Kf+j79o89BEkFbYPucAaY=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmtWk8k48ESrmehsCSJB29SdV+aDDseXVIkgoSR JP1X/1lUjuJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrVpPAAKCRAFgzErGV9k tqK7D/sE+kP3HFtW7I8QudEVkVnyyL6gg2SpfUSjcYaWvHtGkF5v7Tf4fxSze1fBqc2mkyLn7Gh hq1LSOvVsEqRtGqhGpk3Lek2Ma42LDydklZ/YY4PJMGLhQ79bOD8+3IuCokPI/cPAjBOWRtPFNe NVZyWmyCdVmkmUvgzFoyd2NVhPjJfUulEw2A29OPI4sKX62Sqstaeb1OStk8sHqJS5KkCUqrF/q NL4hQGO4UAIa0bgMFkRj4ydO6C13JhyQVlRqDZeR2NpA1iMo5x+PN/aCiO40EZiaQZc+VVPEmig fDHuyZ8w1JDQEhw1kdtp4LttvNssm5UsW0kbu7T4PtzRZpot/Hiw17Vm0nJsggVvi+4X4lacL8w webPa0PTWq45Sro+pV/zaYxQqIj44K8wyp8o22YGuJdGDKbtx9fbYg7+M3novXxncmPXaXeFEMq 8uC0wBqftBkY6jXFWS8cyqRtfVjgIIHJ2xX5VIa4Qd2KHlX8F0H/LfZZRq+3CH8Iu3uSpoBYYGd yLQgx1ZNYmArsOGqwEuONY/eajRSe1TNhjbPxjeFPZUZ6hCVqB3kp6gCZUi86rwKy125OmYQHaJ JcqaZa9GzAGhtfb4/Xv+HrgYPRGdw7/bY4vNJhP3sA+wU8cUloAxB+ByudKUnJktEJtGGeSB30g OTerNybSWhnX4tg== 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 Reviewed-by: Ilias Apalodimas --- 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..b64009cc2256 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 Firmware Update 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 Aug 9 00:56:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 818102 Delivered-To: patch@linaro.org Received: by 2002:a5d:5711:0:b0:367:895a:4699 with SMTP id a17csp89463wrv; Thu, 8 Aug 2024 17:57:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXO+ZuQuJ9YqwKkhIdz3MJIe+rd3db9U0YIPqrzKFQqNUZhkER9lU+KZQAUfxhXa+MWIPkWHXxMN85G5qllswEp X-Google-Smtp-Source: AGHT+IFV6fU94fgpbn5gBghgXz7rIOt7zKoBZCeNyZ0yGe5jzRIkGB05Alu/LyRSr0hvbqrZBTSD X-Received: by 2002:a17:907:e653:b0:a7a:8e98:8911 with SMTP id a640c23a62f3a-a80aa5e5730mr866266b.38.1723165051508; Thu, 08 Aug 2024 17:57:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723165051; cv=none; d=google.com; s=arc-20160816; b=sk+v8gqkYaGNBZMY0aXcYigdJ1WGgUSgR9m/13VSqswIUdjWiFI0IjAu1mKbGOrlSn L0GOr0nudOkF3k8YSF7hKltRUdYyOlFD3t1sg9nKoYcTgkIKd1ygTn7ikoYPJnz1z37b 1Gx5se3d/CuuDnGkMmiWcZNgPxY67qRU44d4jhA6Qc6VVHWC8jFEMFJxchUuROK42z0s xiw56npIYMZNhnEsXI1h4ncq6zBpVw9WT2HdkuHETYORwL1bwtPjJh6REzOCqins4X65 zbP8zTsqhj1WrBjQ4/9yNIiSdhqJ7RKW22b9Focq7bittR5j2kT8yCqaMg3QfOfW5YKh bozQ== 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=R3fNXm5Eot2FvdfdyhfEXC5+miWVrUR26Z5LFqrrLag=; fh=IhOMIuLeeAH2k2BpYA8X7YTYBkL0yiu7jWJypUuO+lU=; b=JAKiBMdcvJs7QNbi/H2xQTbRm/3ZxgwTL1fXEY4LtTU41z5xvwUWnTKngNO7RwUxUD +0BROIwaFrMHB4NE9EE6kWFFgKrenI6CaMoZm7YIk1blp+WGflAUSrc0Ck2GtG7pzFai dC7hD3ap/Etja6ftRhaFYw0C4sBw0ur+Jjc/djY4O1S+cqTcSWbmerEoVbtb5V+wbFz7 wabtLpDnMgZhS14ajqgLODN8HV/9eiDSlS5PqHW/kJarualSqbsTvAF5XblAGG5WD9qp ZqYg7rsMXeuUzi+u1FP87mU9xg8RbKIFnRTVmdTPeFdXXjVEdnvQI/8DH9wXeSLe+HLZ Q6Ng==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SjAOu8Tx; 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 a640c23a62f3a-a7dc9d6faecsi869119266b.432.2024.08.08.17.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:57:31 -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=SjAOu8Tx; 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 E438D88C0F; Fri, 9 Aug 2024 02:56:39 +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="SjAOu8Tx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F3F7088BD1; Fri, 9 Aug 2024 02:56:38 +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-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (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 D506788BB0 for ; Fri, 9 Aug 2024 02:56:36 +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-x631.google.com with SMTP id a640c23a62f3a-a6265d3ba8fso132936066b.0 for ; Thu, 08 Aug 2024 17:56:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723164996; x=1723769796; 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=R3fNXm5Eot2FvdfdyhfEXC5+miWVrUR26Z5LFqrrLag=; b=SjAOu8TxKgCpLsN2M1yRvCGgUbj1ajZ0K4JUT6Xr9PdPsyf22ysK/nICZLLe6c8CAi uQwXpJgEJ91KXquuh/Y4z8oIwyf/HwwSWakG6T4pd0VdgpjQNwQrCdV2WaWUs7jZG5z9 YzgmagoNUAIjt2TZlaCaE7S1ciSM/tj5nQa88LeFylO7NCIFP3ra2XQmOSF8EeKMpagp 6nvj8UokrW2qmRbM0Vb5N42BfIVk2ZdZwskRVwX1TsXObnNY8KD2vwSXaxSOmgIP27Jw P2hu/oVzRuJlPS0S34hk1g8i7RcvpmVqY7Aqo/iFG2zteX3hjOkt5FBeRkXE1ziYafqs 6kTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723164996; x=1723769796; 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=R3fNXm5Eot2FvdfdyhfEXC5+miWVrUR26Z5LFqrrLag=; b=gMbA7UUxltZI8MiDl8MBLUim/44ic0Gl9WXLGIWiWFBxHp/89WE23NKTZhWZffWCxH rWNXNaXwfiQvu5dwkOos91/1/6jjJpKdDjrF/+YuMDd0KOqOTB89fT4Kfs8XgelXk3uw FCz6ouG5RN6znMXNCF5nang4HGUcy1rIXSuR8zQ1s2Y2k2ibXTwRQW0UCJU2Yle8PIto DGYhj03ZWzRowk704AsA3apkTGoBKFUhqa/owpPhvj8xSmAZbqrGTVY/j2G9/atK8a5k V0JSpnySDvgGYq/BezhFdlId64/GRKRdv+Fr9SDyo5HgzXcC85rSziLCFCuB8WzbkiBs mq8A== X-Forwarded-Encrypted: i=1; AJvYcCVMSd4TlMyiF90rQtVU528JCw4Jn2Lj2keIV4M8mmW/aWxaCVtQzcYYvR/aSNZE4X8lI3slA3tpitS8dYGQeR39CF/heQ== X-Gm-Message-State: AOJu0YwHFHatr6mK3NmlvcGmJbMO4rQw+CF+6tKxLAEuBqCfwwgkD6D1 FasSKb+LHVZkJWEJy8DClI7HAF8SXl1gZ3TJmYzlbgVnWp++ReFyFvucJ3OJQF0= X-Received: by 2002:a17:907:96a9:b0:a77:f2c5:84bf with SMTP id a640c23a62f3a-a80aa54fb30mr958066b.2.1723164996199; Thu, 08 Aug 2024 17:56:36 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7dc9e80e54sm790680266b.167.2024.08.08.17.56.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:56:35 -0700 (PDT) From: Caleb Connolly Date: Fri, 09 Aug 2024 02:56:24 +0200 Subject: [PATCH v7 05/11] sandbox: switch to dynamic UUIDs MIME-Version: 1.0 Message-Id: <20240809-b4-dynamic-uuid-v7-5-8c44ab1f06a5@linaro.org> References: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@linaro.org> In-Reply-To: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@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=10634; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=kvFOlfiiZPFPkMLijvRkNhuNuQX3WZhbH8J41MieVjc=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmtWk8IenX9hZf8/62rNnNPBXamDpBLqZhBqVyK /M6LqXc8bWJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrVpPAAKCRAFgzErGV9k tgXJD/9faAmcgOsjJhVzLvKdZTSMXTVKuOklAV08t/DOJEfgxlWMOnA+IVZzcNGYSe5wPJ9fb8E UiPCCRxAuabKJ577ApjuB64y2c8sb7aoMR8jP0uejAkEpRJ74BaF/V88oCe+ZFbkjH66ZwivW6s KzKNHRDyPU6C1gasLiFs/lz4R0vmlFStFlbJAaEQwIGuwZTFh6NKpnOuqj+mmsulTujwdpzo9n3 U4ZDGSx9NVtFfcGTLK8nbzavBFpWQPP93Qxuc/Bpi6Nh42a6XqphBj4ay6FfT7glAYQxxNNxSsF VFZYpiagqHqi9cp0pnqs68zxm010ZWF1exHWjvRhjdKoIct9FMY+Dzdsluic5xFEoxZiMt0gKfS Wi5ogUIvN/tjOWyt7b7PqrBtOBQABzhabq4YAMAXm6EpsogHoatlwr8CWkB7cmHYp335co0K45E wKD1zkcA1P6R6jmXQ9BmOrQNsg7eZTuvdsytdIdyfBnIdRUGgXydOrTR0MRdzUhPKHVPfmhH01Z RGHCl8DE/u+heZ0lxkXV7ZKiN5aaccJwrMSoM3DFePpcOTPn2ZzXHA8iyFDUiZgOPQzTh/CdG/2 vIIJnSIFHQrcCEPq18vV/8w1gG6suIPSXa0shYHNmlPicgMTs18zLwNDtzPZYdxLSXGXMyaT3qh rd8E3zuA6nzFcrA== 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. Acked-by: Ilias Apalodimas Signed-off-by: Caleb Connolly --- 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.dtso | 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.dtso b/test/py/tests/test_efi_capsule/version.dtso index 07850cc6064c..3aebb5b64fbd 100644 --- a/test/py/tests/test_efi_capsule/version.dtso +++ b/test/py/tests/test_efi_capsule/version.dtso @@ -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 93f3d22cf573..2577c0016c0c 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -124,9 +124,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 Aug 9 00:56:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 818103 Delivered-To: patch@linaro.org Received: by 2002:a5d:5711:0:b0:367:895a:4699 with SMTP id a17csp89505wrv; Thu, 8 Aug 2024 17:57:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWsirNQEN8oxeLrwlTwwsMiWWKeE+lax779zfbvRUjauOgyd0bfGKZzQEUFZCTEPj7WPIS8arvQOYTvKEiiWM3v X-Google-Smtp-Source: AGHT+IG5P9kQ8y3pWIyDGRbT24vSFSrehQ3VG3Hq+/A2Y8QtbkgzpogP1IGQ4gqAVrYiX8cMcg/Y X-Received: by 2002:a05:6402:2695:b0:5b9:9af5:c50e with SMTP id 4fb4d7f45d1cf-5bbb21f3b44mr2607188a12.1.1723165062089; Thu, 08 Aug 2024 17:57:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723165062; cv=none; d=google.com; s=arc-20160816; b=huC53dKxDD1yIUG+8zvlpHB7ewo77L0ssybTCQM1KRgKN64LdkpowtUZZ8mj4QYMu9 o+FKvlWcV7DQ1ZH5MKOHE8P3Wuav+3/yIftcHFBAT1t+k4pbxI3/oP329HhlPQF8I+Mo NP725TINSeZ6z/A2maZ6/k75ACrapVCML3oA57lMTZJtoatQy3cuSwZqrpKFxWuBkiiR 5cQTeRSbLyf5cumkCWg9voq3P03XKx9TFNGKQbqNy21PnI8ESQtkzU/Hua/Zsv+KW192 vQc/LaGC8a2Dm+cg4tPKJWxpmHQswPhTJcl47N3mVqB7p1pDx9QuMbCMHJTgyFVvUcOd qOJQ== 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=SkNwA1p54FnDty/KK32zAM9MXihkh5YACYpriNltkJM=; fh=WVJN0L/p0v7gZLnruDaKTFOaTt9sAiucB4Kk+ms9GAw=; b=EmiftxjuI9yCfwbgA1JQvSI5ZFNvUDusVF43P6TRMlR2BOOS2lJVwD6QD+fFevq+CM cV6c1nkyOja8SUAYd2KKrxmK7k5p6qtdbXQlwDvuCV22QXuHO9bKdg2KZHdZTv7Qu+S4 gB72lVE9/AZom0thl7yHFOZT6StENB8am5T1V5ZrQjr8mYRee/aishEV1iz7dFOeP/vl Zx7p4PoiowCTxQcjP/17/QupZtZ/Ik/r/U4z30iEPdCixc9bUx7yVNgmXhhLWSmgPtnt 0awEOiuxUiuZWJ6i2FgiGnjGLadEcPCUyiVIlUc8MC6bAslgpkpxgsXDCA1jaxZ4irLt Oe1Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="IeDV33L/"; 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 4fb4d7f45d1cf-5bbb2c1e435si1441927a12.150.2024.08.08.17.57.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:57:42 -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="IeDV33L/"; 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 761F188C25; Fri, 9 Aug 2024 02:56:41 +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="IeDV33L/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 12CCE88C19; Fri, 9 Aug 2024 02:56:40 +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-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) (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 EF8F288BEA for ; Fri, 9 Aug 2024 02:56:37 +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-x635.google.com with SMTP id a640c23a62f3a-a7a9a369055so149960166b.3 for ; Thu, 08 Aug 2024 17:56:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723164997; x=1723769797; 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=SkNwA1p54FnDty/KK32zAM9MXihkh5YACYpriNltkJM=; b=IeDV33L/28zrBydmjw/YqGYn/asNwQYLIvocsdoVt+pRqdOaL2daPUlkPrPN1BDSqy K2j+YhycJZ3Kb7lzc04V3O0SCxMLi1uOd0j+bVlYwwsAJh+l1hv9ydHDRsuF3j/ugrMt QMQhCQmvtJjOduEpfuXR2bESa60tf43YrfaE8UqLIcp/8UiMIBGq7c3H2I6rHFKKUTvg zOaFu/Ej6BMvATJH0BUv1tgjUHZ1N8ri2mmIiyOnr4iEzKnY8PVo2AeJcoarQwG8TGC+ ndrRZn4n07a3xoXGdyIWRTA6HWvrFrz39jkRmXGzHrlMXr0HAJ8XMOToLLfXiCKnraLp Nm7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723164997; x=1723769797; 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=SkNwA1p54FnDty/KK32zAM9MXihkh5YACYpriNltkJM=; b=tfstseG+PlEFPIlbf+AG6t0Dy8EYouVb7su6HG0LcgQETP/CLrRTgbzz2rj+XjeJNt gAGa3lokfQIkIhps4bmx+umbKNCxp+IY37S5v13ct0pAnzkFDin581kujZ4IyfNutIpS 92imwumyucQEJmjc2dKEKsFwxFx5+8RyvImYudBS2nyn5lopgMiT2xPB1KJj/0ZlhoaD cI57HU2WygNp153TRYTP916rzNt+JcIZGok8ezzk0UY/GHqWvHbMf5jxFQGoGiRcAPWZ bN8NPrHNLa/lxY5IocRvTg0nGBR/54LQXBaMv4ms3OJbIF5KMycYCjPbKzYlanqzZwZQ dZ+A== X-Forwarded-Encrypted: i=1; AJvYcCUQM8mY3J99Y1jjDMlBRKXLTzPuvpW1xbuv+xVQgCJv3uCVA8WXul90V5TyN7gWihhW4ke4ZMVox8nc6Gpd2LDNaZsFuQ== X-Gm-Message-State: AOJu0YzGPTQkgVOYY82MIZNet7lbezd/2knCN8FutPL56UGCTv7wADql VQXMAZhZRQoxJrQ98MVEHnXEPrF3B1NnV6icsUduJJD2N/mNWOFjVYdoBDK5h8Y= X-Received: by 2002:a17:907:efe1:b0:a7a:c812:36c8 with SMTP id a640c23a62f3a-a80aa5a62c8mr1047866b.18.1723164997395; Thu, 08 Aug 2024 17:56:37 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7dc9e80e54sm790680266b.167.2024.08.08.17.56.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:56:36 -0700 (PDT) From: Caleb Connolly Date: Fri, 09 Aug 2024 02:56:25 +0200 Subject: [PATCH v7 06/11] lib: uuid: supporting building as part of host tools MIME-Version: 1.0 Message-Id: <20240809-b4-dynamic-uuid-v7-6-8c44ab1f06a5@linaro.org> References: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@linaro.org> In-Reply-To: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@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=5256; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=TZzWl3PSLPgNZSMayk54PXwrShoczqUb0B/4tNZ/nZ4=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmtWk8xVawBVRbGA7LomAslb6inpEeCCim+uvxy TNIlgt+vcqJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrVpPAAKCRAFgzErGV9k tsJ/D/sEk/AHVhH7ThFVid1sV4ezKSq6Nq++ZoDxvAhApj/jkLx6j4mzB2dw+wK/MulHgVJAUik IP9NBN4TLJA2RTTuGUzZmVwYiyiwX9zv6R1VnCX3ydcyU/df0UwmmkEj5G4cwLUpfJWjz527SfP EvCTFyQBxbBwwnfnvBQwDMNL9uquHTz8LU+Sp1VJfCk4CGOeeIS9wNMzJTgteIWNa4VbgH0YFcR kO+YWIideqiV+tbmic6CDJCSvpR2b2phArb7EUT/2jXZXOkYC1OwDsfRFz3KK27imSw7xRZ106I eQ4LWyjBX7vCeFrM785HLADAuW51LXLPlyzBW1o+pQ+1LcF9ehVW3ygSWXewfaASI7xxLOB7j6T /1a5GO4HSEEsEtpv2P5jIAXEz8LY0updSNYGT9BWvDvrCK0yiWVd1DLf21wP+1dLd7nxej/1fqN 40u6iyHoP9za+LAwd2brkUojK24J3qGz9zNhYPafDkycmTZIfKwvAZ3yI60nrQJicICyRWTRnsK LwOMiFvswXRwS55agJSyzhsnMxD0cNCFeaOTwuOm8oc062x9+w17wwM6lZfIUYFAAq/7R+wV4vp R+Piue5FZzKFOD6DIojsHJZqYi+0czktpXUEFrBjIj8IZY1eYGW0PG1crbQ2HeSLRwQZhImS7gE t+3sxabAKgwXzVg== 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 Acked-by: Ilias Apalodimas --- 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 24b5881600fd..84277cf67ece 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 = cpu_to_le16(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 Aug 9 00:56:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 818104 Delivered-To: patch@linaro.org Received: by 2002:a5d:5711:0:b0:367:895a:4699 with SMTP id a17csp89535wrv; Thu, 8 Aug 2024 17:57:54 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV2oDOzis8TmVGR8LwxbTjTgSjBA1BvftLLeNSSXpEEQOXVxDNqjUCFm9L2y65hsR1wq9gIJYSyIZkjqXICsI3D X-Google-Smtp-Source: AGHT+IFU8eGDcE2dXVp2RbsrmXju8O/8dLIbP0uTzMYwOusQzJpcqDhpDkRb1gjFREpkwmiUn5AE X-Received: by 2002:ac2:4c4d:0:b0:52e:9cb1:d254 with SMTP id 2adb3069b0e04-530e5876560mr2728316e87.46.1723165074284; Thu, 08 Aug 2024 17:57:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723165074; cv=none; d=google.com; s=arc-20160816; b=wDILkF61i7x0xJZEC6jBnO7RwZ9u6VioRPS1++67GelzZf9Os+zc5GPUAjSQw66xJ6 2mgHeCxIqGSL9qmVon0wT+wjf+xP6sc3EbVBfZWB8b8nriccG8ilVb0RJbctbnpPGVez 40dLyRLiIlXJDG4+3opxnP5r6B4eU1Mk4oFi/18CBKycDHr4GxH4H6PksrYrdP15JudC JWaOWbziR7UE1W31hHDhSITOmeqGBFlDnhVjzhvqOwsahQuWG5ol4yo/eK65F/Dc0q1C cPUMri/gGgepLvrb4bHVUhQmRVbeezaP3eq5a9CyGiP9v/iD7ZAVk8UMTXKY+FAwa6pk mElA== 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=w/dklX1Qa1Xruwgki38Zq8q0sSCGTSBGNpQqJQvhWpU=; fh=ILELjdO6J+g77cZ4mqulK3P+RZDbPG2c7P7D4Cgo9Ik=; b=z+cvdbDkIgeP/YqLt72tWkgEotKF8LrUOfs56Hjgc5uWzwMjjSX1DE3+KmMOY6tZXe QlZXcFkye8XxvK/UvToQA88h8ePIdlyca2l+Av6bbH44f4WIGQJSbY/7/CY9tpKhiVJe l+WG8AxqCcSO1NON/Fz5/tN6h9EhepfZuZZ1BUPzvDhdhFDAp6sRNFKPtA3v7o9/W8L0 zR/1mF7LUl98NOCNMTF7p3uTYGrqcns/MYIfgtHP4RAl+CY27xLJLTyB0PLZzvbi27nF 92XhHT0NNHZx42syRGQlQoHWXd5YK+97tOLNO8UeAmq/I6sz4X6DGa9vurPS/U90ymGe IdcQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="CZebz/Sl"; 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 a640c23a62f3a-a7dc9bd2426si853323366b.171.2024.08.08.17.57.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:57:54 -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="CZebz/Sl"; 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 E16C988BE4; Fri, 9 Aug 2024 02:56:43 +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="CZebz/Sl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5B0D488C25; Fri, 9 Aug 2024 02:56:41 +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-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (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 16F5588B8D for ; Fri, 9 Aug 2024 02:56:39 +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-x631.google.com with SMTP id a640c23a62f3a-a7d89bb07e7so187663466b.3 for ; Thu, 08 Aug 2024 17:56:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723164998; x=1723769798; 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=w/dklX1Qa1Xruwgki38Zq8q0sSCGTSBGNpQqJQvhWpU=; b=CZebz/SlkOyc9+VIYn/t07FmdJiS67//yoeiI59DdjpJJVdkJwvIzt+b8d/EigMMzs IczpcQUrjYd8HbwJ2srlbNSVDVeJkrJIkm40UO6Uq0a0qlikcJ2wZgGC00uZuhvJSiND u3ZE2JHox2GBPgwvWcK6nYdPslQMhGJfxojY+fF/uJm8esFXO/sDRSRXbXyYR71DPIzV zcDhjzxIpGtjYQq08wj8ugMtoCgYG5F9CADmhZhrYrx8gY0Ss0pOBe+frT9t3DxdsBa+ u7Y+ru5QmZw0b4uHA3403j0AtqNKy0VU5yhuk6913vxiF+GF00hSccTBQLNYL6/PnzY7 DV3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723164998; x=1723769798; 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=w/dklX1Qa1Xruwgki38Zq8q0sSCGTSBGNpQqJQvhWpU=; b=b9t0lhAm745TQJe96ETz4pnDrz5XisMD1yB6XbKyYSKyyX+brhjlsNk7ZHOR5jTtSM /Qtmnv0YcjYEUzcFGp7XUjzVr0K+LIW71eYEzgYlrzqIoD8mfgb4wqpSvu2Pu+9rWtD9 Ps0LYE9je9yvSbgJLcf2lXESK2YgCnnLEK+aucg3OBhdARQhFoejHeH9cglYyB3YzJzo cedyPSE+UNfj2Z3VH6CEE6vTzt2PUSs8bNvRZjiGxUVGRdbI8R77/jkoZNKdckLLC3dX MrQvQX6fQ4LmVg/26m/vGeuDkwDDZmwVJral51ePrbIthms9bI4s7SLucfAdwk+5uw3M joIQ== X-Forwarded-Encrypted: i=1; AJvYcCXr9KLAP85p4mTqcYfJAfk7XAaY7KG9EZPHqRkjrBNgN+fWzErDLOnuOh97jdg6nRu3WI0iPMTLXx9VXIYYlX/hgj5sDg== X-Gm-Message-State: AOJu0Yx1yQ2ns1DrXiVBj+F7DnuY4b5eMQB5QNnw2l4a3HFbAZRwEapD DBm4LKcZLL8WOx4KCQTmW/CfxDKkTHE4EWWg2UrgYKYyL1JKq9gbJyj4DkcQOXc= X-Received: by 2002:a17:907:e8e:b0:a7a:c083:857b with SMTP id a640c23a62f3a-a80aa654ce6mr308066b.42.1723164998477; Thu, 08 Aug 2024 17:56:38 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7dc9e80e54sm790680266b.167.2024.08.08.17.56.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:56:38 -0700 (PDT) From: Caleb Connolly Date: Fri, 09 Aug 2024 02:56:26 +0200 Subject: [PATCH v7 07/11] include: export uuid.h MIME-Version: 1.0 Message-Id: <20240809-b4-dynamic-uuid-v7-7-8c44ab1f06a5@linaro.org> References: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@linaro.org> In-Reply-To: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@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=15788; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=G5fQCMrNXIS194tzHM7pmcoCrLiEsM5R5f+J56yyTS8=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmtWk85Wv/5NpxUaRPjk/5KS5Mdz4OgHS6m25Ma Yibpoctgy6JAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrVpPAAKCRAFgzErGV9k toD/D/44lAQFbjA3w34EO//AO5BLfakPKem7lqdg+/TNmWEGsqNfboUepnXk4w9JOgc0g8wpg8T qDeJQdzH+qAIoltc5idGQUFz4AR80WLCGcnXafBU5aecfnnlQayuTxSSsqMxZbRh1dxBapXc+EW ylxqp6isjMTPCc5PLj6pNi1C8L2ojdg5llHpOPEUj6+RHbLGEGSDohL9gbVW5BGZXucrb+ie3hX Hx98+QVG9b9XeBJu147qaA/qAMP0rF0FaLFoi3Ez39gKPeuPwWSw8wRPrJXWCLvz2Xw18bvSsIG FSQni6290Irwm4Mjc527ShfCLBQS6P+hRJVTNCpa+YILta0tJPmlx7iuBHWEWXcfyG3HMfQGGUC 8QWH8D4vhZF3fCntgAzng8uA3yMML1XIZedcFQd/Gx47F9oOOuGfHKMz8gX053lD4nonw2cYY0r /uN1e5oKqYvxQlKPvVYBXfC82EgZges8fF5qc6BaFKMBt9TArWGJkEJvggjvk9NX5TidJv5J6Au iQ1fFveIebsix4blPcVFa9Hdwjnl1x5C8OgH7SEW5IS3mpFLn1+u07Idq/8RZYDDZE2prsiK0ys w4Rynxmir9mIcC15Ocib1e4a72a8nH25wUtxfO23g3OvYuXZQRnOKMm80/ESbB0yNR8fT5UjB+M lUOeLZK+7jhTQSg== 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. Reviewed-by: Ilias Apalodimas Signed-off-by: Caleb Connolly --- 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 616842e62f4e..f16f2f1184f3 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 25805393199e..54dc50ce2c1a 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 84277cf67ece..ed920e0d9476 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 Aug 9 00:56:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 818105 Delivered-To: patch@linaro.org Received: by 2002:a5d:5711:0:b0:367:895a:4699 with SMTP id a17csp89562wrv; Thu, 8 Aug 2024 17:58:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV8v8m0oz+603YFAd4K5CXyqxeqiVEVS1Ecjs7JFhcoWYcZgD5Gy4Z8p3bqXNA2G/NIEYBWWI6A4ZIvTQ22R+j9 X-Google-Smtp-Source: AGHT+IE78fskWr/eseCLwmT5IV5aqBptmc+jin8SVxI6FZYdxYP3JbYC3VKURTQGrVPBqUSmz0Tp X-Received: by 2002:a05:6512:4020:b0:52f:cdb0:11da with SMTP id 2adb3069b0e04-530ee995d7amr6259e87.33.1723165084178; Thu, 08 Aug 2024 17:58:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723165084; cv=none; d=google.com; s=arc-20160816; b=Dey4N7mZo4mc7bcT9RGbXGEanK3bfh3mQQx5aC5itTuRdpb6Sqq0SmoR18iigRJ836 tt83b9qbqGFzRbrCVnPpB2c/LX94EX0KWdUVbYdTE+3/M6450EAUIaE5wuDX8wlpGm1r scxX0NVMTkIaJvX9jmZAssS8FjSEt6tiBIxSpE62+cwWui3zoHVWt1pJgq7suQoKn1Bb IgE9r7COeX0D0VcY8TW/BIZW5D3ZzAcaVlw6KjQ9KGDhvVPacbs2ERtXY8o57W0sgl88 b6VlGRkQRZVJiru7M0+juTsAOGh7AZcszXLTzYsMj2KACbd8Ke1WvWdWUyMmiEcphMYy L5Sg== 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=pf4OM0prvvLF0aiOGIs6XUHN+PigrIYz1lUmOKvqkEw=; fh=wxoUmHtmvjgCaZOdGgs2Djd7/yb9seAZ6tkmYw6gA24=; b=HZK/VwkhsaZo9Qnw2sY8lrRt6B5CuVsJeHXQAxL7drn+s62HoF9qjp4uJb8dFhslwi 13o7h2Ee9VsvLwpGdD7yTwXEfIpDT7O0ROOrimWUkQ5/TvNRcCy0UTH7MV0CBnUQBZ7M cQD8EKOwwW9kM3ldKX4jd5ux6cv+Vc8Nc3Up3vc8AalNFIUnqpQhIPpVgDcV+hi/BR8q Fd6Dvg1IW/2s4w9e5x3vKogB4D9PX0zTXMAHg+JZqKdtKrVklNkEBMEitf22ymp5FROm sRHUxTxI1adMlHlsyNTZ395hfKhod8lE9oIWvkztJsM+3bxHrNMQor840Sggy8WTWmgb sRoA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H3WHusfD; 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 a640c23a62f3a-a7dc9f2b210si890524066b.796.2024.08.08.17.58.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:58:04 -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=H3WHusfD; 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 5668688C08; Fri, 9 Aug 2024 02:56:44 +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="H3WHusfD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1B75888B63; Fri, 9 Aug 2024 02:56:42 +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-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) (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 0C7C288C18 for ; Fri, 9 Aug 2024 02:56:40 +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-x630.google.com with SMTP id a640c23a62f3a-a7aa4bf4d1eso190646566b.0 for ; Thu, 08 Aug 2024 17:56:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723164999; x=1723769799; 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=pf4OM0prvvLF0aiOGIs6XUHN+PigrIYz1lUmOKvqkEw=; b=H3WHusfDX15028GGsgZnuxoQM7xYuu+bEuHQ2+0Zo66ZQWWu9a+pg9nImJ7z2mAxNT nfWGd/Rl9avXgU2mp85DC78OoNaTyLuzSTzS4yJf17BBhd3mOXAQUHJ8lA93upiam+mY 30l2191NU8vCUG3UkVHzVzwQJUeLfyHQaHZLUSqTszF6x5Foq1ThqvgrRHtK9ivup3x1 HM0WohWp7e5Tuq/0chpXrTsHRU0CkYvKuWkaUlciHkzWWpjd5Ig62watcLsp1yUFw1hv 3kkTrtE+FQD3XG8Eu1jkNJ1GY1iuziqf6VxcqeL8dAfdEZQsi6rmxLEV2cn81xE/3SYo 2bmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723164999; x=1723769799; 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=pf4OM0prvvLF0aiOGIs6XUHN+PigrIYz1lUmOKvqkEw=; b=KHXQ0d+k4ubvAMhJySywF1tzHyUdAul/ET6XASV3SUHh4+8eJc/2VXL3KUa/fKJLv/ QF+jUOs8dT5lF0f30ioPJsYYvO6Zvd67Ps6uTqJM0s7rNqubFcaoxPPqXDRkl+ABqUYk TEBFDCIqK+NdvtmKrVaPOaNaM70fy523+MyEtpE75Mtjk4vPCrVydev0+6CHizyLBUoe t1+//9gqdmRT70V4azAcmYLZY6B1durQyugV0a16W/nNf7becwBMEXz8iiRtYo64Zos+ AuwsopvMbLVcsY3PrIR3tfn8qUxiYR1bCqYX4DLTSVxdOBBCY5aFWoNPzNm6MJ6i9XKs pAjg== X-Forwarded-Encrypted: i=1; AJvYcCXbKjGRwiSU6r7w+9ou2roEWEPeB6/hyk8tsDr1vHpp/R0CM+oOyNpg2TTT2JyQvRulE5b+ZTEIl3GhusahkSsInvtVMw== X-Gm-Message-State: AOJu0YzJvkWurh1oY2jGActrfGKNAXQY/gonOrH7HLddpj4hmij4/d9d NIxL/hB2boMMxFdysV6LeuPMqbr7OMIBR1t0O5vPjr2da+17X0qZeaPSWk0jN7U= X-Received: by 2002:a17:906:bc0e:b0:a7d:9f92:9107 with SMTP id a640c23a62f3a-a80aa6d36abmr3166b.58.1723164999470; Thu, 08 Aug 2024 17:56:39 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7dc9e80e54sm790680266b.167.2024.08.08.17.56.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:56:39 -0700 (PDT) From: Caleb Connolly Date: Fri, 09 Aug 2024 02:56:27 +0200 Subject: [PATCH v7 08/11] tools: mkeficapsule: use u-boot UUID library MIME-Version: 1.0 Message-Id: <20240809-b4-dynamic-uuid-v7-8-8c44ab1f06a5@linaro.org> References: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@linaro.org> In-Reply-To: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@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=yvRcazKV9vl3+Pgpl3lDlzl/yfWSKc7gLZywA+IlSTY=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmtWk96o035BaXaW0jJNSImoU7k3Nc5SkndyUkW kB+0mdLfAOJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrVpPQAKCRAFgzErGV9k tuGSD/9QcSgife5SaVe1WiMfRdKbPrfKRMWrVbFIMoiKL0giTZ93Xl6H+PmefK3UpMhLhhjAHD8 ikEjn2kotEGo4cNfsPLe0kE9K95FXVPM16ff1wM1DggNNZFr/BqhHKB7cs4E2gc4Yq1PGT0mye/ Uuhp8mqTLnnHvpldrAZCn8wXIW9a9e5CpMh0RIuQGNiW15VnEcp7wJ+Pv6A82JsQweFPPRPZdqu +Qwhg0imZSHJysW0/7dDG1t2FYtuoA4GEG5ZL+zJYOXHPdZLbHoaL4xmXPv6LFF2JJyIcVFz2Gm HcLtPdk+LJMf0WX39muH/9tcliyxUZBINSPhks7qIAtiLMh2k7ofjGuLMw7Id6ebEwACdHsKy2O IfM34NPJVlvKr/lK9EvsG6q/1tIVN5v73kq/nKs1JAZlCyXEnUZ6qEkQynRv+oxNeIjRQbgGO8Y LPt7xYTRfjhie6Nn1q+IU+K72JnxA3yQDsnnCAvK1M7uUwZTMLxPpf+VjNGNW/7kuL9VOU61GPW e7t4i/HyMVJt9Sh7wP6fZ+hjnR+mQW95cwaOO2lfc/QZPGMgceqEdCiaULGJg2lsaZKfJFMwf3S ygw+KJaOKw6XhpOlwTExKa08eKItE368Az7GtxL/vcnIqzWO7P/XHj+WrKQ6zJzAP4wlxvsyj7P qYBJaWE5X+vq0WA== 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 Aug 9 00:56:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 818106 Delivered-To: patch@linaro.org Received: by 2002:a5d:5711:0:b0:367:895a:4699 with SMTP id a17csp89602wrv; Thu, 8 Aug 2024 17:58:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW0ZNcn9h/XYgFXsM1u4tre9DXtvnH1Og6MYDLuqqUqpDmXmbNzumYuKayvvmJhkydc5yQnq0K6DO9v4CRb+6Df X-Google-Smtp-Source: AGHT+IH40IO4nBcNSUVbbkHCvko5mOGIUwvn/3k8Q3JV12FDFfn4dmBJu6j2RP8tqBWekgv3rnxX X-Received: by 2002:a2e:9813:0:b0:2ef:2f7d:c502 with SMTP id 38308e7fff4ca-2f1a6d66433mr248101fa.49.1723165094663; Thu, 08 Aug 2024 17:58:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723165094; cv=none; d=google.com; s=arc-20160816; b=tloeQcflOOTNnbbHm1X/mv4o/yOfa+aU8P80TUfn1XPJ9LrO/PFam+XKR935UjYD6y fYK+v23k9G9PUyMQhbU9ryW7X6vTB5P74FUqvHKHTiH1lb7f9MorrG+Q72gj2GWy6O38 yXTbZiN4VtwoOJg1tTvevln/MSmD51ws7GhrTQhR6oOTDgSGCMtPjUaVwcGakACDPt/t l245uvDixw33JKY7Ghg1tFwHJH3BehmPA77hWXEYuRrsA9oiV1nyaTUKII3BskPmnFa0 N2VblXjmFCTpjnI6/toaf0HNHbFpY7XkqHDRw0/DWgA7HCDMCp65t05dm8JFq6UvVn1m yXug== 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=NdgpS2fGbKq3qCEqgboAL3IJ+7tYWgj1dTT5gC8wErI=; fh=4IHTmAhzBb/H3qKUTpFhBlkBFrzLWs3w49sASEQf2aw=; b=ww9bmK/HqdpVktA03ue3H33rWXh7i67hWweFUG0Lk5/DABETMDSbgjfBCoDure/eIO RK67PJZZ9WOR1AtaBHQOg5E87fX3ltBDACjf+QVzXoB2X/UA2zyUocC4ytcGjBN4GOnc zaXrP0RyoRroPkoL8TXYlNMiEUgjTKjbS+FdlFopgpwVwGBkxgEDB71MHGvtju4Yt+az fPnifCsJJHNPEvHDupPMndBvSQpe3nPlz7rihRtVBFVfQRMg/ATU8mrROEtft99AS4BG yxojiWLoCdwzUXLrjUHwAOg6lxDinajMCX7NSNkafR4KHzjCiPjaw1ecT5NP43J0cCST iEag==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E3xYWWda; 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 4fb4d7f45d1cf-5bbb2d229bfsi1398346a12.414.2024.08.08.17.58.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:58:14 -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=E3xYWWda; 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 B605688C16; Fri, 9 Aug 2024 02:56:44 +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="E3xYWWda"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BB02588BB0; Fri, 9 Aug 2024 02:56:43 +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-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) (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 48DFF88C1F for ; Fri, 9 Aug 2024 02:56:41 +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-x52c.google.com with SMTP id 4fb4d7f45d1cf-5b8c2a6135dso2018925a12.1 for ; Thu, 08 Aug 2024 17:56:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723165001; x=1723769801; 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=NdgpS2fGbKq3qCEqgboAL3IJ+7tYWgj1dTT5gC8wErI=; b=E3xYWWda8ofIs9vd3xSQuLec/iYCkIEJ7sip9aqd5tN2a2XM8A3qfeVP7UnNM3KoyC OPrT9Ja8NO0fYG/BDTaf03S+2oZvH5fjxusehcuqAhGHe0gvudqtVL28dnCIFpH/uxK2 zSyZNysJEgu4ZBXW3tdcewR3GUqc08idpN/vTfAkxpNnPoA4wm3cxuxHVnWRDh0wAj+o llt+mxV5Dq2IDBpsnfZAF5DrawBLrVpAlHfC+1/1+CVHtH9Qd3mtt+8ikvh1v3aSJRR0 jvYMmuCyFvH97dIsGJvkbk9aUfgCqirb3R5sU4vtuQsld4crc9eqfBO10N6bj7WVvrwX fa9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723165001; x=1723769801; 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=NdgpS2fGbKq3qCEqgboAL3IJ+7tYWgj1dTT5gC8wErI=; b=KdJbhCgU5MqpBCxhYDSVNHr0g6hTbP/rxBYgo4EbBp9q9KEAstYOy2nMH2zfo+5XZX LKaPbZqLq30sj9QMtTZrb3lLoWtc+PYEWCKucLvwmYIDDrXOE1qhT82Gfn1yNwLNAihj w6wmrUOIBu98qWWT2atbVHS558F61hgWtczezry6MhEKhkzIMfXoJGT+4EusYmDt7PUD Date0AIr8fiZ3NQJyuK8+Rhb+ATwfKAVEHcDU8TRJQrcYNrJhzB7Mnp4K4bSkZ0R9Umk tDitrTiKgQ55qkofQb9XfdVELn6c6iUenY7W8yRyGOqb14yhAWUkvftR/JGmjwZtoGwy 78DA== X-Forwarded-Encrypted: i=1; AJvYcCVMBQbkYj0H2Lw1ivU0nqC7gb+WLIVfbYnhWvNq7syDdg3CyIRoAkPgaOR+YO951/SCXzsVFNxXIxjvcuqfpClLcoXy5g== X-Gm-Message-State: AOJu0Yx2i4E840wvvHiCY2ACFNRBVgPDQHhrZRCbQlfco7+dlHniAdfB xXTtvc9T0hOyZZqfqXwwvymmyhwuptuS6hvlNeqjE7/JMObUo7kVCGu4tDc1EQo= X-Received: by 2002:a17:906:eec1:b0:a77:c26c:a571 with SMTP id a640c23a62f3a-a80aa65ce27mr311666b.54.1723165000563; Thu, 08 Aug 2024 17:56:40 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7dc9e80e54sm790680266b.167.2024.08.08.17.56.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:56:40 -0700 (PDT) From: Caleb Connolly Date: Fri, 09 Aug 2024 02:56:28 +0200 Subject: [PATCH v7 09/11] tools: mkeficapsule: support generating dynamic GUIDs MIME-Version: 1.0 Message-Id: <20240809-b4-dynamic-uuid-v7-9-8c44ab1f06a5@linaro.org> References: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@linaro.org> In-Reply-To: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@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=1ZmbfsFZL7+YgnLzHPJx2Z7jaIpmmM85jwfL28p3NJ8=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmtWk9+e44ZDR/tjb0sY3yVQwe/z0JgLSLI8Ljf 9e7is93fTiJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrVpPQAKCRAFgzErGV9k tkCOD/4uJVoaUhTAAtn4zYWI59uRDZa7deR2/Zm1/Hz7LRA+vNrLZMLEzaBDHYcYx4BJY9fNHhP jljrJu9ShAEldcdjwJL+8j9RTho4L8TFWELs54ZM5dcw76GZ71D3qA8Xu8hzSIDzjKATMymDmDV KozZGJftkARY/1uU47iNeJ9zePKZ/aPJRwuiAxE5Rg47vDloDb2p/Gja/Sr3tJhnI7/t/Bz9QDU rNTX+sTeXV1klSJY5vWIWqeXb3NPfDi1+nGbwxbnjCfmLHYoSysVCQ8xAi7l9h7ckqdaL3HQRVQ c4xLPFNYcvoU3+pPCL2CbxWUL5c4dTLKU1j/5ML9HPboS7HZe1KjrJ5wqqbz/XObyouChcCeiVf JnGWp1FYytZDFQCZsxNfqlIxKg+Q7ua6nszbfUHS8DdT4Bp74gQh94yIiHdxzqyxfkUQimyWu4e jBZs68//bnu7x8D+IqykriWEVIX5/RqLvYmhaAzcl2xsNEVlbvLR54N3QfQjS9Gzqk/uaZDZp3R VuoRZmJJnjib5d1mG8v57YLiY2In0HYL8Erd624NHsLh7k3S6bkT/u/KZDU4xyI+KWRuK+VlBqW 9ogC7eCVsY6kbll9geSNnDWfLuWmQN13bXm4DMLYzqgu2xFvxZhCyjDx4XtAVxh0QcwD6kjXjwX qBZ5YDklEJxGQqg== 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 Acked-by: Ilias Apalodimas --- 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 Aug 9 00:56:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 818107 Delivered-To: patch@linaro.org Received: by 2002:a5d:5711:0:b0:367:895a:4699 with SMTP id a17csp89639wrv; Thu, 8 Aug 2024 17:58:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVOPhr+aAa9uuOedHE3Mqpdj8iL39+De2haGgLlFGV949e2el8Fb71LjHZeVh2De3LVNmJf+62yE2dwdRGx7n4x X-Google-Smtp-Source: AGHT+IG4GozCO6mzrEzsM4CE9zuwqiljE5MsMgvor303jLthC0XoSLoz/pdPrduOhTP9ecnfH3pF X-Received: by 2002:a05:6512:3d8e:b0:52c:e030:1450 with SMTP id 2adb3069b0e04-530ee9746b9mr1018e87.14.1723165104808; Thu, 08 Aug 2024 17:58:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723165104; cv=none; d=google.com; s=arc-20160816; b=MLvTagrRx7pSxe0cGB2zOOQmrUsuzetFG7jgyvVlbLgbmlZ6Jr6nYPk6w10OrxbJwE dCy0RftfQhrFH20CQf1/gcN/pFtl/gLwrAfP63h48sOrt9AN5v3sMwVCCXIZqhoIHOFq Z56+Q9hjYv5mMBMgaFaQ63tBOrzhAOzkZkVhEZ3rdpWZGHdncR1ms6PuRoMlm+mQYnCw SQy3OT5PF2uWpcc79EDluvgvJ98HxijqCLGo4kZC1Mxi9EEzUTGX/QiW+lKt7Hw+eCEI 2qLkcBN3qU3FCzz7MMpBNmkFHXmMCoGCwxDNQVasQf2hsHkDnoJzVowF8uSLAHI2m9jX AlIg== 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=nJdu383bEZmoEf0jaSYoXbeYDyVA149Dgz3Uuc+tKw8=; fh=D9tJ9dLhCb11QxvZIx0yH7LM0uXYLvcbkT5VxDBv7A0=; b=i4SMRgWXMP7AEQAXV68QQvk6xA8xefkSO+61II0kCouHR6Lh7dEJ04ZdX6Dp8CN6op Esr/Ra3JglJpXfyurmkuQWxRG8JVMcpKahaD7FQNCRI6dHVZsMF+LQgvPe8z4xm0i9IT +LBIbioqwtXXPP6MyIyPzs2cDJXgNrYOLw0W7Y11oXYB7Y+pNrLpMFNSQWt1QyvkFKMj Owx5NVupRky8LC3z7a3rqod/6ATRkXYdzicXmMoGkbTHnhZw1ISbzq7VlpCDfiLROmyc 2LA3cyXwyU3tzLfT4FUO6s1Dbd1DvpHn9cUu4AxaL7fkf3E2IeaclhsK6zubVgUSmkCz +zQA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tVORD3BF; 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 a640c23a62f3a-a7dc9d6eb00si873809166b.407.2024.08.08.17.58.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:58:24 -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=tVORD3BF; 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 2CE0A8789F; Fri, 9 Aug 2024 02:56:45 +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="tVORD3BF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3677088C08; Fri, 9 Aug 2024 02:56:44 +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 432D488B63 for ; Fri, 9 Aug 2024 02:56:42 +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-a6265d3ba8fso132939966b.0 for ; Thu, 08 Aug 2024 17:56:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723165002; x=1723769802; 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=nJdu383bEZmoEf0jaSYoXbeYDyVA149Dgz3Uuc+tKw8=; b=tVORD3BF06UYL4gGUJFZ99AtgZtgssE+J5zOrCQYRNTPYege8tvWOeWMdCB/w+zqVV tYXSap8mfCANlRUwGHgc3yFS7tBItJMsmi6jj2OoEkHejImaweU4gK18npUWQzDQyRFM hIfpvk9tL89jSjnenJiHTLQ2TnXAi4Zo4U9HptLrhIhc9MUpZoywsnWgeukMMqUI3Nc7 ouff1xb3kr/SZIaxvM6QFlOwaJIAtQIJW9rdSqgjrj+xdWIRbpQkHOGlLiSV+N+LUAur y09MT4m7mTaoRFfEQc3HOB2FFoHxb1oRuXehRIoWAP9IBAzVkVhEbtGL7J8KfcIFaFWQ zD+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723165002; x=1723769802; 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=nJdu383bEZmoEf0jaSYoXbeYDyVA149Dgz3Uuc+tKw8=; b=MxJsdxsyZNUcH+CFh1jwigNZgbrCdwMfp6xoVo1EWDybXeFldHAUyIXMevfM9bSfw8 U090xfCOooCEUV1Fw5XtKFPhrQ9oWN/kOiQOu27V5zsz4y3jny8w9hygYlvVUimoA5yv Hs8SbgwC5lHaXlmQCGPI99n9IqAR03lNMc3hNnUp8cF6TMDgwiwH8L/+yBOZAhi2iQx4 M5puEnB3brEXhyAPGl/bq2g8Yq8WwQq+PN5YElZ/OaH/UCwnxZTajZahF07BI3E01ASF RDNVfrySN+rI6n8We5X2ExViPvARo7ol5L2J08ZXLfQJ2MydyW1/q/a5fzq9HhEj5nM7 KdnA== X-Forwarded-Encrypted: i=1; AJvYcCUbS2EhojhyT1ZROwUrdnpO9/tp2L5oZO8Ac53gUxQqIegUfHJ3if7q1RIF+yDM2rYV+hCqRtZcqYxUII1YkfFw3+ZkMw== X-Gm-Message-State: AOJu0Yx1UAOxxEvMqPGif9aPg1yZaOkOWHMkbgTX3kgspFoJ6LveEHsC rWDRoPGLt7B756d5DdyB77Y2tNmbQwl9/8AQVE4ajtSeLkHgOXpMt4wyz8r0r6s= X-Received: by 2002:a17:907:f1c5:b0:a77:e55a:9e91 with SMTP id a640c23a62f3a-a80aa595caemr912766b.19.1723165001604; Thu, 08 Aug 2024 17:56:41 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7dc9e80e54sm790680266b.167.2024.08.08.17.56.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:56:41 -0700 (PDT) From: Caleb Connolly Date: Fri, 09 Aug 2024 02:56:29 +0200 Subject: [PATCH v7 10/11] test: lib/uuid: add unit tests for dynamic UUIDs MIME-Version: 1.0 Message-Id: <20240809-b4-dynamic-uuid-v7-10-8c44ab1f06a5@linaro.org> References: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@linaro.org> In-Reply-To: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@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=3066; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=F5O31Nk7Cky+OrDFFf3eaBrzcyso+9+tOqyXI5DtTgE=; b=kA0DAAgBBYMxKxlfZLYByyZiAGa1aT2iyiPjlbH6l9OVhma1xM5fr2BRXTmZzv/lYGRQbhX4s 4kCMwQAAQgAHRYhBLZRoUY8ar7QaQxVzQWDMSsZX2S2BQJmtWk9AAoJEAWDMSsZX2S2n8wP/1UO Fhf4HrOvCX+xvyabbdY86Ip3FO/yjvf2/lv8hk79xhjQPMK03oWmNZO04b0WbnyIIyRMgEUSG/g QTNQAsXaP8e5886WlvUU9J62gXNL9Actbo8prXg07DsTV7V1Z6fB4nDchEs52woTGdcdSR57Hdi meVN+uk9Xl4ukIaeJO4oMhm0b0ejlcmhQ/F87MRu4pblRpv/3o8HEIis4I9Nck9vOqKe0BHoDre 04P/hJdxYCHv5Dd+M6JcIBhpZfbMxat7l01idO1GN7IqU17NXt/keseY2tHHie8bc0w99cNKAUi wwlNE4CpBIaqXqy99LOuY8yjsKxUFMUtXUAIy8TmNwBrbqLxdEiL/KXD2Go0KLdbv8Dr4PcASzM XwnFRfPg1KG6nBq7lRG1XjNNRy6Xi8xNNFitPmE9QYQc0mQVQppFmrcc5WN6R1jBirXofooW1Uk mQ0JTnYmWD/u/1PfCDq4OdbyyNB/A6kZRw+C7KkC9vU6fcp4ENixl+RA20km3qXf/6CQIFKY+xC +U1gF0EoEqGycNh8I6pRGoD8+f7PNNyMpuzQpcQ6lpsqoiqfQv0+G0fG0pFaGybLcF2wAfU6HwO BsqGgOMbUUgofgUDAU6zD3TXDiVMWN15Z30KgkVim3GXycY025lR7mdBqeZo4xQDVUpq3NGjRvR ACQq1 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. Acked-by: Ilias Apalodimas Signed-off-by: Caleb Connolly --- 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 Aug 9 00:56:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 818108 Delivered-To: patch@linaro.org Received: by 2002:a5d:5711:0:b0:367:895a:4699 with SMTP id a17csp89682wrv; Thu, 8 Aug 2024 17:58:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWI1v1fycX2aoQoqJs+Zw1sec6yw4y7TAIBObdoEAEY+1iffI4CN3DMfNIHu12/Naisopl3wn0iTrCMonqbOVNv X-Google-Smtp-Source: AGHT+IFkNePiHWZJdEjcZZ2BhFdxaUV6P2A1NjL8fKI4ws+2GXlalR9CoMCtZ74k6rDbc5iqhQTc X-Received: by 2002:a17:907:f1cb:b0:a7d:e98c:5bd1 with SMTP id a640c23a62f3a-a80aa59be0dmr1208166b.26.1723165114362; Thu, 08 Aug 2024 17:58:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723165114; cv=none; d=google.com; s=arc-20160816; b=AvqUOAv1akjmsEVAj4BZQC+Ihp3sKhHHDlFJBdLPwmeLZ40J/JC7CFCQacrHzlvQ+k whMf50acHOEthl41kGYp5sP2NNVsWGJPwq0Pes/LG09W26k547it1L265J4QLbMp6ReM MTz6agQ6tDzuCtDxlCH8h29PlLMFaonUPx8aFh3eqmfLN3fhoNU4tx8pZNeyQgC/fbTU lPjEnejJ0udhU2TAbNcjM7A8pZQEzmfXzthQZvAiTD7JCPk0QBOZUnnVKNTK85DdOBQl LW7n2umEDnZFQYSb88y9IQXxVrxtxAdArHkJA9kBrH6yFw7O8T55r9RhYZDE4KuT078F tXAA== 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=j2GebyOcvCO1ksLKJy5XNmT4lbOVnsTw7urdHAUt4G0=; fh=vvlxVpnAm4M6KIUjyH59Beczuo6R3y4upXcidFdolQw=; b=QPdqu7r8I3MvRmdT0v2yhXeRrO/8XEo/kbGfaPSHaCEgiwAqULpwlmMU5cXwDxgwxW OCnxwAiG50tuR9LiJ55rRzQZVxgCWQ4UwYVD6BDQyNP7CXvpwOf0Aehvk5lm/dQ2lvwP MR9FGeJs5/fi/Dj4uylLAdXSYOfBmH3xELOXvFHa4BelptSp6EHTYObMOkzKSW2Mlv/N 77Scr8+hGbLktFEvQfZ/vBfUwp45g8HrqNeoR2v1dYFdKgDqgrpHxmgbAG69RjeHUQY6 y6Y8d9QrDIkhjOGxMQJ5vz5F1d4BKcB5yAniSFsqzD5Nsd4QV6dKyUnE94Bvsf+7mBMJ xFZQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U5ORbzdT; 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 a640c23a62f3a-a7dc9efc873si896402266b.738.2024.08.08.17.58.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:58:34 -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=U5ORbzdT; 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 9147688B8D; Fri, 9 Aug 2024 02:56:47 +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="U5ORbzdT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B144C88A10; Fri, 9 Aug 2024 02:56:45 +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 B84B688BE1 for ; Fri, 9 Aug 2024 02:56:43 +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-52f04b4abdcso2134943e87.2 for ; Thu, 08 Aug 2024 17:56:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723165003; x=1723769803; 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=j2GebyOcvCO1ksLKJy5XNmT4lbOVnsTw7urdHAUt4G0=; b=U5ORbzdT55OO1UZwYYTUXmb01NrzO9IcWJ2lSOQ/1MrWFN/XliCRL0DNXVZzbmniYn wlGqjHmnx4Xh8XXKwOfkXPA3hASIH3PA148TMAE/jWTrwrvnPlQIzNmAGV6MiaU52aO7 GtsAwX0/8LAcukFmwCuMLINPvDmEetPof+W1OvsiyPwCekt5+qbV8+QWDsUnYX+j8FDy 7pxehpcYeaEKbMJMXSMgV1zHjHGE2n9OGwUDvu49JBuYzH+dvv8o9oyU3VDaTnCzdest BVRW0coLpIk8szTq02Mg9ukEhnqLsRX/4i+4j1yf3nmqZf9qpNIpCbKNoJf7EK8szKxu +FHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723165003; x=1723769803; 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=j2GebyOcvCO1ksLKJy5XNmT4lbOVnsTw7urdHAUt4G0=; b=VNCuFMIuHiYwYgdkcOC8SHfTYxLIu+vTDvRd+NyZD8PqR5jFJgN5s2Rc8XJqt8MtMg /C/ttOErmBMx9bWbTdE2D82ppIH864C8at79d6xIn2lxWuYRfN35fgxg2v0F7d0bFPA1 rNBOzHbWnHNwCDrz3qwyF1C8tI9SDG3BTWSGKZRTkytv7h4Pjkdq51VeEqKu4nUO1E4J 3WQoRJuFSzeOpxj9TbtkNhd/nCobigGqeaxBdGIWQyYogKmnnyZCy9VDc+FmKvHfmOBH ToVNBFeK4BVXv0CHJdGUk363mhGIJLV0+V4aGGad6YlmDLIr5qq5xS7VCEl7faif8K3P KKMg== X-Forwarded-Encrypted: i=1; AJvYcCW0C16vm44J9afITXBdZLI4Crow1mrqPVdhv0eGm2g/PHE1mnyhLE40lWQE72DERaTJWvLtSo9KFVXe3hWOgsWk6YJoug== X-Gm-Message-State: AOJu0Yx4Nyz34lk/XoSJTKbaoELSgRrhYKCdyWPRzK9gyqkGXVx448qQ fWOgwSc9limjxgCMUVkEmqC5+wnVbUH1a3JRPAHYgBS93XoVL+6SwrCbm2x03DY= X-Received: by 2002:a05:6512:33c9:b0:52c:f521:9423 with SMTP id 2adb3069b0e04-530ee988af4mr10479e87.26.1723165002802; Thu, 08 Aug 2024 17:56:42 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7dc9e80e54sm790680266b.167.2024.08.08.17.56.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 17:56:42 -0700 (PDT) From: Caleb Connolly Date: Fri, 09 Aug 2024 02:56:30 +0200 Subject: [PATCH v7 11/11] test: lib/uuid: add tests for UUID version/variant bits MIME-Version: 1.0 Message-Id: <20240809-b4-dynamic-uuid-v7-11-8c44ab1f06a5@linaro.org> References: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@linaro.org> In-Reply-To: <20240809-b4-dynamic-uuid-v7-0-8c44ab1f06a5@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=1786; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=zEV+3wrhvP1/3lJW2JTyvRsvixrRcHr3HfOI+/KZ+nk=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmtWk9L/R1P5YdKEwTIO8tiNwZcg+k7e44giQe1 6JJysLxk5WJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrVpPQAKCRAFgzErGV9k tuKmD/9LApo2b2N+FbvRDYR0u3PI7dT3yMpDssfjQR9ZUMDyNOXxKE+wTkrLdkYal2//3jXJamD GCyUENY6cvbucaysGWSOTxuDBrOF+vO2umAIP3foNKBU8KJgWv/rstA6i+sGOFTeUzBEOKKurgR wn6Qf4w0VPgOTxB657tCwSgIkt2YDlJB5QTeWRQ3xXgvl3e9XBDcDAGEhbdL3NVMhbQypCCmip1 3zz0sHnYfaUYRtc+8nnJZoa2KR4j2VQftMO95+QBpvFUMUUrT13Z+j2t5Q3sGOe18CNduXVTP/p YjiNg3O0cU7t3NHDgRK0JWuzVQEQtGFI1mD4GYhVoZjM/UKieUE0WD6BTz+NgiaZlCNM3hH+Orn QPRDerpmp9A8ki+oBJlpR95mEdPs8VbUpKvp2zuWIbtyzwxOZZJXNvxT+ortCcIuzEOl2p/MSE5 wTjMmu8TrKeGXMArCUfq1Rm5rE8w79TmZShO6u6/FwBWx5EEFEWTFBwrV2ITwpNJswO60s4Lwic efHZ4SMb+ZrzJKUmuZc4dom3cfDPyleELJepa9Ubzo+pPJkn1RxEmPWniJsKHRrLEK7pUTrYtZb +zIRpgz6WKTFOXv41OknzSr9SHsC75300j1cv3YI4hLlpvzr3ExCswPz7dX/No3WJPbt4YRvtiq b14PQFdhcFcS5hA== 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 Acked-by: Ilias Apalodimas --- test/lib/uuid.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/lib/uuid.c b/test/lib/uuid.c index 2c6cfd42ddc3..bbaf821f007d 100644 --- a/test/lib/uuid.c +++ b/test/lib/uuid.c @@ -43,8 +43,46 @@ static int lib_test_uuid_to_le(struct unit_test_state *uts) } LIB_TEST(lib_test_uuid_to_le, 0); +#if defined(CONFIG_RANDOM_UUID) || defined(CONFIG_CMD_UUID) +/* 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); +#endif + struct dynamic_uuid_test_data { const char *compatible; const u16 *images[4]; const char *expected_uuids[4];