From patchwork Thu Aug 8 16:21:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 817714 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp943909wrt; Thu, 8 Aug 2024 09:22:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV9XoKs4nsItFvINTyYWEqNKdZbfM6JomYJLyKmau06lSYMTgqduqLPYxks0Qiub1w36P9IGDwhkOEhnWN9UPeo X-Google-Smtp-Source: AGHT+IHyyF9teqF9d+KgPRbeLvNwepCUlBhA0/m7v/0xpUOqrjtu7fNpiP/AfBZU1541yZ4doi/2 X-Received: by 2002:a17:907:60cb:b0:a7d:391f:17af with SMTP id a640c23a62f3a-a8090ea3aebmr202737766b.51.1723134147427; Thu, 08 Aug 2024 09:22:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723134147; cv=none; d=google.com; s=arc-20160816; b=cyF4DedzWnXCt+cF+C6x5od6xpHDzCmr2UX1fZBAxtm48xUSaj0gsefTnZSx9uFXNh zsuqpnVWHzAbiGnyn9h+4S375JmUV8/pgrjOLc4+s531jZwDriYuA/EIEEyOc9DTKFtD ukFF9n7JJv/GKLdC+zsW6+yKQ4JzSA7zFnit/LWdkHcJ6tVbYYvXERDej3us5eYl2m4d CyMKI9K6Q8FTDjX5s4k+5yRMkjU255/3zT5yoi7HsDoZBXeY8L4x0YNFFTCwCWq9G8Rs pwXs+U1p2o2IJMWMmkRrBpfJR7pbAJGFInBsu/iG0OtJMngvOQdS4aJSqg1/9sf1En0K HC6w== 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=DO4y5SpWCtUwWTif+2BB6cdYmk6e2Wuh1LO1j5Z9+8g=; b=JiEmj2FGxZalJu8qI8Bjyt7/+f8AKM/fO0fSeaGbNyJGshM1C+bkgKU1+fWdv6Uggc aMq6rLATLss/6ppVdDEJJTjaO5qGL5avLwUoVBzcQGXnz78W/+lVaZb4EfUWPd2nwXAh 8rTqXixsa1fTi/Y9oZTdsdj04hWqZfCG/yDTkwLeA8KZ+jdGGONR4tBIGv+W9Ln9R2nv gziKsbsiudEN7qkeEf2SS8vne27ADavUaoAR+Slu3/9LgJLlR0PzhHh6Q4BGRajbZwWS dqCn/rMVJ8T03m084+ktsJoGrYwZ8k5i5TyKHHZoVRgJk/RvXjpdPvU8VrzG5QBPXpYI 8E3w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LxFK8VI+; 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-a7dcf1e246esi764105666b.916.2024.08.08.09.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:22:27 -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=LxFK8VI+; 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 04E7088AF8; Thu, 8 Aug 2024 18:21:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=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="LxFK8VI+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B990388BBC; Thu, 8 Aug 2024 18:21:57 +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 E409E87903 for ; Thu, 8 Aug 2024 18:21:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5a3b866ebc9so1332310a12.3 for ; Thu, 08 Aug 2024 09:21:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723134114; x=1723738914; 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=LxFK8VI+O3ki9RemAvPoS2tsNhVpj2N78vW0NSlW1EFQu6oTunoR4ATWDmL/JBFTDn w+F+P7onD2tl+BXBT5/Y19bijJ/x5cadQ4+P5upoxF6m+sIb0cnqV8Z93Xp/yTU0e63V gkCkh64k4VWxrn8+6nZZTVotQVcgUk6mDnaFQT+HQ3KFmjFe50I7jRm0nZQDfV7btO1p J6Qou5fF+1Xcy+RQYKcKoVfsH4psrfiVu8HpCKXkGR+EzCdmgqaEa2qLasPl80dDGfrm Y/1x8ULbGUGIs2X3iDfFORbyyF+k27HLBxXrsTuyKb9A+Dt9SuriLzlFpa7qlUCBvVnP rzWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723134114; x=1723738914; 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=E+EDa3uRVkM7BgLPmg3EVWFFOCNqid16d+YC1Y2oNhEzGGFX3lBvVydoQFV/y7GkaP VsfchbBg3Yb9f7PPDSpDaabAOMiI/3oCzMniujtXsEnFpzWx/a8xCTG9SLY+IKo36Onh Dyx3sSK51EKNTz0DtptEM7OVOrOUStS1cBIqX+BIycg/iZcM+Xn2dpl8ImHoq0BzteQg 2zl573UQhSLdtNjImjSMJ21V+FpiaLc7YefF1go/dXW7hdZIiDTTbXzjCbgzoNOZnjiG iRHdGPHcMVAXzCSsFSyIAJ6xFqWDsT6Ih8RO0oWgK0smZDFfupqGZFnLglnHKFY25mqV 3pbw== X-Forwarded-Encrypted: i=1; AJvYcCXWeYyNwXjMPA2XAlf59RVj70me7J1eKXIrGHxSxZo2/tXxqVGr98mUMd1xJRN/BG4QuVW2MGDWtN0B0cnxs5xbWE+zDA== X-Gm-Message-State: AOJu0Yyr8s7mS4mVymzc3LezY4yKWwA7/RPd4mItEqXg2ITNnrNbgUZD dRsvHYCYiWd8Xddo6hLtom6cnXMWTKAdmwsJcxk38smopL+xY2bb6sHTqHMbT54= X-Received: by 2002:a05:6402:2794:b0:5a3:64dc:33a5 with SMTP id 4fb4d7f45d1cf-5bbb22311a0mr2108032a12.17.1723134114257; Thu, 08 Aug 2024 09:21:54 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bbb2e5c8fbsm812351a12.79.2024.08.08.09.21.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:21:53 -0700 (PDT) From: Caleb Connolly Date: Thu, 08 Aug 2024 18:21:48 +0200 Subject: [PATCH v6 01/11] efi: define struct efi_guid MIME-Version: 1.0 Message-Id: <20240808-b4-dynamic-uuid-v6-1-9332e7237119@linaro.org> References: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@linaro.org> In-Reply-To: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@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/ZANAwAIAQWDMSsZX2S2AcsmYgBmtPCeSZVc9pbvEdu/qHZkPblxDD8xEAE1qOt+0 Dd24WwY+zGJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrTwngAKCRAFgzErGV9k tknaD/9z7WVxGqrjjDU94HuKAmZ68JxF7JydI+AJ9xvLVlA2sB0O6TtL+m+ACKbmkCFyeno9R7G x02Pr6clq2yOqJdGfhmHD0pGkoSdMj+BMXH5bOasegeHjwNJu2AUfFdERnOrEU5HVWZqEp1riYr EwQPQTjYdU3Cu/6dgqTmQioAJ8pEuaDLV7GZQw4kyY9Y+nEDLD5f2FYTShgxXrOyx/1b/JbeIw9 oTHG3tq9Z29yLV6fxyjYX7pQ8SlWNnkKvbwIYM6I7s04Yf6DORxK4DY4R+1/V4RkE4DBidhfgax WKODfGER5daJP3Vu46ZG485583aWNFSrDK5ed+jhGx7Iq7ubCKxeM2CL4xiFRHbBz+ivPyri8Dn TV6CtumhCDCefqqiR/1HIiywnr5RsyxKrcy/UFP0BfiVH4NFZmkou1zdB8A1awJh/rNNkjPDamk 78BcgyQhXIctphlgRKmoTk8XVHSWk97SRZ12qYVCsScYmNAl18PZL7Fbw4yqXIsc8Z5yyJ7m73s FCZq0iUF+7nimVxJrIJZ1mLB7McW6wy3+bR8Vr7jE37Q+yFmrozThd8RyuEy8fKZFL1TQ5F5nyr REOYLw5KgwVl5K3gsOkGlige3RS+PL1B80t6jOnQJ8xvUS7dpfSjRgWaSXfUHQWiDz/WBSPYjfn W8GWMi29i0Sjo4A== 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 Thu Aug 8 16:21:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 817715 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp943990wrt; Thu, 8 Aug 2024 09:22:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVDkLudc2wPdSGr/DrrjFMgS92Up7pJfmv4eikzHlgkQdvlh73d1jjqt+qpjfenTy2H9dSI1D0S1R62F0PC9A7q X-Google-Smtp-Source: AGHT+IEpgGBs6fWaXGC8bCinjzTDjrCYrKhi2Q/oVqo0nLUWQurcMH+vneE/QjHnvbTb8gvRYcYJ X-Received: by 2002:a05:6512:238e:b0:52e:9b2f:c313 with SMTP id 2adb3069b0e04-530e581fc26mr1714745e87.22.1723134157839; Thu, 08 Aug 2024 09:22:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723134157; cv=none; d=google.com; s=arc-20160816; b=RRQA+SzUxcyUWi8D0fCHNjkCTM/KDZaXeGarIYnLtB9gbQmaYehjLBEhMNjW3ZQ0Jc Dcz5Sgn8BlVKeVdqRVvPCx0NmCPPyVkLkOCWZ8hL+aL7e7TSUTEQ8V5EZg25rQIxMjsr vMopxtqOvKy9rs+I8c4wUV8ClKtSTGDmNF8H/Az8f+tI0XSwQt/cswCU2pbUGH5luPBx +tzh0JJpH2nlFzjPB6m9sc0VRv72dlfPtsj0lTmHO39sntPbo6KbVJBAmNABgcgFMJEj 2sXnB8nAXjvXSaqok3oDlv9Pc3k71JuYBFNHRr/rwyWFlpL6sXx70VQ8uaf987z5v+de wb/w== 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=D1MM0yShFdyHWcxpQmw7ZCHxPKzujVYU/yLrUnJrEWQ=; b=JIx4LbRqqDNWF3itAp84hkcw+/R9fugmt+JZm2+pPgT8+ypOKJRWXq9Ft3US7tSEIr tqjSh3A5sP4r57gsoiNyURhk5jGogX7iE+t0QN8ZouMM3TFLxPR4FwdjitL2AGmFfsw+ vSLaWpcgtcULdY0iaHHDdcL9mXrzl1RqqSQhxdIP6rzSlN2sFyAp1+7UePiy9HjVcUYW 7jq3pudwaSG6OwGQkoYo+m6zBg2PUiO1L39QxYsOVXcr8YT/mnNG2O76f12J92DDyqsB lGJZR4Hklxi9rmvPszuZJMCB4phG771N1vwOlhob/Dc/l3pxZX8VzpYfkTeJydywob1j Vyxg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H6hFPADo; 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-a7dc9eb89a9si841639666b.566.2024.08.08.09.22.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:22:37 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H6hFPADo; 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 97C5688BA4; Thu, 8 Aug 2024 18:22:01 +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="H6hFPADo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EB31088BA5; Thu, 8 Aug 2024 18:21:58 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) (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 78CA388AF8 for ; Thu, 8 Aug 2024 18:21:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-5a3b866ebc9so1332346a12.3 for ; Thu, 08 Aug 2024 09:21:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723134116; x=1723738916; 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=H6hFPADoGz8mvIIQtmVZsR9UuR5UL/t8blLEjul3+cOlRoQ8V5nP3SZoAly5Mcv9nY ZRIGO1oHFW1JCTofRDW30vP+BENyd5OkyUqttDTgHbBHvHi4oPSPeOo0SG1ModwXo5Xi HlfcanMBImvt21JC9N4zPeMSqnmHpfZW71XnVez+X6zAtN0b4FBBVX36AveVzbZgCP97 K/Xy7fEjen+lZHWoGEOkNjp8jK5Gjy+7+ez+37i/Xig5i2q6DqYrCJ9x6As2e5TIw2dT Icf7MVHEMBeWgPpVV7YvxDUGMHiDbdZooV4rwOjlMpo1bqpkLE9DPblUyKDbSzgoOgm+ jSAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723134116; x=1723738916; 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=PgS4IW7CyBAyF+dSutaO44BnnY85JucqHJkWe0pKG824bas3RMC/y3vm5CGchYhFb6 8VGphnowlyIhYo9YfkODVWweaLkiEkdu2f3wjnumCqsqZwirXAlagzGp7YLyk4bKioBZ aOImDBXq3g93UVWDiZRuE9b1ZsehkPyqqvgR8pdZ3FKc+lpzC30q5vCpZYJh92Ct4Z7R z2gyii36NNx8O9FazzJ+OsHSnFTJCnlVmoYYjqXoia+gnxDdyB/qUD0fRxxsyLq/Chan Mz8jdNBpo5Sid5py/bc8y9YS7jW42xU1EnA1f2IP9BajrP1eErqUMDwmU+nzsDtSEee6 ZJ6A== X-Forwarded-Encrypted: i=1; AJvYcCW1HXAnTTXwPiye9mcASYOpg6Da4mcIxL70ozYVQUcLOV9Wbizrv2lfSOeg/s5rHf44hZitJaXCi6bGJv02LgrOEz2G7A== X-Gm-Message-State: AOJu0YzHKGBYL2R2ju4HrZf6OfAMXYJD5UaiGsXqy2yo4VFSj/VoCgqi fbhdVF+wCfviUZBvjBWZ4eOE1z9inJMgsfIa/sVrS2Tni6vNePUtzAWGlB4WJDQ= X-Received: by 2002:a05:6402:234c:b0:5a1:7362:91d9 with SMTP id 4fb4d7f45d1cf-5bbb233eefcmr2292387a12.22.1723134115654; Thu, 08 Aug 2024 09:21:55 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bbb2e5c8fbsm812351a12.79.2024.08.08.09.21.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:21:55 -0700 (PDT) From: Caleb Connolly Date: Thu, 08 Aug 2024 18:21:49 +0200 Subject: [PATCH v6 02/11] lib: uuid: add UUID v5 support MIME-Version: 1.0 Message-Id: <20240808-b4-dynamic-uuid-v6-2-9332e7237119@linaro.org> References: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@linaro.org> In-Reply-To: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@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/ZANAwAIAQWDMSsZX2S2AcsmYgBmtPCeGgXM1hOPfbxx57PJhY+Q+RekZFcHA8AMp dIRWCU9NIuJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrTwngAKCRAFgzErGV9k tthoD/9kg77QJoYAtLLW1PQ9a1pRHhqzKaszwxMB58GCvRLQISfTDmhjYnHAJlvPArUcMJeDM8p ZE1VMnM5LQ4KDtjMqpDycQIwyTyNyMmTLljA5f4Ah0hSM6j0S1QZ+J1qIc5+oIK1D4c2y3Tvv95 l/LEuAiVowywh5WdZMKd7iBxg8pUfU4nsMC6hLLNKg1bt23F+TaaAFHEOXXhVu03uIk5n2stsp7 4N15JyaSzJa6hjH8ljU/6r1mxNLPQpviTwc+yPt6q5qv3IgH66+mbGYkG8GtBeA1NZ7OlE6Jmj4 mdnv2vL+/7rZfjk6hOauJtFyvjtkqGpXSiS8GCPuieLf3O9ALAXTdP5URnNUMDP+gDDVfhFfE1c p5DlNwD4K365eKPnw3LwuihD9MmXYUZrUkrR0QDjvBRiuIMV3o7sA8Vr1RX9UUdq3iOng5YMeh8 xUfqSrkgjvhXRACBiywQKetFnUC3jjvw/FASomBIuav1pKtdV0BR9Y/EBdQaLC6ynIW3j1bQAev so9/5bZdgrHy7L2MYA9BMKHXJOwUzOj8YDLumlKH5cvpvIYJS0lZrERMVOhH1rFGRcip9eJvBat oAvr/xNThIVeWyGoXvG2BtNV/APOJlkqYfhzW18yazwjFQti73qiiSpILk1qB8+Ibm13Wru4lqy 35Qg84OPVFc5PkA== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Add support for generating version 5 UUIDs, these are determistic and work by hashing a "namespace" UUID together with some unique data. One intended usecase is to allow for dynamically generate payload UUIDs for UEFI capsule updates, so that supported boards can have their own UUIDs without needing to hardcode them. In addition, move the common bit twiddling code from gen_ran_uuid into a separate function and rewrite it not to use clrsetbits (which is not available when building as part of host tools). Tests for this are added in an upcoming patch. Signed-off-by: Caleb Connolly --- include/uuid.h | 17 +++++++++++++++-- lib/Kconfig | 1 + lib/uuid.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 67 insertions(+), 9 deletions(-) diff --git a/include/uuid.h b/include/uuid.h index f5a941250f48..1f4fa103b5e9 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -10,8 +10,9 @@ #ifndef __UUID_H__ #define __UUID_H__ #include +#include /* * UUID - Universally Unique IDentifier - 128 bits unique number. * There are 5 versions and one variant of UUID defined by RFC4122 @@ -45,10 +46,10 @@ * where x is a hexadecimal character. Fields are separated by '-'s. * When converting to a binary UUID, le means the field should be converted * to little endian and be means it should be converted to big endian. * - * UUID is also used as GUID (Globally Unique Identifier) with the same binary - * format but it differs in string format like below. + * UUID is also used as GUID (Globally Unique Identifier) with the same format + * but with some fields stored in little endian. * * GUID: * 0 9 14 19 24 * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx @@ -142,8 +143,20 @@ void gen_rand_uuid(unsigned char *uuid_bin); * @param - uuid output type: UUID - 0, GUID - 1 */ void gen_rand_uuid_str(char *uuid_str, int str_format); +struct efi_guid; + +/** + * gen_v5_guid() - generate little endian v5 GUID from namespace and other seed data. + * + * @namespace: pointer to UUID namespace salt + * @guid: pointer to allocated GUID output + * @...: NULL terminated list of seed data as pairs of pointers + * to data and their lengths + */ +void gen_v5_guid(const struct uuid *namespace, struct efi_guid *guid, ...); + /** * uuid_str_to_le_bin() - Convert string UUID to little endian binary data. * @uuid_str: pointer to UUID string * @uuid_bin: pointer to allocated array for little endian output [16B] diff --git a/lib/Kconfig b/lib/Kconfig index 2059219a1207..5a48c016d2c5 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -72,8 +72,9 @@ config HAVE_PRIVATE_LIBGCC bool config LIB_UUID bool + select SHA1 config RANDOM_UUID bool "GPT Random UUID generation" select LIB_UUID diff --git a/lib/uuid.c b/lib/uuid.c index dfa2320ba267..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 Thu Aug 8 16:21:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 817717 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp944142wrt; Thu, 8 Aug 2024 09:23:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUw66nHueM9Uw9ffzwhs/fNK4kpV21iY5ENUgqAqRgFR0TH+pvcgSR3BnxK7T4mD9I/2X63jg==@linaro.org X-Google-Smtp-Source: AGHT+IF8r2hS5eDGs8sRFHqBDiJz8ZP+GIvFOXi0OT0YjheBzvrBm+ylZOIVmXpqgClVHczyKeBf X-Received: by 2002:a05:6402:1d54:b0:58c:b2b8:31b2 with SMTP id 4fb4d7f45d1cf-5bbb3d1d1f0mr1950069a12.17.1723134185498; Thu, 08 Aug 2024 09:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723134185; cv=none; d=google.com; s=arc-20160816; b=FpZHMdfTmzAsMUb+/8ZWnE7/js3BkT1iTmm6n39v6nCsQu4sjIOr/7xNnFOOXeRd3y J9jz2Z9nj1Trw4bZG52zat8124QGCkx/1HPYI9KfIlIRdbXG5ktYBPrjJZHrqt6TAAqK uAuSsRZwpRcYRauJw6rfx0GZPzNLnff3jo0z9CC2FBRvfUj6W9CQNxPL/YmvLwz5tW3A ztoa4XDC0v1sopEFBQUbkrLtDHweMAd28wWEic/FXefLnzSD+hG/KRXuF/JRuY6S/NKR +Pv1aCjNoB7YkXvOridicuQwE0oLEqHTTuh9JSIIOAP819rP0TegdCynBSgj7OXhQSH+ 7f6Q== 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=aSTh8XrhH4atn5NvgtLS9Ge360Nx0hyFY2w1xkNqrWM=; b=qKPn/dNTH7QVCB5H3YC+rUCkHGfNBON99yRzzOSCL6MjidREOTUjBjQnScSHnupzu2 jnHvdfm7Egn3bxmeJi7ID8d5h/ZtZ5sUW+nbssQmQw3by1C90slgUp4FoiyEyw7CEHhv HtZLRbC2miZvreoSHRT1rFw+zGuGnTdmqGc7JNod6vMbBNshoIt5VY0YjBzNU2WW/yBs t6LMBAt+zszOCjjH847jCKuLYRff8P/HUnhhaLNvnYiX8ahzv1JioF0xab8coboCfDZt qrgsIXzDb2A15PREmzRmB7ynSjBkc92sIhmMUQEQBG5HevyfpTD/HH5+S5FryuzCs8EF xVJQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="gvIVeK/j"; 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-5bbb2cfdfa5si983239a12.317.2024.08.08.09.23.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:23:05 -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="gvIVeK/j"; 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 719F988BAB; Thu, 8 Aug 2024 18:22:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="gvIVeK/j"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C6BD588B9E; Thu, 8 Aug 2024 18:22:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8045A88BB6 for ; Thu, 8 Aug 2024 18:21:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-5b9d48d1456so1856358a12.1 for ; Thu, 08 Aug 2024 09:21:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723134117; x=1723738917; 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=gvIVeK/jT6vYtkZvJ26wAxPPE58PWnH2qXJ8aEsRUdmadB/GSVryKzelqh4VrH8ttI 6Gvqxinf+qX6O9wtyrmj+jhRFMc1LjtlKMnW2fP2wiW+Mz/veeKYfbCcCVS0kLy02455 fcZDup9nFp2vxOppOMv1esYSK5pYwAFzE+pvRoZZRFFdbcnpkbrcujpBXj2pCQzXqDv6 v/bEdzum78RDoN6tRsbqFOklp3D0Fy040tcyzfDWqGZ1//5VpMRHhMcL1KxGUnJUQwPZ ZJdP0qtEuM7I2SUTl62h4sTi5WjJwJ9EbGaPk/dLzDi9R4juM+J47uKBJj11flQKmQEv 409g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723134117; x=1723738917; 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=rYq1+VwXDMauB/SEt03ctB8PZ3T3zsSbzNbrBygtpbWU3CkbWhCOsKjjuXrXxJdSyP J/Vk/usVekBjnswhPuRSmWe3ClRM7/EUtD/vA9rgz1AvhlXriPazoRv/RpCZox0Pnlp4 A0fU1OjFusw/asn4Kmecrmzy2g/R/XRSp4gKOv7jTkQtBSqAMT3rZBzLIrN/bldB80ZI ZnmFL87Z/0f1e/fvxN2SHTLFcDMswy89/A7UAJZOMaAUK9Ak76rycJJNl+Herg34PQ65 oIXOykVs2CuuTmf3qr7tECDAy+ag2wikBVWiuKNjq1rsjV0+tIop4p5LBu/6LeSQ6Lqq bGgQ== X-Forwarded-Encrypted: i=1; AJvYcCUVP2o+CTh54bczCP9gyaBNQtu+KlG6mYz0vMxsJbXtLnn7Wy+xpoiYhIOnopdkAEYSf5zlIAw=@lists.denx.de X-Gm-Message-State: AOJu0YxbtYbJED5lr+gIW5hhIMz3vnxQLPEQaAa0YOh841GjRnSSRfTS X1y0sB4bE9mnJG+OQ8a5qusQV1ORyLecz7CElCnzjJcEY9/TMzlBbZcsw5OjKn8= X-Received: by 2002:a05:6402:40cf:b0:5b8:4824:be62 with SMTP id 4fb4d7f45d1cf-5bbb39cd56fmr2066935a12.0.1723134116904; Thu, 08 Aug 2024 09:21:56 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bbb2e5c8fbsm812351a12.79.2024.08.08.09.21.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:21:56 -0700 (PDT) From: Caleb Connolly Date: Thu, 08 Aug 2024 18:21:50 +0200 Subject: [PATCH v6 03/11] efi: add a helper to generate dynamic UUIDs MIME-Version: 1.0 Message-Id: <20240808-b4-dynamic-uuid-v6-3-9332e7237119@linaro.org> References: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@linaro.org> In-Reply-To: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@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/ZANAwAIAQWDMSsZX2S2AcsmYgBmtPCeQKczt29DUQSko+czuUwPWncGANWS6LfCq RkNEkxASciJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrTwngAKCRAFgzErGV9k tuR3D/98iGE3u+e8ziOcqfGVVCwudWSbHVmblNk/nhz+wkSd5qotVEl+3bFcGHmCbfaLLahmXQt S44IZqFHXUhkSmyw6qdW6VZ6zpCi3IaIgRHRTfIWwltgghzqZxbJAYF2FRuq0/tNIcfs7//EOfo NDY6nukzbkd8mnhXBws6xljxemFIYahc1xENFCwZb25gP+67C+uyFA9+z6mR12oqK6j2/5iSYaA L+WZfeMkAg4DgmbWdjcgG2dCCH8Cfuqv7aT4j24x+LoMXLKb92kJe9fHdW4WEDcZIhEpjcH1ihT hMbVCQLshqGMY/CMNDuRtj+eCZ1ANjK1HaY5EfdUhzIHJVQsJySo2VJW0UCPqoz4gUYcVq6NJr4 g+IMr7j2mTwBGozT7kjGtjqRH5WiRMa0WvdFgK81ftRxW0LUfVhnHlXdDlTA30r56YY8mLVn2Cj o38L64uQb2IEVKK88TNrDw1USeT9PU8JJ/zs3TGhr1TfmM/q9JbBw0rGdkAG8SBmarSR9j1vjAF 1+h6cBSOKnl2+qtKwMJWdsCoIF7RMEKKKkPgp3TbIMfmtXrxs9mG3eA/Vik/hpvk3sCt1UZIRA4 BMFMqclYj4dR8euexAJZWtxBkX+cAuAxu0T0DpqcWdBCqYJ0vqaQWTWtpdOoDaTgM6yCkR88i4X Qim8+3MvqMK2VlA== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Introduce a new helper efi_capsule_update_info_gen_ids() which populates the capsule update fw images image_type_id field. This allows for determinstic UUIDs to be used that can scale to a large number of different boards and board variants without the need to maintain a big list. We call this from efi_fill_image_desc_array() to populate the UUIDs lazily on-demand. Signed-off-by: Caleb Connolly --- lib/efi_loader/Kconfig | 12 ++++++++++ lib/efi_loader/efi_capsule.c | 1 + lib/efi_loader/efi_firmware.c | 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 Thu Aug 8 16:21:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 817716 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp944051wrt; Thu, 8 Aug 2024 09:22:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWWX87K8fnLCqceJM35CbR6ha6+0CGEnHUBstz2P5aHFBztz2MMaNXaqNJ10fb39BapGZO3Jsq7oEZHCBa4Koqi X-Google-Smtp-Source: AGHT+IHSepe3RgzQRDIDS63rZYoOEgkjroepZOiRTYk9MOZ9ygu1TC5vjFIxgTN/R34ivKHmKwrX X-Received: by 2002:a17:907:f158:b0:a7a:9fe9:99e7 with SMTP id a640c23a62f3a-a8090dc0ea8mr172605766b.41.1723134169633; Thu, 08 Aug 2024 09:22:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723134169; cv=none; d=google.com; s=arc-20160816; b=BtFTUZPnU4CNtvFcNzb0+rf+6MTMsO9jTtNmXvp9VW10ZSKYOyXYOj/2CaA82RDbvE aSAoT1eomHZ9X3aoIo0O9lZ34Qxu8Y7DqgrwABtNmL2NiI5cwebDiYxmwzDRTFOefjN0 pB4MvqfPVOoTAYNVOgVVhhJlxhhOmjz/XmsEa3XUGLR5lyKwOwC9hRpzCGi7ig4i/w9O K8x8TytMbEAWCJXzJO8FYWUxWLKJlLBI4cKnCvCStpuF400mRmZoQiTynW34I7agyLgW H8TNp2ZCfgolOaMqdnXfCX2KrnKU70s5RHCPSE6bTNury1fw3xpmgBaxFZZb/KVrDFBV 0pag== 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=ircKx+bKca8yvrv9KUCe14ZQ3WIhFL2xBjRWuQZnZNI=; b=x2ytqYp7UYEbcRxYcdOGE41YVrn5LCg+fmgHxqQddbosa5OnMffcGlWzCYKAuCgUfw aWbq+KPurUVNeHP4FKPC/UWlgod4xmO7N/XU5DRO+/mwJgl+83a7+jZ/g9o68TLujEzo DXC0DZHpANSGIs2qHemVMICiUeIzpQbYg7LFJC06ScDaHc84cHcNV1EdKWz4Lfx4ZQoM YHqKmGXVqcxi0dF8xv4jWhbr4JzUAdP8hbPbU+Jq78AnLb2BMzl4TEiTZvntMdctzPT9 E7EQCGIxcwcbV32nKijxKvsXzvluFtqBGJXc/nG01wBzX3WZy/dK8F6D1dXY/C2SN9c8 +kzw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AwCfV5UX; 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-a7dc9f12f0esi802941866b.767.2024.08.08.09.22.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:22:49 -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=AwCfV5UX; 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 072B788BC9; Thu, 8 Aug 2024 18:22:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="AwCfV5UX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BE7E288BB4; Thu, 8 Aug 2024 18:22:00 +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-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) (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 CD08688B9E for ; Thu, 8 Aug 2024 18:21:58 +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-x52f.google.com with SMTP id 4fb4d7f45d1cf-5b7b6a30454so1471887a12.2 for ; Thu, 08 Aug 2024 09:21:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723134118; x=1723738918; 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=AwCfV5UX7APSIZI1Twd4r6V1JU1rr78DKGQW6dyJTNO3EOl5PWswWbAjN5jAkHxik3 LMhXjQl0YtFHmnhPMU4Dwgi3kk4+hzN8yI5YDuRukjJvp6cT4t9o+NlF79vYf9Lezj0c x48zn8X8RhqqXXtLkYQH0zLsiRPrMrwzNy851nj2zYvFR+SDvUO5J4qNqUi36Y3YXyRc FbGVOW6eBBoni0notYXEmWle/OTv+F/D6/uero7N9P5W0u73Nf91nFuImXKuqA+z9phd FU/ttQflXOlAv8dGGA34O4CVwFP79Q/GxarNA9K2X2a1i584U0MNCHA8pgNrZRZzAI00 09FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723134118; x=1723738918; 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=juSGMOz7oVcqT27BNia0YwzZBzLjFU8EcnrgKOmfMEpuJToa/GgaMlDmzorcPBqhot HngDA/sP4e/9l6rxWE3Uqkde2mlB9k2XbTdmBKI2z3vTbLBV7fIKuWsnGfBi537XB8Mt E2FY+64rgrWOElL+1+pbVae32zjZ9whk4m2i3YKgAkC36D+b/nVNtsnfvkjdcyj39r4A Mja+J32ZRMiC0DUP12BKjV6hLqTjYquBT/khYHwNiR86F7PQYatp+iafyWDx5R6FuQIa 7m2ttFIbKexFV0sk5p9Q5FPn6kNXHT6bR7oaw0o/tHfoO5iUGzaQRON3FScS7MoNfX5B e+/A== X-Forwarded-Encrypted: i=1; AJvYcCWH9QPGLZXcCw7ZVMhzY3jU/+lw8QdATextY3Nm3RVhHMaY48cIW7pdHmdlk6t+DYeP56jevq0zkgi4fuAMqMgm4RWRWA== X-Gm-Message-State: AOJu0YyNWWdH/ZjeXlbKJUpGnlgBZ4RX4J7IOGDnic6ljr0Uz/wLmv0O QyWgu26NhT1og2jMrdEgtwHvxOIgYX3YUoTah5fmP69CoqwgqC/vEnOFHTaLONU= X-Received: by 2002:a05:6402:1d55:b0:5bb:9ae0:4a41 with SMTP id 4fb4d7f45d1cf-5bbb2338672mr1773155a12.28.1723134117989; Thu, 08 Aug 2024 09:21:57 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bbb2e5c8fbsm812351a12.79.2024.08.08.09.21.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:21:57 -0700 (PDT) From: Caleb Connolly Date: Thu, 08 Aug 2024 18:21:51 +0200 Subject: [PATCH v6 04/11] doc: uefi: document dynamic UUID generation MIME-Version: 1.0 Message-Id: <20240808-b4-dynamic-uuid-v6-4-9332e7237119@linaro.org> References: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@linaro.org> In-Reply-To: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@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/ZANAwAIAQWDMSsZX2S2AcsmYgBmtPCfbmx8zS9BaKx23rvSDdv1h0IrgBiB1yHZv 2LVq9vRRDCJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrTwnwAKCRAFgzErGV9k trVCD/9Sp7c9r6ckFrsozmJavSoyIW5D0ZYMcSbn9MJC9gnll5QuTd0/vDj+pDBBrju1v4M0V28 evJIvDwN/Erb1w8865v90EGrGKQXV+xphWaMrY3AaYtmfSyc53hZQgI9GS/shSTJh5iNXgqzxiz zC8agVYs5URKdS45IG8JyH00+hM6ExbCWjwjT8uflufVEIgULyekuoWKl0aD1SePkEynSPXQUUP tXeIBhwfHU2wCqAxp3rDug/Dei6EdVL780hoCivjKZpJASrnM3qlnmvVev8Q+Qpvc+ksSza7tZu O+bCShdnYT2dxzpMoLMsTych+40rpbc5DxA0CtXw4aYnDUkOPsHflFy1H0NHFOja47qAw1p3BYI XGdXjiDrVXjy0O5WjGcjhs9GXXL9uRwniNBRyrbZ/RQ4IL9gowDDSFjFYAtV7JZvxON4a2x559L q2bZRmN89bW0DmI/DOcq8vWarpBuPx6NUn7E660lDMCm+nSyDTksZ5Ffz+ZoPhA0X45vD0lBXnP Ovjaf+zt5++r7M8/OjXfDd7II8pLKLjuXEKA+2XE4Zh9Xy2bA7thucn69hw5wRi7Mv2ux564jMm AH9mvQNbCqbq9XaD8AZIrjVdqLW3PuOA9lTgrp4Ap0Bp1h7QWHlojKbrv0ZYgY8wTNq/MJfRh8A cqRaZG+A2unwAjQ== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Document how platforms can generate GUIDs at runtime rather than maintaining a list of UUIDs per-board. Reviewed-by: Ilias Apalodimas Signed-off-by: Caleb Connolly --- doc/develop/uefi/uefi.rst | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst index d450b12bf801..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 Thu Aug 8 16:21:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 817718 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp944171wrt; Thu, 8 Aug 2024 09:23:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUjzzUakBL5VJyYSCWgwo8gwDMtpKZMan7Uq3FW41xrlk/EpN3jnbFaho7nGsA7IH3FgKsAs6jCnABzCr4dIMhf X-Google-Smtp-Source: AGHT+IEAOtSrzxA0RlYx/EUpO4ZErcFgTtnMabcp4R+TDnx7rIz/vlDAI6OxWkTH3377ftDFvURC X-Received: by 2002:a05:6402:234d:b0:5a2:a0d9:c1a6 with SMTP id 4fb4d7f45d1cf-5bbb21acbcemr2137556a12.11.1723134191858; Thu, 08 Aug 2024 09:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723134191; cv=none; d=google.com; s=arc-20160816; b=kPGvi4XygOoRL8VwEEargneGGO5R/RM+r73/ERJt1h4xSkvkIfkGsYe+IDIPJlwIM+ 3J6+wghudiwsiX0pZrfIgAVM7rqBqrSQo1MvMd/+nFAeVX7Rgn3Lnxh1p5VapAdjFNRD ZiPXRN42ryyH7jsxpn80KU/xqkV7UEH1E+HbdaXZx3720Wbq8FFBJLYRARAjQ84KJs3t 4M7lmld0aOG0AvoWizLGeL19MjDQA81YrEHb5a+9LtpXmmwE6l5m130Is6PgWOqT/quJ N7EN/dBsApkToWOBj221wakFGYKiGdEs+peuc1ab+NebWN0LCN336hU2yxVoWtUdbnk2 tSTQ== 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=ZsrOKGSSRKo8Po8D/5a1r7b+KMurky+xNs9rTYRfNts=; b=Zt+jmxl/W9YjhMZxHJ2YmkgXxFkvKOWj0kmT+ATodLOPjq9mtQK9BNve+P0hvLpB0g 7TELdCZAAC5yMi1O0Ij+qoc6b91J43O3c5Wm9MzH/0NTlD4HiqRPBkfdBb1RziwHNHtm YV3RaG4PLK/Y5a4JLHsWfiTMGIPvi0cwc49PR24k9a9yLnnePfrR66um1Po8Jbf2Ncjf PHwAGgUMkNqHN3wIIYPmdsr+AArzxs2E3GMmXzd6/PHoydamKhkQ+x+p7NL340p40bQB VZn+FmthFuwtZ20XBGDNQplLwNnRJXoWYiMYDrNrryBFXpBTkSiA7DDp85OyKwdce+a6 MD/A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VrtZR6Bh; 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-5bbb2d23e16si957038a12.372.2024.08.08.09.23.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:23:11 -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=VrtZR6Bh; 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 D163F88BE6; Thu, 8 Aug 2024 18:22:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="VrtZR6Bh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4AB0388BDC; Thu, 8 Aug 2024 18:22:02 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) (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 170DB88AE8 for ; Thu, 8 Aug 2024 18:22:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-5b8c2a611adso1557100a12.1 for ; Thu, 08 Aug 2024 09:22:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723134119; x=1723738919; 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=VrtZR6BhFunnnAHpk3DeQfy+o0cULbLf41w/+QS/tQtxOdw5GHxnNRRc8cp7BbvUhn yk9mLbGpRJp/btx2Y+/1TGW9TFj1MxYPe4Z7hYZnpdmdqlP3syWqck6AyrY5XUCBHiK9 is4fOrm6hhN9sGep+SpW9rEj48yEwzqxDqosihQusDCj2CZYLzStjEiTPGsB4zqmsFNt qN1qzB3NwW/T5mdMsQZtl36lPzwEiL4JMTNm7UrgH3wXZDHarbzfuLe9IMgr2AshoxI/ LOYMeaeZnYWSEFxV7PkeeutezuiKotBCZRWGPExnPCu6nawtxKlfXxj4xjQ+dRR+Ptvf jO1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723134119; x=1723738919; 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=jh/jFk5OxDo5fj6NArjQI9q6zTodUDw6FDfkGD0DEpxwgVbso8eih/YqS5fm3cTfFn hZs/emzN9n7xv436jXQFSAsdlBhDEbonG+te+ExdaH9FE1sOvLrtpIjJRsW/t2TMU2fB S2RXZRN7/JglWG7jKIDriS0bxu5URBj+URLTS4guRcKRITP04UcmV/413H9dUYkaA0er EEv48oBlOmCeHK2kNS0A6Z2CP9yUfwekD7BfuUucF3dKIryRoQyzdZwC2jkeLP5nWqkB WMMixG/uNK9fE2jf7nFUwsLtxCRwnRjJAvh99SpF5jR50o4mPHPTmJ74cW4rZwMm6txa mvvA== X-Forwarded-Encrypted: i=1; AJvYcCXJxkPKX/sSP8A4PrpPMcr0C1G+SFE4XS2fU1gEJyUpsjsdv5wh4VJNtqy+DUAC0q3qYEcq5hkXlqfH5hC+dM769vhHzw== X-Gm-Message-State: AOJu0YzC3lpaMtYw+rG/zwvLIw83/BEjxE3PuX+fwy8HohhZJm4+k4mW LggfzHuCb/ej+MC37eetwNRYnwW7B8G9wjx3cAuo0D0tBQ+37uGY0D2/z5cG4EI= X-Received: by 2002:a05:6402:35ce:b0:58c:2a57:b1e7 with SMTP id 4fb4d7f45d1cf-5bbb218daadmr1920249a12.8.1723134119302; Thu, 08 Aug 2024 09:21:59 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bbb2e5c8fbsm812351a12.79.2024.08.08.09.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:21:58 -0700 (PDT) From: Caleb Connolly Date: Thu, 08 Aug 2024 18:21:52 +0200 Subject: [PATCH v6 05/11] sandbox: switch to dynamic UUIDs MIME-Version: 1.0 Message-Id: <20240808-b4-dynamic-uuid-v6-5-9332e7237119@linaro.org> References: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@linaro.org> In-Reply-To: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@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/ZANAwAIAQWDMSsZX2S2AcsmYgBmtPCfvJ+fT6r34V1DPUc+cQvFk8RiAhkXnydfx YWvQMo5GYWJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrTwnwAKCRAFgzErGV9k tiD2EACQQ7/r5V8AdsNYKXFxeBQB+b7obBko2+csl7yVU99QQ7HCM4Wfm58ouf/WYFlxj5bOxWv jDSJ9ZwSKr9riAV+eW8LKYOjMReKafbZZUtqUZL6bk7ZClJ6+LEhrX1t854IugX5ULLBB0tfSKe n/3u/ZiAl/Y9/orFSSZ3JL/f3W5TOKt4I+F5TCVvVk29L5W85DvV+UA/fLMYwwUIDECrH3PRdzr p/BuiTjOVQpCvgrpxSoIbxtLANmQXdgrLe2BN2J3sARYn2m2JVUsuP6Uwem/b66wwpEuiJpPbcZ KuXtgpfq4kjQRvzWbwZxW8lSbWK+saGhFuvGgWHG/VBkNiLi9QlvP2MCpP8xXMzTgXTIE2FoCAf 0NabvB4SFFRRKUiUfw9X3uv7fjj6kuCf1uygr+uRMyZx6CuS3GyJ1MpYlewfWZp9PlG8RYitjAA i71T4oTYJXylLRWKLKywee9BGn8Q+cb+Rcp4YzQaq0+bHvtDn2oHlMBui5ghqc1/WUVRfQ7kwF1 hRSGk8XTtP2zPBpOTWIbeJmToDkFxS9e7faMim8ELDXqbiLkBy2qB0xP1TZhDcI9u5zz7AdJZz5 n4SC8ZI1qoFXAIXSIxRdGGI9LCAbQ39HD44w9gb39APy59McOwAfidQZpxsT2/XLR5IcxL/Mt0Q M824mwd2S3OkAFQ== 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 Thu Aug 8 16:21:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 817719 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp944248wrt; Thu, 8 Aug 2024 09:23:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXNkflXNAJvk4p7Za7lJiRZ/NvaokWrh/Bvjo867/2XB7iXAPlqRP2V7FI4E0zgGq9UpXBXo2IGq3gfKSs67zGI X-Google-Smtp-Source: AGHT+IHSy6zdaMR2KGGEfVzYw3RkOu9brnebgaVgaSy+SRyi+Yz3fV2FX1c/oL7mFSuRMr0lsnhF X-Received: by 2002:a17:907:9816:b0:a7a:8cc7:ca48 with SMTP id a640c23a62f3a-a8090e9e2fdmr166443566b.46.1723134202531; Thu, 08 Aug 2024 09:23:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723134202; cv=none; d=google.com; s=arc-20160816; b=piRwf5qxfaGNxRP0RBI1podSO59GQCqjzJyC3gXTrqrP5bfzyehT0gzZozpvGvOyth zFO5efO1R3zPDAHUxdCEe8IBRYbk9LOvLyq0xK3zcPlkNH3vR5ANF+rEtYuAbdNMfBU2 pEjqFYG5UVl4wrQAwg35UraA40Ny/HbrEV9SkYHTXgCuhlEsDVc84TZWzRDWeubXu/+y RTaKrAG6qNzLJ/Luyb3RGJIPErPhMUGr1hztC5J+/X8XGGb5m/1a1yR7kPiYmja3dW47 XL6HVD8zLWqp6Gu/QxiwYb1DY1zigd3G4mK5340p/UoB6Kj55/QeRzPZciwv4CWLWilL Eflg== 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=aYagj4p0YuqzhWZFyGBFDbXaH2yfGcBBttc6FuXi5H0=; b=MEFTShdwfrBJwfXIApDP6cggxkXTDMJl5j+EDRGBGeWEQB+Liae98ySYwUNRvHc2rb MAxlVPgm15d2g2jP+BKW8drSlHWsGLwf/OZbZLAk2lJF9oVWEtaaHKFDrQdsqcbQZAIy v7Y7uvvtBANCg2D4V4Rerm1hCsbWQ2/PXrBUavKRZTlYDGFMVFFFAtrsWj3S+c7jWKgw gizOm+8TCQ6JRNQEKEqXJb+CgytpefG2jDHlKLlbTNcpGBaNrlLoMpWSzrLyEZd46DXE b69UGYugvAyh8eicHFhJJe0GwYAGNMYgVgBKzX6MoRTlfLENyUSO29O+nBooPah8w3cH sIoQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tkX3nXwa; 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-a7dc9f2afcesi848934066b.803.2024.08.08.09.23.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:23:22 -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=tkX3nXwa; 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 3520F88BF2; Thu, 8 Aug 2024 18:22:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="tkX3nXwa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4050488BE6; Thu, 8 Aug 2024 18:22:03 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) (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 3A206874AC for ; Thu, 8 Aug 2024 18:22:01 +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-x530.google.com with SMTP id 4fb4d7f45d1cf-5a156557029so1420802a12.2 for ; Thu, 08 Aug 2024 09:22:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723134121; x=1723738921; 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=tkX3nXwakUBUqNF9MRX7pCgF/NHAQVMjnyxDsRFhVRG9SaH/XeFa0/4FDJ0o2SNdaN lVVSW4tMpCH28KLj17Qlv+4CHzIpv+uA7GoZmz9lxKC27oMN0b0B5t6ZJK2YqEdekTna ltLKV5Y7Zm1BeYMWg3a5TIHOgc07wr+SsSWaHVFb1IlX/rpo3ebH+n8xNFvpqZWinp0P g4DOg2lFMqr/CzZ+x3UzfSmsy3t08qFVeek+vhy2RFCbPI2PQp+G4cZAMHx2a4pjFqs0 dZOpdohldq8R8u+SEICPA1MMAJlZAhEuI27/+DWWSV8b+SQkAUYgvvKorBZ2T1HRVbom FU4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723134121; x=1723738921; 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=N/0GE6mcENQpgt+S0yOQwJ5V57uoZMolvcKlJgd6GHsfeOd9QT/IUjglEOlFFWCupd 9pqFhUvUAOWvPXpdA0Hkmb6buAMWwUuH+yl0SG8eTBepGGz78sWyl8NRefrQrXj50rdX pVNo/7vrWOvO0YyaN2kxFoyxB1D1aL3rTFduPXagDw12Vny7ulK6ZWTyPZf9j0FWGF3y 2vTB7qZvoL1vWGPGfzK+BAggnNHCTp0TAqCyFMFbsi2Sq1kTbaZgEQDiXZP5WsWQeUL0 sNERkaiHkJjrwGct29sRAP4m6gwFJVFC+cy0TUqAGDZj6XgvjHb08uRr+Gxqn4gr+i8x VfRw== X-Forwarded-Encrypted: i=1; AJvYcCX3RgTqhM+ykM6ry3XHi17WFQhAst939jWkMP7K/ix8QfvOl5U7oA68YIjC+14Hb32tCFvzTq1rwCAYjM2ZA/EyOUsclg== X-Gm-Message-State: AOJu0Yzoc4qGydSYqLLcCDLmbpLhpC34DPlVmfuziXeYGLOQY9ZytiRw 0wxPwQ2KViLcDBKU1uttgxstez3c8rDOXUxrMcI5XPOc1CJz0j4YEZ/6DDlD+e6Lu12MsXql3Cq sdXw= X-Received: by 2002:a05:6402:274d:b0:58b:9561:650b with SMTP id 4fb4d7f45d1cf-5bbb23f6b24mr2323446a12.25.1723134120554; Thu, 08 Aug 2024 09:22:00 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bbb2e5c8fbsm812351a12.79.2024.08.08.09.21.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:21:59 -0700 (PDT) From: Caleb Connolly Date: Thu, 08 Aug 2024 18:21:53 +0200 Subject: [PATCH v6 06/11] lib: uuid: supporting building as part of host tools MIME-Version: 1.0 Message-Id: <20240808-b4-dynamic-uuid-v6-6-9332e7237119@linaro.org> References: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@linaro.org> In-Reply-To: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@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/ZANAwAIAQWDMSsZX2S2AcsmYgBmtPCfuntyb3xwQG1ehEeDz6kXhot3yoLyHH4uA 1rITKCUZ7yJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrTwnwAKCRAFgzErGV9k ttExEACH9GAWvdpBTxLEKEx4O8ZYmItj5Q9lnP4+9uZ0ytYmFs+499iWHYXiWGGCfbkik5pySRb PY95lKe/rgkS8VewwcE1z7s2XgTkhnS3OdAQZfPD48v0rohvFQGTRlCihaLyhnoQdO97r5+HQK1 XqLTwo0ii12q4rHAIaMrWPCfcmt7Q+A5amM6ba0l4UW0wNGhUBY72KNmZyoMy50DCekFUt/7RF3 TBt6NC8ICQPocV3tUVhXb0B2RaodQTSLPPPOJ6FnpyevjDmRq4LoU/gnnFmG3wP/pnOy65HnD/X BGFeLHIns3HDw0dCdKIiSNPKwzZQmjvz8eGBPoPUOjXgkN5VdOWr1jVqC4kRRv9fGrUhZl0X0AY jlXbBhFqJzYBrzN6hJJnbAVVhy2LZ/12hs7e8VhMP3E/AgOxIQzFFadrkaeUJ++xovyIJXbx72X KcieSASXU7jAQzhzteE/RLDhATE6rJyfCwBMC3oZh4WlaqtDM1AGV50WvewzoAZMiisurssLPNe jvDHkvvfQOsI0ogjxyrsqaniHE9SmGZRGUQqy+52yNu6RA5GlSTyN+Igp81bQn7l2tHFRnhkQlU CDntIBc27HP9chwIPl5NCda8/wSByWPCxk0q6iZDNaiGOYOTtQkcT0XL4yKFs2DXvFUczB9cCqU LaJjyisx6THC7AQ== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Adjust the UUID library code so that it can be compiled as part of a host tool. This removes the one redundant log_debug() call, as well as the incorrectly defined LOG_CATEGORY. In general this is a fairly trivial change, just adjusting includes and disabling list_guid. This will be used by a new genguid tool to generate v5 GUIDs that match those generated by U-Boot at runtime. Signed-off-by: Caleb Connolly --- include/uuid.h | 4 ++-- lib/uuid.c | 44 ++++++++++++++++++++++++++++++-------------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/include/uuid.h b/include/uuid.h index 1f4fa103b5e9..7f8414dc906c 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -69,10 +69,10 @@ struct uuid { } __packed; /* Bits of a bitmask specifying the output format for GUIDs */ #define UUID_STR_FORMAT_STD 0 -#define UUID_STR_FORMAT_GUID BIT(0) -#define UUID_STR_UPPER_CASE BIT(1) +#define UUID_STR_FORMAT_GUID 0x1 +#define UUID_STR_UPPER_CASE 0x2 /* Use UUID_STR_LEN + 1 for string space */ #define UUID_STR_LEN 36 #define UUID_BIN_LEN sizeof(struct uuid) diff --git a/lib/uuid.c b/lib/uuid.c index 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 Thu Aug 8 16:21:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 817720 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp944344wrt; Thu, 8 Aug 2024 09:23:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUFEofhCZMFduW58dL4cmHGxBlUYVpjYm58wr9JQhee/3sn9+aue8q4rkBTLvqzhfxYkI8LFQ==@linaro.org X-Google-Smtp-Source: AGHT+IGd0K7NJURrCKdvhTiVkBvERElzd4DibsK6biNNjyYr4QUm/+qn94LsJYBhQqOZ8Kqb+B2U X-Received: by 2002:a17:907:e6a9:b0:a7d:e956:ad51 with SMTP id a640c23a62f3a-a8090c68632mr178308766b.21.1723134213564; Thu, 08 Aug 2024 09:23:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723134213; cv=none; d=google.com; s=arc-20160816; b=uUP/idCioV8slNJKD84nOpPSRuo3oSPdcYSWmL1oAsWYnHsVY5xQGbdkmVEJjHwORw fJo/ot1DF0o6t4M3dbDBgasuoO5AuEuofBqNat+kUwGbnqBrAw7ILonA580rziIfLqnj vCCWaq5zMpS7x5i12EzMJRoDkf5GwIWhw+ehsTZjsq5rcrQKvUeXY+IYY31njJveflHY pQ6Gl2bBF+JTh9R0hlvMFx9NjEGZT4OFbg3soYEwxGxstbkfRW57m+0E5HsDt0Vipj+6 cXXE2yCqnwyCmJnUURg0CmysYL1Ruhow3ZMYzqfbq+2Xk7QDV4JFKwKVw7RPN3GwK7rl JOrg== 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=4ib3+eTrlhqshNYqx6z/HNjTCr+q3IYirhyslmHZzvU=; b=pJgBXnZ7TgNBRjCu1L5IcuZdM/5YOsuw0F5Uw2UD9OhnIqdQdCmawDWzjML7EtVmrw Xppfu/tnbsCFbxbI7+8NXtuCy6kE9Tktwn9/7n9c+KPTUb+iPfMbeZpteHVjSI914EYE SE+MKmfp450Qfm/PLgZ3EbTe4SHNOCuS5PzmunQT5ffQD7WLcsPj+caLWdLhSMO61Xpu pWDUBSNPvnoP4OzoO4BcNuxgSVAl9BQ08OzqW8EtpnqV8ju4cwhYN0/j7+ZiAc241IB0 DtemARy+NFKzs9rL57/D0Rsq3a0J4OcTAJnTIli1mDATl8xTFIqKFWYIySjB8atrFEPY g74Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qbi455X2; 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-a7dc9bcefdbsi791841666b.66.2024.08.08.09.23.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:23:33 -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=qbi455X2; 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 9686888C06; Thu, 8 Aug 2024 18:22:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="qbi455X2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9D63688BC6; Thu, 8 Aug 2024 18:22:04 +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 5C28088BE0 for ; Thu, 8 Aug 2024 18:22:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5af6a1afa63so1319422a12.0 for ; Thu, 08 Aug 2024 09:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723134122; x=1723738922; 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=qbi455X22SNtutiVN3cN1p6oBRG2TPeGrSQh62Zf4On9eeYwjkEx1GT+/2BZPY2cI3 6KIplWK4YmpK4tGYHt6PyihDv8Qg+YaT1a9kc+PtxRGUrvV+Bc4pD2iirgj/bY11CPdY qKZwjoWuz5iCIi7a+paAzVzKS133DYB3mClcOZK4uahGOphNkkXtScDwfewQvVpQuALY rAuFAQbVKbyLnwJj9roUoiRgt4NQ1k76cheY0pKzp9Fgdmmdc0I+Ss7D7gCz1QCvLjrN g9ozhWSpsJFtvx0HYo5VDR2vRIzJylJRRzbZG1Lrf7u4jPM7atY1qKIiLkkb9IdyKKHL /EKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723134122; x=1723738922; 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=vUdJeOrp4kBw6dcJxtM6/4yYdx25M/FhCrCj6qyjsw0LJcGcCI7Beyy0uxtpwaTxS7 jUhHw7vjj+3hLY2hQdBOvReFamLVOvkUvM9no2e2LbmQi9TCfiP4RvSvzlo0on+dJto+ D7JMHA4+sXhrJtAqpoX7oYdMIsxFTFzPZpNIQU6jlRe8gVZRQxO4mVRBJUDBsstZwfrE 3JKvnFlBrQATJhvkWCRgTIE10DFlyCYIwIGG0an3gfj8MTusZvU79+5eYrd6+x6gQB2d PHWgSaeBTzQ4CsGN9ieXtdScwGhse2wITDfpIWuuis9XahqXlKPvcPg1lpZqENYk5Rr2 4nXA== X-Forwarded-Encrypted: i=1; AJvYcCVTw8S2NzhKDMgBvLEfHBtV91BEh2dzt67QC07FAphi+iYMV6SIgsluiYc+P3HU07ySRfuVmFg=@lists.denx.de X-Gm-Message-State: AOJu0Yz++wDZeRq+1lMKBukB9BwEP4zfmPkBIzfp1+5n/THoGR3GnhoM U8Bc+X5HXoMH9Y8+4SWTdDnCKvGRhegjQJv69AwCz3uSw8ueDIj6kNpsVSaD35w= X-Received: by 2002:a05:6402:510c:b0:5a3:8c9:3c1d with SMTP id 4fb4d7f45d1cf-5bbb2231273mr1897830a12.14.1723134121732; Thu, 08 Aug 2024 09:22:01 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bbb2e5c8fbsm812351a12.79.2024.08.08.09.22.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:22:01 -0700 (PDT) From: Caleb Connolly Date: Thu, 08 Aug 2024 18:21:54 +0200 Subject: [PATCH v6 07/11] include: export uuid.h MIME-Version: 1.0 Message-Id: <20240808-b4-dynamic-uuid-v6-7-9332e7237119@linaro.org> References: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@linaro.org> In-Reply-To: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@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/ZANAwAIAQWDMSsZX2S2AcsmYgBmtPCf87fieKx4VhnHrLa35fXu2dEIMoeIdjtos JqrpaPmyamJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrTwnwAKCRAFgzErGV9k trJUD/9VyQZ/mW3nDYUEkmTEfKVXHpVPKnIjRY7hQWlH3V3VlkwwQ+Tkxj+js9YvFrNrGnyE9wk 0Qvau75EJyY0fsIGfdjs/PmlTrN8EL0eFkGpDpJk1mveT1qG4RK/2JnaI7EJRgj9fqfw3DU+j64 LO49shDtmJxMYLaJh++2WETOxsUThCrF3tSHvTnUfqy1eKYIPrX06lbODjlaX8HY68uduMKUlRy nk2Vv/dNNArrU8SXk+ccBrA2YS21P72JIGHPAiLjcpuz6oe8LZ91tYrcM+JkWSLb2taB1MvuWgq oTvYTwJocSzxT72j/1i4aRTLkgMZF0M0w6koFDPX8xSWw9ok2AMD+ZRNG4y4EG3aLcl65V/Yai7 fKrLriftBUyTGXJU+asY8fxTRd81Jzort3AOERA63AaozZh5vMoPwOmr5xl9vcbVryypmmN40Fc UzMCGGC+KUE25Kol4B/PWWAijDbkZcd8Bg/v6AyiAnDgFsiPkL1hYySdSn6ADuG3xOQlyrieZzd Sfh1c2pIzVg+Mrlt3+UY3mcY+cZ81KdOd0NuBJsK7tLVT1UW9E00dqDsXAKrj74ktvS0t/EKFyn cyxcD9iORkj+PGPDQKmXxHAjiTwg8Dig1ssv2sBZ4EXs5KvqYpS4Nul7cuBxE6HYD9n6oxf26Sf kT2HynyCEBs4PuQ== 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 Thu Aug 8 16:21:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 817721 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp944408wrt; Thu, 8 Aug 2024 09:23:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXIfC+KL0ezqEoX2S6EwAi+ZtV8RIPVap3ax1ffYKDnfSc34vZy8oTVUxZf1uVspxiEttH4ilDLed8x4Etj7pcW X-Google-Smtp-Source: AGHT+IHOKqBX4H4egOit2e/Ef6yOtubhgG4FTa8H0l/lTGkrj3/Ft6Z1rV6xm9Cs7ZCeFBeG8c28 X-Received: by 2002:a05:6402:51cb:b0:59e:f6e7:5521 with SMTP id 4fb4d7f45d1cf-5bbb21e632dmr1760536a12.19.1723134225357; Thu, 08 Aug 2024 09:23:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723134225; cv=none; d=google.com; s=arc-20160816; b=OaqzUdXQXlGjRrkcmE2g/Vfs+gR27UIvIBw8MG3HpOX5u6JckZbYF730B3LmLdVm+n T3LTbi+h16A8rOlVWlK6552uaQRGVFImlA/9ZLTmigw/8LJPxhECYaKcXDK4U4p/hfc/ ffH94fqlGPb6Ss6M3nuTTpBdo6eARBauLQOINiHOcUcnvvaHsK2K3i//UMqr/o4/aqJV PKLLyu+Ym/GV/BxwWF+r/ElVf3ceeBXBYcoTwJ+zJkbGwoBY9ZL6F6cc/6rV5RCHsJDN u2pTGtZQJLjRj3ZdQ0oGZlkG0SKzR22Dy6Vdu9LkWuSaxcbH26iJO+aXSl6SLQkRgIfu fOgw== 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=agjZ/guIhEAMhHGPPj2bv2oQXLz+AJM5FL9JHK/5SKA=; b=Y7VPaLW09+2W0m1lsHAEC98c9lJ8arsGekgMUq+ztjeDZBTuJIVi1QnmQSwPFz7S/b qmXZThS2DdgH/YaLlKfKQZnft4hZrZV1Rsnrkd68lRFkldwY0I1uKogiIX07IMRcIhWP tevoqWU+PQ71OQQmLcnUnjMC463ttrEK24QnMIBYDbjkwTngAU475V7kTdTUyqkJ1K2a hn1XNcstHALuaGFGfXIPHDGIPj1TekJwvVVQdQsw7ewqUK4s3aI9x+Ib+0mrK8OfAvpd 2P0N1+pLnIx5falglq8puICDoYJ37qKx2xT0Et/cqPS1e4LXIZ20zhhOI2pU5tfw0fBT V6oA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="YkELBb/v"; 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-5bbb2bf9e4esi902670a12.18.2024.08.08.09.23.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:23: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="YkELBb/v"; 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 0B38F88C1B; Thu, 8 Aug 2024 18:22:08 +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="YkELBb/v"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B85FE88BE0; Thu, 8 Aug 2024 18:22:05 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) (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 AFE9C874AC for ; Thu, 8 Aug 2024 18:22:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-52f01b8738dso1042714e87.1 for ; Thu, 08 Aug 2024 09:22:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723134123; x=1723738923; 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=YkELBb/vsNkUQovqLMMXIgGvd5/cCxZrMNRbSLIX3Yr7KtLI4yCN0vdyXwLU+cLBtj DOINazuHGd1xGQciwohVtl2vyg+XXpKqdtYgzKc9OGE7bGG3Idze/jaCgjy7KoWQwJh1 Bfp+OlwquUi6eWhRTvOyeeaQdcF0KXEfq/GVayG4igYx16dvAWKhd7jnldXRUqI/BYlb 6goSBhi8/QUY83F6rMurN7i/u11w2/Mj52BGMOwiXO3842Dq6ld4Sy/KhIiR77bHCbl7 BsLN3U2zPW9YYOGOTSpEX8iYCb2xXPcp2vxUClfO2qAU7FMUjBnCq3eCGf3A1/y/rAae OCsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723134123; x=1723738923; 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=gO5eVLFKE7WUTGpq4MtykSKQL/+Wh4d1SPZIqiFbzd8Of88N9pwDMbMcBayuWNhey0 yJJY4U757jUOMuZKIpPBHWLrvtaNMa6jxmcvFtHRuLhVVrBlYZNq1Viv5uiJf+uNvQyi NuBKtJv20/RAuX+D4UFQHAVui6oaLCJP9gdmyepEvFempapMabM+qIO7pGnpVaJtav7M n32CMMg/wVhp8IkiLHJYrwgU5eMYYuAdBpQ4ova52SACl8fekJL7Cr7w50LshyXr+YEW C0gBuPiXn7pOmccLJUjkeA4KgJWoekNuRXKwjGdScMZGuDJQwQ2Hu42S8g5hN/tCBehN JNuw== X-Forwarded-Encrypted: i=1; AJvYcCWCR5wd8cuM4NAP84L4iBTqni589knkSUpvpmqhDc7NHBt/ZY0qthiwyjcsX1uVusjm5Id8mBegMa8CgXerr2u8fQX42g== X-Gm-Message-State: AOJu0YxyojxzU2EYC/E3H2G6ohXUiMwtNSA3U4EAjq1IpGCF8ZXdsH/5 +iOM4U3AklVSgRsbXMGtoWEM1PuYzWS+tXt0pcY4Y2L6KxSBUNKkuamt28vCgYY= X-Received: by 2002:a05:6512:1149:b0:530:ac0a:15e8 with SMTP id 2adb3069b0e04-530e5817bc8mr1747030e87.11.1723134122860; Thu, 08 Aug 2024 09:22:02 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bbb2e5c8fbsm812351a12.79.2024.08.08.09.22.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:22:02 -0700 (PDT) From: Caleb Connolly Date: Thu, 08 Aug 2024 18:21:55 +0200 Subject: [PATCH v6 08/11] tools: mkeficapsule: use u-boot UUID library MIME-Version: 1.0 Message-Id: <20240808-b4-dynamic-uuid-v6-8-9332e7237119@linaro.org> References: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@linaro.org> In-Reply-To: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@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=kA0DAAgBBYMxKxlfZLYByyZiAGa08J+i/ecmnH04m2MVRC/VbzZVtTvmdASiqEQ8p4HluILde 4kCMwQAAQgAHRYhBLZRoUY8ar7QaQxVzQWDMSsZX2S2BQJmtPCfAAoJEAWDMSsZX2S29vcQAKWd xX24s6ZgOqKmUW3S3XNk3Nz9koj65cVcQHcXsDU8r/pzvCPMzGTAZCIVJKrNgL4zXpP/zXTh94m 4VUOVC8RbiLsemfIGNkvcXPRjyQvLdb6xD0fLACiwRCo6uIvjmGbJDWMAH2NLOFMLM+yCv+0gSo U+AG4vltPUCYCOY9+hOSVSZO76WGS0H4PZrPvipoZH+NCFGEuboWA9gCMKC9GIMguMF/QDMJS1Y +jMIYtfv1NGUoREZvAkXU5kpMwY0usoV6yRLSIKwh7ZWqmME/KY+yiCkCV7foLkiSx9M98XiXmP hqhxQCJ5GbBHpgRvN6kkp+ROk3mkAq/bD/z4S5pWiL8urVSBCnP9App8oCOVRaPo/hgX4GjJL4y W2a1/8ck3mpRYsAbN7HJvmYdUjmYQpikMX04pYeTqTGFYw1Y8+Mvb1264moelEvpKXvgCEhTIeK pBFOOWc6NhgCCWGDmP6ALTciYeVQDKF6C+s2k4ec/fOXBPHGiL543xcAJRlAdR2NkP72v59t2PP FkBjncYiHMpNiDpiSZ/B8IWrt8FTMFIzmakXs42zDWmKGGDkxBI3CCSfHl5DvbGPqLrMBjVb/lt FZo21KarO8GF666M9HQZbDj6K9vHa7I9ARaihqiDtXKg7rUUKnKa/hWvQoiOy6M2/BbwSbCX00H wJE5z 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 Thu Aug 8 16:21:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 817722 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp944479wrt; Thu, 8 Aug 2024 09:23:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUaqGZNZavt8iZfyW8lkKu+q3+5LIIMrsDoQWIwRU4JvsbZTOZbgPU2JFNJURokVkKT5mp+lnPa4cGoqDhFYeLH X-Google-Smtp-Source: AGHT+IGvb82hNfJPviQePSwDZs9u9jJ93g9qtOot0RJxzm2VR3K/Edzrd3CmbwERy/zNh57EQv1G X-Received: by 2002:a05:6402:42c4:b0:5a3:f5c6:7cd5 with SMTP id 4fb4d7f45d1cf-5bbb23f7c56mr1964809a12.26.1723134236258; Thu, 08 Aug 2024 09:23:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723134236; cv=none; d=google.com; s=arc-20160816; b=Ksa14QlUOdRQwvORlvAidSeQoiyEigYyXF2MK1OJQ04Qkanecj92Zq4bQsasBwx4g2 2Ia3NFJPYC9sHO5upaKt4y/1g5saf/mXq8sZcOtof8zRnKs09uhoceGC1btkCIbgvdQ4 FFlJP8MEuzQebt9jWFH4o7kCPxV55UM9jrBDW0REWgocICSWW0hcIYaDTMe5zUU0Ndr5 E1JsK3uX6YnCkV1KCFhta+Uql8GqEekia2DZk1ywffx6JOkMhkj9HrLp/YcYqbrYChKt V6JhIMNSsutri+0CNm50SN7xIOMQkKdZj/7iRVkZeg1bmPKlP9sWGGTJALSN2hF7jDnb TTAQ== 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=xW9Lw9bC81UExULtuKcmnF5JYJ2iRdSEmKsI2t3PfG0=; b=jTdthpVpKose11QuGEk4CtiwxqfeZQgWuNdviktnKF4Bobis0/c4Udx+uy05QoS7bT MJHKS4zeyZJnU5Z0jBTNeV7uINYKOXB92L3JSxDV6qYiW/x80aSOniaxLf6gsttWHUoB NdbK5aEuiGJI6cw/jP5Uxt/K5uBcyBYktbbmzHyzR5yfcuRdLyUcDXidMqkUjNrTv6rQ hccZjiCeowusVblk4U5HutnLqslZ7hrusHgh4Px2ddJI9CUfc000MtCGeiGuhd4K902Y uhR3p0aPT+dAkJSZ7Ahp8l1Hy8uTjv1r5lpebFdINULq5RhpErfretxKJXv8AZTIGJIu eYbg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TUzn4M6l; 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-5bbb2cff589si909512a12.222.2024.08.08.09.23.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:23:56 -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=TUzn4M6l; 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 6D9AA88C28; Thu, 8 Aug 2024 18:22:08 +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="TUzn4M6l"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3BA9D88C11; Thu, 8 Aug 2024 18:22:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) (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 130EB88BC6 for ; Thu, 8 Aug 2024 18:22:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2f035ae1083so11685581fa.3 for ; Thu, 08 Aug 2024 09:22:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723134124; x=1723738924; 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=TUzn4M6lsTfbhxbB5Gu+C/oby/HSLc+PeesBYT9JX3i9DFnOdBUR/Vu6iFveTervYS G55pVSp4Km5Z8MaHoMqwaZWA4CQXR3ba5i4bpBw8dpY4p8dFqRODqiUGsjEbsKxBwxQV XYUN082OEgYQDZHFSE7hxEZ7V+JFb7SZ3UmGsTDi3M378GwEg+2rI1j752rpEOFzad9C Al2UvuqJ/W4r1f5uK4ki1WrtMCpCiEs+8GHd/YQfReEq+HC9yYZWgZ/ejWKUXdfLF67O dISdMEO8iLzFxsFxxVuzDborTn2hVTMqMViDzdZcs0aSo5LjHfbvcH+Io/ZJARPKct6V XKBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723134124; x=1723738924; 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=JCgOpWokTEbMaos/RZjGmU6rOQeYwz8XNlhocjzRZ5aI+PHwJuymtXm+10K+jCLkH0 OaV/S6Ctlo28ruS7BUr/nlb8GzNim1ejk344JYrTUd9wYm0j+4o6wDLiHe95HJ0smecj 0KgZCB3oU2zksg8oDnkGf182cqVjeB7wymcNHQwu3+Qu65LicBgEIMvYlPpDjPPVvboB B6Xs8+9sSlwMUJyxX3Ma6+sqE8PkI27orMnXw1RzqJ53ohHHL69wDleXZtaAbheOnqfx LsK68lmurT+eXL6Rai0P2KhXfVYFyputA+w5BlBWJg3SAb4mI4d0ORuSPX/Tj/GpgQG3 bSQA== X-Forwarded-Encrypted: i=1; AJvYcCWgcmJZVrXtRNaUyOXkfueUu/vkZa8im3wTULP59rVKHyjH/gnDxoxd8z2zoX2MTFHMa5+PY1J0S28uL5IjzmsIHp2EMQ== X-Gm-Message-State: AOJu0YzDPKTC/XF+l9ygmNyK8L4f1nlfoMJ+9uYb2GOKJZUN64KiLHR0 4lvJcboZmW2C8x5Skq631mrJdQi/wIGw6mfA3xJIgpi+qeqA+c8QFMPkaB8Aw8k= X-Received: by 2002:a05:6512:a8c:b0:52c:dbee:bdb0 with SMTP id 2adb3069b0e04-530e5896f05mr1525548e87.59.1723134124204; Thu, 08 Aug 2024 09:22:04 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bbb2e5c8fbsm812351a12.79.2024.08.08.09.22.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:22:03 -0700 (PDT) From: Caleb Connolly Date: Thu, 08 Aug 2024 18:21:56 +0200 Subject: [PATCH v6 09/11] tools: mkeficapsule: support generating dynamic GUIDs MIME-Version: 1.0 Message-Id: <20240808-b4-dynamic-uuid-v6-9-9332e7237119@linaro.org> References: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@linaro.org> In-Reply-To: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@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/ZANAwAIAQWDMSsZX2S2AcsmYgBmtPCffsECSl2xuyXg3rtZX3YIEVEBsqcZGMisP 9OAiWgbuzaJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrTwnwAKCRAFgzErGV9k tkTsEACA0hPFmZa3IUkOYcQYt3gcWIZGKzLtSub9DHZGzN9FBT98YVRcyyOECbvxOte60hit65l sWVYWVwTdmI2sLYade+WOfIYHkIzRBLLKgxWM6ObYhTmJi15eUm7vfurPpjSm8oqCy3aB3cJAE9 ErsCCDLMMQDa1NK6ygC/oT0mu7kiHk3TSCZT1SG9xR4MEOQ5jan4W+bPmrLexabcDcoDY/+ZedP clzwc9QptxzRTBWhRs42reyZy887Hc+3UT7yQPT9VfzJJj/4OtrpUlAlCGCWkqV491xw+oVOaUI D0NuzreLzlegZeZyGPk17261ObFA/5ddMp3t5HzsLzFKpeiEl4yV4be2Gt11P3l92OnVTNKE8yw RqJejGVH+R/IK7y+hegIp4Zkp9U2SPbSvJ0AJDIA7DtskVJno/I+KBrbgw9vp6PexjcWCTskB1z 4Lj+G67xizbaqbz+rT+oKJNxpM7JGUw32vN946SKU/fGLo4Uw95Dhwi/gJG5h9OKe3E/mmpLPXe SizUSMLeMFTrs9txapW+jzPXUSolgFtjyoBCR9HORtAJnnm49HKxwsZcLm39tyZ1G7K3qT6TWyF xTfPQ9AktZTZNSu6dUNxQ3D5grvOijeyp81EPZeaMfv03VxSgNhJ4EV+K5Xg/ftSvSGDQYOceP7 Z+jOoFN9zkUWeDg== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Add support for generating GUIDs that match those generated internally by U-Boot for capsule update fw_images when using dynamic UUIDs. Dynamic UUIDs in U-Boot work by taking a namespace UUID and hashing it with the board compatible and fw_image name. This feature just provides a way to determine the UUIDs for a particular board without having to actually boot U-Boot on it. Signed-off-by: Caleb Connolly --- doc/mkeficapsule.1 | 23 ++++++++ tools/mkeficapsule.c | 156 +++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 174 insertions(+), 5 deletions(-) diff --git a/doc/mkeficapsule.1 b/doc/mkeficapsule.1 index c4c2057d5c7a..bf735295effa 100644 --- a/doc/mkeficapsule.1 +++ b/doc/mkeficapsule.1 @@ -9,8 +9,11 @@ mkeficapsule \- Generate EFI capsule file for U-Boot .SH SYNOPSIS .B mkeficapsule .RI [ options ] " " [ image-blob ] " " capsule-file +.B mkeficapsule +.RI guidgen " " [ GUID ] " " DTB " " IMAGE_NAME... + .SH "DESCRIPTION" The .B mkeficapsule command is used to create an EFI capsule file to be used by U-Boot for firmware @@ -41,8 +44,12 @@ format is the same as used in the new uImage format and allows for multiple binary blobs in a single capsule file. This type of image file can be generated by .BR mkimage . +mkeficapsule can also be used to simulate the dynamic GUID generation used to +identify firmware images in capsule updates by providing the namespace guid, dtb +for the board, and a list of firmware images. + .SH "OPTIONS" .TP .BI "-g\fR,\fB --guid " guid-string @@ -112,8 +119,24 @@ at every firmware update. .TP .B "-d\fR,\fB --dump_sig" Dump signature data into *.p7 file +.SH "GUIDGEN OPTIONS" + +.TP +.B "[GUID]" +The namespace/salt GUID, by default this is EFI_CAPSULE_NAMESPACE_GUID. +The format is: + xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + +.TP +.B DTB +The device tree blob file for the board. + +.TP +.B IMAGE_NAME... +The names of the firmware images to generate GUIDs for. + .PP .SH FILES .TP .I /EFI/UpdateCapsule diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c index 54fb4dee3ee5..8dfc09ffaf4f 100644 --- a/tools/mkeficapsule.c +++ b/tools/mkeficapsule.c @@ -19,12 +19,16 @@ #include #include #include +#include #include #include "eficapsule.h" +// Matches CONFIG_EFI_CAPSULE_NAMESPACE_GUID +#define DEFAULT_NAMESPACE_GUID "8c9f137e-91dc-427b-b2d6-b420faebaf2a" + static const char *tool_name = "mkeficapsule"; efi_guid_t efi_guid_fm_capsule = EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID; efi_guid_t efi_guid_cert_type_pkcs7 = EFI_CERT_TYPE_PKCS7_GUID; @@ -53,11 +57,23 @@ static struct option options[] = { {"help", no_argument, NULL, 'h'}, {NULL, 0, NULL, 0}, }; -static void print_usage(void) + +static void print_usage_guidgen(void) { - fprintf(stderr, "Usage: %s [options] \n" + fprintf(stderr, "%s guidgen [GUID] DTB IMAGE_NAME...\n" + "Options:\n" + + "\tGUID Namespace GUID (default: %s)\n" + "\tDTB Device Tree Blob\n" + "\tIMAGE_NAME... One or more names of fw_images to generate GUIDs for\n", + tool_name, DEFAULT_NAMESPACE_GUID); +} + +static void print_usage_mkeficapsule(void) +{ + fprintf(stderr, "Usage: \n\n%s [options] \n" "Options:\n" "\t-g, --guid guid for image blob type\n" "\t-i, --index update image index\n" @@ -70,10 +86,11 @@ static void print_usage(void) "\t-A, --fw-accept firmware accept capsule, requires GUID, no image blob\n" "\t-R, --fw-revert firmware revert capsule, takes no GUID, no image blob\n" "\t-o, --capoemflag Capsule OEM Flag, an integer between 0x0000 and 0xffff\n" "\t-D, --dump-capsule dump the contents of the capsule headers\n" - "\t-h, --help print a help message\n", + "\t-h, --help print a help message\n\n", tool_name); + print_usage_guidgen(); } /** * auth_context - authentication context @@ -816,8 +833,130 @@ static void dump_capsule_contents(char *capsule_file) exit(EXIT_FAILURE); } } +static struct fdt_header *load_dtb(const char *path) +{ + struct fdt_header *dtb; + ssize_t dtb_size; + FILE *f; + + /* Open and parse DTB */ + f = fopen(path, "r"); + if (!f) { + fprintf(stderr, "Cannot open %s\n", path); + return NULL; + } + + if (fseek(f, 0, SEEK_END)) { + fprintf(stderr, "Cannot seek to the end of %s: %s\n", + path, strerror(errno)); + return NULL; + } + + dtb_size = ftell(f); + if (dtb_size < 0) { + fprintf(stderr, "Cannot ftell %s: %s\n", + path, strerror(errno)); + return NULL; + } + + fseek(f, 0, SEEK_SET); + + dtb = malloc(dtb_size); + if (!dtb) { + fprintf(stderr, "Can't allocated %ld\n", dtb_size); + return NULL; + } + + if (fread(dtb, dtb_size, 1, f) != 1) { + fprintf(stderr, "Can't read %ld bytes from %s\n", + dtb_size, path); + free(dtb); + return NULL; + } + + fclose(f); + + return dtb; +} + +#define MAX_IMAGE_NAME_LEN 128 +static int genguid(int argc, char **argv) +{ + int idx = 2, ret; + unsigned char namespace[16]; + struct efi_guid image_type_id; + const char *dtb_path; + struct fdt_header *dtb; + const char *compatible; + int compatlen, namelen; + uint16_t fw_image[MAX_IMAGE_NAME_LEN]; + + if (argc < 2) { + fprintf(stderr, "Usage: "); + print_usage_guidgen(); + return -1; + } + + if (uuid_str_to_bin(argv[1], namespace, UUID_STR_FORMAT_GUID)) { + uuid_str_to_bin(DEFAULT_NAMESPACE_GUID, namespace, UUID_STR_FORMAT_GUID); + dtb_path = argv[1]; + } else { + dtb_path = argv[2]; + idx = 3; + } + + if (idx == argc) { + fprintf(stderr, "Usage: "); + print_usage_guidgen(); + return -1; + } + + dtb = load_dtb(dtb_path); + if (!dtb) + return -1; + + if ((ret = fdt_check_header(dtb))) { + fprintf(stderr, "Invalid DTB header: %d\n", ret); + return -1; + } + + compatible = fdt_getprop(dtb, 0, "compatible", &compatlen); + if (!compatible) { + fprintf(stderr, "No compatible string found in DTB\n"); + return -1; + } + if (strnlen(compatible, compatlen) >= compatlen) { + fprintf(stderr, "Compatible string not null-terminated\n"); + return -1; + } + + printf("Generating GUIDs for %s with namespace %s:\n", + compatible, DEFAULT_NAMESPACE_GUID); + for (; idx < argc; idx++) { + memset(fw_image, 0, sizeof(fw_image)); + namelen = strlen(argv[idx]); + if (namelen > MAX_IMAGE_NAME_LEN) { + fprintf(stderr, "Image name too long: %s\n", argv[idx]); + return -1; + } + + for (int i = 0; i < namelen; i++) + fw_image[i] = (uint16_t)argv[idx][i]; + + gen_v5_guid((struct uuid *)&namespace, &image_type_id, + compatible, strlen(compatible), + fw_image, namelen * sizeof(uint16_t), + NULL); + + printf("%s: ", argv[idx]); + print_guid(&image_type_id); + } + + return 0; +} + /** * main - main entry function of mkeficapsule * @argc: Number of arguments * @argv: Array of pointers to arguments @@ -840,8 +979,15 @@ int main(int argc, char **argv) char *privkey_file, *cert_file; int c, idx; struct fmp_payload_header_params fmp_ph_params = { 0 }; + /* Generate dynamic GUIDs */ + if (argc > 1 && !strcmp(argv[1], "guidgen")) { + if (genguid(argc - 1, argv + 1)) + exit(EXIT_FAILURE); + exit(EXIT_SUCCESS); + } + guid = NULL; index = 0; instance = 0; mcount = 0; @@ -928,9 +1074,9 @@ int main(int argc, char **argv) case 'D': capsule_dump = true; break; default: - print_usage(); + print_usage_mkeficapsule(); exit(EXIT_SUCCESS); } } @@ -951,9 +1097,9 @@ int main(int argc, char **argv) (capsule_type != CAPSULE_NORMAL_BLOB && ((argc != optind + 1) || ((capsule_type == CAPSULE_ACCEPT) && !guid) || ((capsule_type == CAPSULE_REVERT) && guid)))) { - print_usage(); + print_usage_mkeficapsule(); exit(EXIT_FAILURE); } if (capsule_type != CAPSULE_NORMAL_BLOB) { From patchwork Thu Aug 8 16:21:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 817723 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp944547wrt; Thu, 8 Aug 2024 09:24:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUt9Mh0vPn2JdKl2pDpOT1DGvHidnxx06T4kLqKn83uLvpiKxt1AlvwWMSG6BuEVZPNFCgtcjugUEXPs49bQLqV X-Google-Smtp-Source: AGHT+IEhu5AQukxuACUwDGSKcXaQ8jJDwMlqLBIcR4V8ECPilczsk4Xr98oBCRQAZ34YLvAHIPEe X-Received: by 2002:a05:6512:15aa:b0:52e:936e:a237 with SMTP id 2adb3069b0e04-530e581fef4mr2403831e87.16.1723134246912; Thu, 08 Aug 2024 09:24:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723134246; cv=none; d=google.com; s=arc-20160816; b=djnidkpp9uzVrUU/Xvsu2vObQZa34h46Tj0k1QkfsGGwokIEShxTKbE1NKSlxkSomO PbiHIWzvmIILv6V17x0k/mX5H6HqyAmT9/fSxo+kUEE517jx9f2MA7b/a9V8YTpw4q8X YKeO7oyvZRX6WKBQK3/Nn1enlqwBxHLZHD4Qctxknnk5qp5hd0eSu4QCUJlees3CARJ8 C7S8gUAhjmRpu67kn3MwbgLfhAkO9fG1nKISnllbgm0Lnb7t50+HuUgcBrA1E3mNkpv7 xDMLajuTUdbejcqx1hg5naBKPVilwwWZRlLl68oKeqbNnM+Ej7jvGnTQuICGVt7tyhr0 OdMQ== 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=+bBRjCX6mhnun/TVUugwq1WBNnTXgK0h/bzWBQ6CSRk=; b=g6/wOw1X68MEGDIKjvr+deZkpcybrgSULYvfTUnh7wpa9gJQ6lDm1woHrMK1ZB6xtg N42RkM+kjAZ5H0JU/en4ZkvrAmrXHE8IY/6Iya2/2M+nXvQjivN0YbZFrAW5o1QE/+7w JJbTnNeaOzthYgiEAUF7HLxh57uUiUUzDzBgOHMBmfW5mHN7f4srTMo20erqCyW7uzbl LsXxIDPpVru8Q+BSmYpCuUDLwUrNVFoXCYJjqngfTcp6n6/i067Vk53mV5wHtHVId6tA 84gmSrwTPqYW3k4CDqWrdaNwHFjmyUFraDMT1tnb2M1Ga2BUjIEh9IE80Pg32g2hTLvF wqmw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y8qAMRxV; 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-a7dc9d6f9b8si817383866b.415.2024.08.08.09.24.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:24:06 -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=y8qAMRxV; 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 CD64087903; Thu, 8 Aug 2024 18:22:09 +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="y8qAMRxV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D9264874AC; Thu, 8 Aug 2024 18:22:07 +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 DBBFE874AC for ; Thu, 8 Aug 2024 18:22:05 +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-a7ab63a388bso49761366b.1 for ; Thu, 08 Aug 2024 09:22:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723134125; x=1723738925; 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=y8qAMRxVO5l5Vj0N0L/oK5td47Yqj8IRQi8lqOgKg1qFpVhjG6tilpXhgoMjqBkzs4 1nzMBAv/AGRuGEOewND+6Zbd/o1cvUrKJ71YFDCLE1GoItirpkPH1OzYxPw9rQww2uQc QTzhZMcr4DbGY8XKmkH8eXkCaEkb9rAzy7XrKNcH5R3l03GpeP52qyJtLbPiFPLKRlso O3G9M4q7pmiK9hIigUgWaxWjTHKQdtV/ZhIdTib7u8hnahxEkSjUXCtA3IjqYeJEbF8Q FlZB32iYOmOPCKrSZVfyQ/0fw80vkJ54VSrTJcOk2ftoktZG3UG0PkTHj2xjzPjCcxSW n6ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723134125; x=1723738925; 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=CK8qSXb1hHvfnhmQ82rJifZ/WQf//GwzdbQaXCkXiis33ayJHjjT3dMuh0tgd6RHSQ GyTwTsQR7fW3pnKJNsIao9FJQR78a+MfgWfBqtLB32VFickXQfNIZ1l6TqJCiSoE/XfH Y3Dme/PDSSZFIsjMnzH8stAt7lg+KbTwZEsJwHBvmLtGyLpUGEsNP1+J5JS2CexM+bf7 x8CnbBh+OcCH4QJPYvflFnNEt91vzDNa+zCeD3AsWG+xobR/ZVuxsv4JaU/uu9vFFP+A 4E7ZxakpB1zHMpfLtAPHwg+s6gBt8LgLAmWHEsG2wEry/iP6kJg/LzriTdcVb69QQPdq xOYA== X-Forwarded-Encrypted: i=1; AJvYcCXQ7V7czwFGmAdq3Vll472eXnJom9+zGkkOCxvBwII57FTMv7/4SZxd8eVz6Eay9cyxvRBQFq3sv37ymAFT86f7MK1m3A== X-Gm-Message-State: AOJu0Yz92eu69uOD9OnYncqZWSXSUigP9feOBWVYDeQFm8oX3XAKgK5Z OeVq3Pw5bLiV7h4IgwD0Gmoi/Isef6u0Xzv46suNo2fSQL7ZkMI3xdUuLFgFQew= X-Received: by 2002:a05:6402:3908:b0:5a3:619:949f with SMTP id 4fb4d7f45d1cf-5bbb249af79mr2450291a12.32.1723134125292; Thu, 08 Aug 2024 09:22:05 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bbb2e5c8fbsm812351a12.79.2024.08.08.09.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:22:04 -0700 (PDT) From: Caleb Connolly Date: Thu, 08 Aug 2024 18:21:57 +0200 Subject: [PATCH v6 10/11] test: lib/uuid: add unit tests for dynamic UUIDs MIME-Version: 1.0 Message-Id: <20240808-b4-dynamic-uuid-v6-10-9332e7237119@linaro.org> References: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@linaro.org> In-Reply-To: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@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=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmtPCfaCZThIAo3wrP1imjo0idje9cr3O5oNkg0 dbmS+ppdBCJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrTwnwAKCRAFgzErGV9k tpFnD/45O2xeNE7BiBR4CG7q3uEs+0LTZVVWc+yakokCrTEoP+Xs2czpQvK71tus5ERfMYBUbmy W8FsyCdIRUD/Qrx/2WhOs1zBJmXYQZ30OkYrxncTF9Mk6x9gQor8KBzkOR2zk9qrDOy2y3CKqjt qmXqIVtu/w1j8aNkMkQrXZR4SuEXR0Vmskv2PWtWhVXJPi/ML6StVCN+U7X2Z/idH0MrCIlSknU eIPt6/MrvrUHuh9RXvSt9gXB7BJCSZVsXzSsy8kyahviyztLlaNLTMJO8VTfOfuwJ47lSb0otM4 lnbTGJCzf2HLLmWi9tIe6989zTrMygHV4/R4KPM/+RCwJ4SGz04zizYB6lf1viqAdsZe2k3Yw5I 5ITL0vsek/KE9Q+2IYnBZ3CZS+jaujRO93GA+hvxGxbm17bFY8EhdI6CpMEck9TbvwZunzK0yZg /Jimo+INIlJhAJ8wdVGwIh2qXCaEmnORe6IGL3iO4jrG+6keYdIX2z83Tdv6TuQ6U5qMFXTR06M h6/+VDWoQWSfmz2oTx+2KqBFc+l15KbRqVcgFm7HpTDqx+7vLuGLaLuiFuI/lP1uduYtn0vNvMZ eVTHflP1sYKgUBGX1VPtetYAw8zLNhVMdgcTKxEJq26YdVdaIDeiQ0Uk7OKMeDviK8xmmI+YFEf draFM4jyPjrZPDA== 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 Thu Aug 8 16:21:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 817724 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp944625wrt; Thu, 8 Aug 2024 09:24:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW6W6KxNWw1nRrJ+8gXkYy6R/j75v0Q0OIHO7PPMFj3Na93Li8pW+bmC8UnGPw0IioJ5YA91m3Gzt+fQhrWtgYA X-Google-Smtp-Source: AGHT+IHnbpMZtLrmWq5b42xFNH257Kmd14DEj5Pwr9+SyqaBvry37th43DK2tKJdh7IZsjjyHmFX X-Received: by 2002:a17:906:d25c:b0:a6f:4fc8:2666 with SMTP id a640c23a62f3a-a8090e3a993mr183260466b.44.1723134257341; Thu, 08 Aug 2024 09:24:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723134257; cv=none; d=google.com; s=arc-20160816; b=hPIHjefHNjjcF4yyRi8cz0qL5SpXyTDWGpSleSra12aNkNPC4kHtJ6XOZZj46gUq7f OSA+P3VcxKNrAfZk6C3aPTu3NSs0VPNssOdQ2z0Nj2+cmn/r36kRfh5UuwXvy9IIZFF0 2Xp451vHnH13WPMriDopLJV+25F5HA+FvPtkg6V/qNyKXKnrqVdUxZNMkn33uWCekwHO SCunHcJ9UM63GZqIzsqEeWpJ57OeTYdjUV6kfcOOOEXTOw6Fgf5LIhooQ/9WLd8hE/2O Pe/rsUwlN2lCs6a9NW813LcjXNaQEdW53L74X2RJiFDc1AdgUyDLo9mgXp1g5mZiWC+S gblg== 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=ztwhd2ZuT+o4pxs8M/oCKxJB82w+kU6FY0AHck/2yUU=; fh=y5rKRDp9zBobjSp2VygBd69UXmngYd9ZJ5DuugoCjaM=; b=DARYhUGu5cDu3VjaoVfcmOVIBzG9JZ+oFjfLKyLRMGNFNS0QG7+kYKAkUBcc/SK6o7 iLeZaGxKpiqoGLlozJcV2WbxKa/ERpC5xs2NF7/x+Js2fQcgKHTUFKPFTmRv93iYGdXO lxA1vIFudtYLAxxfrOsEsko0OALNAzTUgbeJuKlbTwLT6CkBRxVG69CBxgucyczrd3O6 2hjQ2ixjFdwE9mZWp+N92nMo4yHwm9Kv8WifVaTCipp7qRM8I3YYKwM0Lt9Jc/vych2d 2G7vNJ+CfF+wpaeQBzFP30gQYK+nx+3aLMlV+kZB8glfit+gQk1RllIORUx0JwDIFrQM Yn7g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="h5I/NyoN"; 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-a7dc9ea8a27si830836766b.556.2024.08.08.09.24.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:24:17 -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="h5I/NyoN"; 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 EB51288C15; Thu, 8 Aug 2024 18:22: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=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="h5I/NyoN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0000988C26; Thu, 8 Aug 2024 18:22:31 +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-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) (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 0231588BA6 for ; Thu, 8 Aug 2024 18:22:30 +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-x52d.google.com with SMTP id 4fb4d7f45d1cf-5bb85e90ad5so1020588a12.3 for ; Thu, 08 Aug 2024 09:22:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723134149; x=1723738949; 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=ztwhd2ZuT+o4pxs8M/oCKxJB82w+kU6FY0AHck/2yUU=; b=h5I/NyoNj3YeF/sx8s89uXHd8iMrwAqB/BfFWmStkGWrs44amNSpizIDOV/rPGIPtf OdmFHBZAJglXd0RGp3KJ4yzArUuX1rKrleJr8x+EFR8mBqEx3eFOplzaZAc9VutygPKq eHLWTScjgTOyFzYgfCvOc0om8VVfkEnCxl+8J0pRQ2KS4YiN0Zy15mm4+nbGIrmxpqie J/dnV+tp4z+rg3COTIkakCmue2sxjpiqn3V4+TReKkccsqRz4I81EjZxYN66dqYBQbHx m2ugEzEYJgh4yDjz3SLqHeIwd3J1PwpX74MWDsEeruk80nrt/x96BCXb2v6BfCDvNwUw zkBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723134149; x=1723738949; 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=ztwhd2ZuT+o4pxs8M/oCKxJB82w+kU6FY0AHck/2yUU=; b=eCp5cxK4WzFm0wdbIi9ol6opvoqoGeN0YzoLu6Q75pwHf4tRiMtuhbFaox0u5sjyr+ Zahl0RyxaGEL0eBgelQV6jlRBQKHN3kMBQxT50T7rSqccnvRRInRlZ9vDs4C5KBLA5e7 pbfZ0A5ZrTKo3LeNV+8SxHC30jwCR5ozzxX0lWeMT9BrPZvgbtt6pUqb+2LPufJoERdN ZuPz7426SNsHTn11qVmdeSgZhEziLMs5Ytbs8/hEXBi8YStkyOf3o/qvkr9Ek8nBh3eL F3v707jv+goNhQEeguovd/m84nIL3zDDFdW5R5OpZfYBsMe+EzFDRtx+uqSTDBLkIY8K LAVQ== X-Forwarded-Encrypted: i=1; AJvYcCWjk0SiipjR3PJ00zNI9fc/eXAZKBh3OzJiceoDjfr9sduAhJQccawI9NPWc3/gr8EXarcUw2WVxvURScB4Van8YHWTNw== X-Gm-Message-State: AOJu0Yz+mZPQEskuu9uFAzfYlumeFvhDbd7PYFJ22MzW9Cfva0SWDteL bY67unSqXOw7ck5Gp601MWp+VGvNeBN+JVBMhMSl9wvLGyKMP4kTYQ5n6POuGjw= X-Received: by 2002:a05:6402:5110:b0:5bb:9ae0:4a40 with SMTP id 4fb4d7f45d1cf-5bbb218dfa2mr1765979a12.3.1723134126427; Thu, 08 Aug 2024 09:22:06 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bbb2e5c8fbsm812351a12.79.2024.08.08.09.22.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 09:22:05 -0700 (PDT) From: Caleb Connolly Date: Thu, 08 Aug 2024 18:21:58 +0200 Subject: [PATCH v6 11/11] test: lib/uuid: add tests for UUID version/variant bits MIME-Version: 1.0 Message-Id: <20240808-b4-dynamic-uuid-v6-11-9332e7237119@linaro.org> References: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@linaro.org> In-Reply-To: <20240808-b4-dynamic-uuid-v6-0-9332e7237119@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1713; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=G4EtFnGoqlTV6gpf/ePg33yHy7zDVAcPqPA5aHctUos=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmtPCg/H8cc0A4r+lvlr/l70Z2HlRyjMuMvFCYq 0Iqy7Gl6QCJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZrTwoAAKCRAFgzErGV9k tsI1EACRhE25ZxWEAK613GDGiRmV2EygKsgmrTyLyc8XnIarAiw+WLzkZfDbaau0jPb6izMoXI1 owr9Jn+yNQb1c5Yj7kNqr7e8lSxQXz8a5h6/BJA7/UiqvqegwdrZAW2NxN46zkNNbJm7GpUCpG/ kdosFQE/wv9SzHelSy3CSUmeJJMKsc5566Hwe04RWgupa/OYAUXUtUs/EAg10mxqge4RotlWV8f WQKfoDjWtBy9kizFniVrV1vN/9BEFt0ktpRscJN7ezSM6NjmDAO407uzcft+LtqIiDEDVAzTgGJ 8OIQyqrcm0chCvUskTuUrZ2Yb5oqs/I92qlp/aabrHOScAaoGCrsMIaeJ+1nQ7UGYOi2fYQv0jp I97pvvYBraybQuS88HQDQokpd85TTl/S4SnD87UfjQFAFqWMooYylCFJBV6MxZSWScwUUqaa0br 0rQpAkcM/AxLHCF7H2DE6a2AAizqfhhO6yTZby5yfPA5CdiI+YUodgZmbdRFF82TlzHT3yZYZSs CB1QdxLgMZF3joVJClTCWGu2ZAokAVtTRnHhoTL3xOht7nysLJGq1IgaObkaYLPiSsOa5J+8YEr I6vX8OkaRTVfZ8Jbprd2pQsmOwWPmogD3qXdtO+SK7UzzOc23I67NJTtjPONwwBv92vtXDENEEG FEdeyOr1WXSKLuA== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Add a test to check the version/variant bits of v4 and v5 UUIDs. Signed-off-by: Caleb Connolly --- test/lib/uuid.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/lib/uuid.c b/test/lib/uuid.c index 2c6cfd42ddc3..63d36e120623 100644 --- a/test/lib/uuid.c +++ b/test/lib/uuid.c @@ -43,8 +43,44 @@ static int lib_test_uuid_to_le(struct unit_test_state *uts) } LIB_TEST(lib_test_uuid_to_le, 0); +/* Test UUID attribute bits (version, variant) */ +static int lib_test_uuid_bits(struct unit_test_state *uts) +{ + unsigned char uuid[16]; + efi_guid_t guid; + int i; + + /* + * Reduce the chance of a randomly generated UUID disguising + * a regression by testing multiple times. + */ + for (i = 0; i < 5; i++) { + /* Test UUID v4 */ + gen_rand_uuid((unsigned char *)&uuid); + + printf("v4 UUID: %pUb\n", (efi_guid_t *)uuid); + + ut_assert((uuid[6] & 0xf0) == 0x40); /* version 4 */ + ut_assert((uuid[8] & UUID_VARIANT_MASK) == (UUID_VARIANT << UUID_VARIANT_SHIFT)); /* variant 1 */ + + /* Test v5, use the v4 UUID as the namespace */ + gen_v5_guid((struct uuid *)uuid, + &guid, "test", 4, NULL); + + printf("v5 GUID: %pUl\n", (efi_guid_t *)uuid); + + /* This is a GUID so bits 6 and 7 are swapped (little endian) */ + ut_assert((guid.b[7] & 0xf0) == 0x50); /* version 5 */ + ut_assert((guid.b[8] & UUID_VARIANT_MASK) == (UUID_VARIANT << UUID_VARIANT_SHIFT)); /* variant 1 */ + } + + return 0; +} + +LIB_TEST(lib_test_uuid_bits, 0); + struct dynamic_uuid_test_data { const char *compatible; const u16 *images[4]; const char *expected_uuids[4];