From patchwork Tue Jul 2 13:30:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 809113 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp211850wru; Tue, 2 Jul 2024 06:31:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUfD0mY7qHjyPOIVZl/rX0u8Deesy2KvQtYzj0+x5m49g27kFU0HlICwo/A5LWRLBmZJOtQJz4spvTKXeEG/Vo+ X-Google-Smtp-Source: AGHT+IFaPV8Rb1hqQEnxGQU7dfLbmD2TiEYKGshH44jQWenYwspbGR4malXnHa9gQ6wM+g/4geA7 X-Received: by 2002:a17:907:7d89:b0:a6f:50ae:e0a with SMTP id a640c23a62f3a-a751443876cmr731952766b.37.1719927060809; Tue, 02 Jul 2024 06:31:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719927060; cv=none; d=google.com; s=arc-20160816; b=b0SyDvKHBSWi6YZQPdzJ0fgUr4uT47leO/XA8kYUO9uL6v2jTpTNuzGvUDpErfOCl8 fnpdIvL53pHQT8r+AJscy881KBRVIyPaUZ/eX3X/26GE5GmV3J1yJJF879cuqsTYgn/c TUdzUzhq0Ig81WtrTroS8aZA0qD0FuTPkXG+3JraUwvCN+j7pHbMOqzBSXOwU0x71yaK 6GdfMDwYM/PvuV/OALDGJlkzKF4Bux++PtciiAOZw108aCpG+on+s0jy+D3c5rqH6PdT uSHsIie6bhtaCpGVatAcLZBVBwZljws2EC3MQLC+6mkJD35Kg6pYgT869uIyN4D+LDvQ 7TyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=nScEoNskmv45Lt2tjO7j1jnaqGA5YnHfESShhKL5dEw=; fh=RPPFs9NvfU3QusBSo7WM73tPDr4kWxWVSdGjo5PV/b0=; b=yRA3oa4exsQ93LavvQY2WcGtpOxmfqrpxCddfadG7H4QJ7lAp7iw7tKkw+FT29PvGU 4n7rU1vu+tjx19FKhUDRTDNH4tNH8aSJ/vPjAQ/4TIEGd6OSXaU2NSRXeFNh0yrLg7XV 0crzdEZtb/7rtlwaCTMdvm6HldU8AKdGfubYq3CoFPBTAUkd3R0gnSN9RuBwCN+cCVyG jxxFGpW3+l3bzUyoO0okKshKCldcZLD3csP1LEB23OffWn6sowtoEjAyn4d1evFDVbNj 6XfvAMpmv/Ey5PqqZnxTOE+NI2784PgHEOe3mx9Bh/MQ83ouC3Th9e8ZTOqf83S7XGK2 iVZQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PLZ0TOlm; 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 Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-a72ab049e77si470626566b.462.2024.07.02.06.31.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:31:00 -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=PLZ0TOlm; 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 Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DBE3C885E4; Tue, 2 Jul 2024 15:30:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=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="PLZ0TOlm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 03AF1884FB; Tue, 2 Jul 2024 15:30:48 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1CC4B880AE for ; Tue, 2 Jul 2024 15:30:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a72585032f1so458201166b.3 for ; Tue, 02 Jul 2024 06:30:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719927045; x=1720531845; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=nScEoNskmv45Lt2tjO7j1jnaqGA5YnHfESShhKL5dEw=; b=PLZ0TOlmlB7RD+Jiuo8SWlopyjPkmmJwDDNcjq9bp0ni46S43Ez2YJhquMfy9eDqR3 FGnwS9GZW2BlkoMWJZNlpN7Mj1qB9qIcVkjQIa/rU1zyvia9En3O4klPrrN9J58ElMR+ zde5oma/DzEh+4J4Tp0gCaVp5T0q8471SAezcrWmXEDGkBvW3cmeS70rSLEETHEJ8k2e iFk7syOElMXxNb5kxj9S1f8ao9LTFdBm9K4qAe9HXVHUC3/Yl0QAnK688YHLSRVo/9nZ zzUcl6B1sGwwEqPqdITlG33ZJPMgYI4JxQjOaEgxuEmeSEyjgjUvKQ2GejuyOOaEHDIB 6ucw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719927045; x=1720531845; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nScEoNskmv45Lt2tjO7j1jnaqGA5YnHfESShhKL5dEw=; b=GCXQQQ4RFH2SSoLDRPrAvQrnuF31vnt6eaZwtUEAdzG9Dd6wsZeS/OkptSZ0o2pI5U OG+4VQIy9m2dO67DRUHW76dxWcQEIMHaOkqSNYA7rl/lGQqFTzkGA3EBtrhG643/+BJX YSI+dDVOfwd5/61eo80yJkQAS5sTE3bbos0OxpiiKbsXGcWT2j6dtWsX4+/UlrDaV/fd DOrG2S7yHnnIC3s5btIFbWH6tLFyW3tNYGtsAjiP0n+1a/qJ3JlYcVWSaWhMPrOm1oou 20yhYWHzKs0lVczHcnseP/CdoFDPdsOsRab7b2hLKfhm+b69RpYfiBMJQs220Vc3yXiv Bzaw== X-Forwarded-Encrypted: i=1; AJvYcCVH4FQMwAfbhgjPsvagnLI43dtqNIRVCFRFki1g8+gI8ZWr/6PbhRB7PL2OfoGnq48tIO6TMjH1GgI7xdG7Ve9pZg481w== X-Gm-Message-State: AOJu0YxGzY9Ksj7imCE2upnN/ZISJ5AX8Cntx4xuGWNa2+iQNd0Z4rfn H4IzUBVxi9uQpwj14yLQ0lyyhujSk2FB62joBVX8MTnBQ9qEGIDCtWBC+ZS6uok= X-Received: by 2002:a17:907:d15:b0:a70:c031:3359 with SMTP id a640c23a62f3a-a7514438b44mr702738166b.34.1719927045505; Tue, 02 Jul 2024 06:30:45 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7430367d55sm323796166b.87.2024.07.02.06.30.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:30:44 -0700 (PDT) From: Caleb Connolly Date: Tue, 02 Jul 2024 15:30:41 +0200 Subject: [PATCH v4 01/10] efi: define struct efi_guid MIME-Version: 1.0 Message-Id: <20240702-b4-dynamic-uuid-v4-1-a00c82d1f504@linaro.org> References: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@linaro.org> In-Reply-To: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1137; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=b3W8BuVY9KVN80vqbSH3Ez6m6ALhP6/nGoPftuCgZMA=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmhAEBRCW+jAWLpN23dnEkUJW0XfD4JSTmOxkQ3 GvembpFktiJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZoQBAQAKCRAFgzErGV9k tiaWD/4vFykJJF9vTWtwsIsdIYtO6Cq082mbtqzzTs1EdTGtupxX0kqRTtIbVQ3HcO4y2no2cDh m822kS4sS5WSgoojHOtTIXtDIsWfZSMuXD2c235m1eBNr57McymYfxLJEmiMln0SMm4lqWlQa5p sccc55u/cWLap/xpHPPkz+5/jgjK3Ol5DagCMkxjTJQZQ66SgqQjHMTbMwD/swjhFeJDMESMIEV DX8hWtj0FWxpB9RgtkciXMY1+RoKsIl4XYgmZdJiagoxzozciHD+SA0lTwJ7ayqmPDJzUmy/Edz nUiBeSQFZBvbRQ0EEaGlO1RXQ5T0yXeCEX10kqD3jUVX8zoKWSNnIYWPkH6wNHTIIZ9F1FQ/VHx WO/WcQ/csgY+r264svSQaXPrUn4PG29wYQgteVvKSCJrir9ILlyZudXLUESVwMp3H3carry5oYV rAtyQGh75UjE7ALa/UDQuMGSiKQC8aa2QMUrJIswcHK2/NUcZagfx1DiRNAxyB3ZHq77voUhPPi k0skJDTOL93piWEVr44tJgSQn5BKqbmtq6KDYyAB9hzvgNmwsVgbYqCb2SOeUnVnZVI41nG7007 lvM6e6FOZCLrStMu1pGKDk3BI9uaYKpGMY5fTRoWT6uwy2sR6OPlPC/7sYTetX6l1o6hz7P8S7/ LnnsBWj8Jy3Nbkw== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean This let's us forward declare efi_guid_t in the UUID code without pulling in efi.h Signed-off-by: Caleb Connolly --- include/efi.h | 2 +- tools/eficapsule.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/efi.h b/include/efi.h index c3c4b93f860a..b92c961a2afd 100644 --- a/include/efi.h +++ b/include/efi.h @@ -73,9 +73,9 @@ struct efi_device_path { * EDK2 reference implementation both define EFI_GUID as * struct { u32 a; u16; b; u16 c; u8 d[8]; }; which is 4-byte * aligned. */ -typedef struct { +typedef struct efi_guid { u8 b[16]; } efi_guid_t __attribute__((aligned(4))); #define EFI_BITS_PER_LONG (sizeof(long) * 8) diff --git a/tools/eficapsule.h b/tools/eficapsule.h index 6efd07d2eb6b..97d077536d5b 100644 --- a/tools/eficapsule.h +++ b/tools/eficapsule.h @@ -23,9 +23,9 @@ #endif #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -typedef struct { +typedef struct efi_guid { uint8_t b[16]; } efi_guid_t __aligned(8); #define EFI_GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ From patchwork Tue Jul 2 13:30:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 809114 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp211974wru; Tue, 2 Jul 2024 06:31:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU/WkHBDrvRp5m52awl35wQrAOWRid0jv3lWGc/A40F1pzRKEB404JYJOdIaFYZBMKjOaig00DIzt0eruTq9ynu X-Google-Smtp-Source: AGHT+IFfvyzSMYboludhQX3dX14MJnV1YwEpBe3JEro4vPv91G5vruRj6/q2ZpzCtP7petEsB7PU X-Received: by 2002:a17:906:f581:b0:a72:b803:a1ac with SMTP id a640c23a62f3a-a75144bae8cmr699039466b.56.1719927072023; Tue, 02 Jul 2024 06:31:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719927072; cv=none; d=google.com; s=arc-20160816; b=GrdEPgdd9Lrd4zlwyEXj5RDmJKfmpJ3kUY6gZFAb4xQ0Ry/9/hUHUTs3CKmg86DqnN rTyfScr3AGkZLaRKcer6p9iDvRr+AWrFD/jcOlc22yjBnmWN8dcrnXHbVoYilyZf05GT k7yaw0+NsvVsmV3usYphWAlnpYRNJGZMCj6lYSZP2YDLAMy7yxtwBM7TH/TrtYwaH2Ot y2ZfGZ4+6RAzU2gvpXvgb7ufl4WXvRj+6EeXnPOtn8R0galLeVAR9EJOI/YOcfAPpOwT Y0C/P0bonbQ468g4TS9tg75RKYdLkR4wevYX9pCRBJHSuVPxQB3cY8wwapPot7ZCWoH0 6kTg== 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=yplIHPrFrd+E2vv2AnXg2YetFfTtD3L3FbyS9laYyOY=; fh=aEBqWEZuKbGFjtmkMT7erS3oZ+tHIuONR7ugRI3jqb4=; b=XN5cGiSfTi5+/T/1Z/lz02nC1LWbwoqdPuO7hKt5EKbhBgps9SJ+ZZ6df5ibvi5y0o OH55P60IuYEmNfetYfERq/0sGoF5My98fA5IrIDax4TZ+YRrWNR9wTbVPFRwVV3qd5Qa jUHOjmVl/b+OD8UML44VfMs0wVAwwKtsjYZhI0Ok9+uGtxegtFu9T/MzC6L6vR3z9oJX tQy6gNpBzbhbECehNN2WPsmGprfft9scyaRZ/L64oyw2VCeoPb09wxn/cBDg8GqeliFr 8tQX4zeAoHrHl+K5NO/btTSbYRScFWy75jApcsHcYuA9kzzkJltfVZKsZfwPku570ujX Da9A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HsEU+Y8Y; 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 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-a72aaef69f2si503665566b.199.2024.07.02.06.31.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:31:12 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HsEU+Y8Y; 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 Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4AFD888096; Tue, 2 Jul 2024 15:30:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=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="HsEU+Y8Y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 889C888712; Tue, 2 Jul 2024 15:30:49 +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 81B9387CF8 for ; Tue, 2 Jul 2024 15:30:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a7241b2fe79so458178666b.1 for ; Tue, 02 Jul 2024 06:30:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719927047; x=1720531847; 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=yplIHPrFrd+E2vv2AnXg2YetFfTtD3L3FbyS9laYyOY=; b=HsEU+Y8YY8LrBcnxaNGrIOXMYlDCk6/DmJldThikWUztEZB32Bhct1JaSf0U/0bZXZ SZvmsJi+CC4+e8lTvA/jTi39FcgzsCAz06x43tYY0xAsGKzb6ab424b73frTMPmcHcpr ItNc7bV4+kWPn5y/VqC8tpa6+2qMux6B+BLFhABAt5kg/tyJPKewegOK0v6CVarw1M8N 4tqSjt1HUoju98Z1b2AkpVfG7rs5i5TwOh1HKc2O73dXKdC51Qxou0LrxDtRJFS+cnKN xAp1eGXRjwy8bN013vIBe6lYrl09w3Zyx7CtbKpfEAQpYzTWpv6A2VCr5yKoRXW72pBb ZnKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719927047; x=1720531847; 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=yplIHPrFrd+E2vv2AnXg2YetFfTtD3L3FbyS9laYyOY=; b=u2qaTYVvf6LbqZTgXwr/5SY0TeObCUgAntPLJNRP/9Ogxd2E4YhUsGye/g5y5vkH7/ n5Ppbjiz+MWu/Tek7C+08/l8mXIQcTzw57mRa21S3udnwbubzlBDpOvaJrWWQ/7uMXCV gkWGktxUNpXeqrp7WTritfQ5IkhCnFyUOt0euU1XhkU6OjVYBRfSwmxBg2L7XJNwIofY NfTlFGRXnlzVsHL8NU8qOmpAbUcsLojQ0ZBEklXvBSByI3Gju44gUo6yKwx4sGsjDIYm qTKJGF6Ziv1ktGs2hR8iNWC06rJpA23/tlK9vv38q/pmhzocGuSsOckF+cwqEs6/fyLP 0yOg== X-Forwarded-Encrypted: i=1; AJvYcCX5ruWyZgCukWKn0EDR0yj9H3cFVh94GbM2NZCJjydlROaobXRXeOKlY3EnV3dJYilR5vr4Eb2c0kKBspHtYwhO9HiikQ== X-Gm-Message-State: AOJu0Yz0cNxCq8t3TxOttPWl3X1D8w+Vf9xnvv6vJcrp8dYOpLjOkUmI cLXNMOlY9YprRIkKheKZnG1yg/WmVAqREqBSrvCOwBIKRMN3AJ7Ncoyr/u8blLU= X-Received: by 2002:a17:906:fccc:b0:a72:548a:6f42 with SMTP id a640c23a62f3a-a751445451dmr563539866b.18.1719927046780; Tue, 02 Jul 2024 06:30:46 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7430367d55sm323796166b.87.2024.07.02.06.30.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:30:46 -0700 (PDT) From: Caleb Connolly Date: Tue, 02 Jul 2024 15:30:42 +0200 Subject: [PATCH v4 02/10] lib: uuid: add UUID v5 support MIME-Version: 1.0 Message-Id: <20240702-b4-dynamic-uuid-v4-2-a00c82d1f504@linaro.org> References: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@linaro.org> In-Reply-To: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=5402; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=V+42NnDIi/jdM6oXb7A+84TKo7thIq/t0tX3x78iv9c=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmhAEC8YRwMwEayIYvp9j8ek0q1ZmTkQFLV6bUS bpWS7ERj3qJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZoQBAgAKCRAFgzErGV9k tkRtD/4r6YadqhQ7ZtTxg6er70+qFn6Q0H+KTO+5uNTf9xzZhRWis0LKeoJfEQ3dfrDnY28Ju0r ebDMtEP6cvVt0uB6Cn7YwqKmOn7Gm7Ju7CCVOuKnKI+eDZnya6Jg95nh3pB+1Uk41OGmEev7ODE jZwdiPAzDDJaLwFYMWY4KNGYw8+rHb8b9ao1iLVx9t04B/vgJ1zTHbWBXxiKBpqk47uEhYBhSAe gFHswmNRaaTaEtMsyeeOfKpO8xlTzRvLH/U5/r+hDJA6voovIUwmGbKI4rBiuM5Eu709/1jWERr /6XbmCXZhjfykif0Pb6G03NaMQRrD3SYt5XpX0Y5SjvexY3FTIAlE+hHYTfK52lJsY/0aDC3t2f aXnCttx7ECQ9XanufJ/MaR3H/5fdve9IHxjmI8qAI/P1oh31//fr89QNOkIVJESTQU0c9j1ZsEz q+YuUM8Jo2B0CKMCnph5X0+yRJFkBmmOpAhyKWVdFbTxV3x3lwK6WMg+DNJccKOPQ9lKBUq9oFJ Imjqh2kEufL81iZR8Ce5PuiiGrw4YqwNqgTlUZ5Mnuz7hI/rKiVc/0QEaZRm9aT1qcgV7Q0YFa7 HM4WIdvuxIvPH8WbYnfaRDsYSCnx/eXdawGS+4FFK9sep2Qk8aezvI6T0Qj7xLcO+BzGJwrCcRA eqt+NCjQEtgVhhQ== 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 189e6eb31aa1..9aa882d5f882 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -72,8 +72,9 @@ config HAVE_PRIVATE_LIBGCC bool config LIB_UUID bool + select SHA1 config RANDOM_UUID bool "GPT Random UUID generation" select LIB_UUID diff --git a/lib/uuid.c b/lib/uuid.c index dfa2320ba267..7d0a8273d157 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -21,8 +21,9 @@ #include #include #include #include +#include int uuid_str_valid(const char *uuid) { int i, valid; @@ -368,8 +369,57 @@ void uuid_bin_to_str(const unsigned char *uuid_bin, char *uuid_str, } } } +static void configure_uuid(struct uuid *uuid, unsigned char version) +{ + uint16_t tmp; + + /* Configure variant/version bits */ + tmp = be16_to_cpu(uuid->time_hi_and_version); + tmp = (tmp & ~UUID_VERSION_MASK) | (version << UUID_VERSION_SHIFT); + uuid->time_hi_and_version = cpu_to_be16(tmp); + + uuid->clock_seq_hi_and_reserved &= ~UUID_VARIANT_MASK; + uuid->clock_seq_hi_and_reserved |= (UUID_VARIANT << UUID_VARIANT_SHIFT); +} + +void gen_v5_guid(const struct uuid *namespace, struct efi_guid *guid, ...) +{ + sha1_context ctx; + va_list args; + const uint8_t *data; + uint32_t *tmp32; + uint16_t *tmp16; + uint8_t hash[SHA1_SUM_LEN]; + + sha1_starts(&ctx); + /* Hash the namespace UUID as salt */ + sha1_update(&ctx, (unsigned char *)namespace, UUID_BIN_LEN); + va_start(args, guid); + + while ((data = va_arg(args, const uint8_t *))) { + unsigned int len = va_arg(args, size_t); + sha1_update(&ctx, data, len); + } + + va_end(args); + sha1_finish(&ctx, hash); + + /* Truncate the hash into output UUID, it is already big endian */ + memcpy(guid, hash, sizeof(*guid)); + + configure_uuid((struct uuid *)guid, 5); + + /* Make little endian */ + tmp32 = (uint32_t *)&guid->b[0]; + *tmp32 = be32_to_cpu(*tmp32); + tmp16 = (uint16_t *)&guid->b[4]; + *tmp16 = be16_to_cpu(*tmp16); + tmp16 = (uint16_t *)&guid->b[6]; + *tmp16 = be16_to_cpu(*tmp16); +} + #if defined(CONFIG_RANDOM_UUID) || defined(CONFIG_CMD_UUID) void gen_rand_uuid(unsigned char *uuid_bin) { u32 ptr[4]; @@ -394,15 +444,9 @@ void gen_rand_uuid(unsigned char *uuid_bin) /* Set all fields randomly */ for (i = 0; i < 4; i++) ptr[i] = rand(); - clrsetbits_be16(&uuid->time_hi_and_version, - UUID_VERSION_MASK, - UUID_VERSION << UUID_VERSION_SHIFT); - - clrsetbits_8(&uuid->clock_seq_hi_and_reserved, - UUID_VARIANT_MASK, - UUID_VARIANT << UUID_VARIANT_SHIFT); + configure_uuid(uuid, UUID_VERSION); memcpy(uuid_bin, uuid, 16); } From patchwork Tue Jul 2 13:30:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 809115 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp212063wru; Tue, 2 Jul 2024 06:31:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXw2bG0zf7hJFW01SJ4mbjkP6S9sxBEpSORLTYp6UeUyd+ye2VYcJxSx1uhB7og9wdTc02fpuRGoqQyVAO8fXMN X-Google-Smtp-Source: AGHT+IHfamyMmNPORZCSBNA66hZuL8gAkXugxheIQpjKFr3WO10FPXg3C/JhmMActiaEoNIaJzht X-Received: by 2002:a17:907:a08a:b0:a72:7a71:7f4f with SMTP id a640c23a62f3a-a751386ec49mr775794566b.7.1719927083486; Tue, 02 Jul 2024 06:31:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719927083; cv=none; d=google.com; s=arc-20160816; b=sYeoNrPRy1DVMQcUkexsYFn4VwIIko70cbpj3J0rkQLrmfGPMmPXDKeYGBnOZNH6PD 2qc7AA0DYbNMKkA+YX062gXnC8E9QVN6j4LJ+uYvpi1B1inlPYaadHVIdKHbUWiaXyq8 OVW2nXFQjOkWxBXFauZcUzhEOzGUrcmxPs/ifxOLMPuQtB2L6N47JPLMWcNbgBLGTjUR yxHaSKeNd1Rm8O/7ENXyLvRbaWAsx0QLcoZo3qxDZiv+FR+oLupgJHOj8plmOpqLvHPI JXSBy84AGg1sJBE5fpaOwkbevpVJ/bGYPMAjuvJsk1OWQ/w0xTAX0/3+GLgZ6flsSStn +GFA== 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=Fr1+sdiguyvehnp+x8gS3zldozFZxVm6TZIi52bVPcg=; fh=TY+Y7xX7IOg9QQRRnAxXEZzWYOVH93nwsYtU6VqeN3Y=; b=qiCvqQLRNKOHl9E+jpchtEeCRTR9vgSPoEVC81KVWTm0qv3fWr0lw+tIHA0JG53MGu ABXBgZHumR0wkUQzSwlHw3oJS1y9MBdiUmCd5vIRwVNtMEjRO9CtX6ae9qwWwdJmPwp5 y4PVIiZnUNzfxIXOnfd35KdPfe8SHrE5Cv5Z5W1khmjPbNHWufBjSHrFXWy/zdt5cysS t2w6JPMMy0hjaLzjz6ZBQgM5S5awD5MECvL0oEsTVlQWr3N7+k7cz0Fbv8B5yh/ItwFl Ji+0uIByQ/clpLIVsXAM2BJSLDENt7Zj6+X1J6MrW7UNxxWUb66D6Rd9xSIJ5JDe6rDi BK1w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="qbpPb/Ce"; 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 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-a72ab04b936si465643066b.375.2024.07.02.06.31.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:31:23 -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="qbpPb/Ce"; 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 Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AEDDC8871C; Tue, 2 Jul 2024 15:30:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=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="qbpPb/Ce"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7079188718; Tue, 2 Jul 2024 15:30:50 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-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 62731880AE for ; Tue, 2 Jul 2024 15:30:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a732cb4ea31so547549166b.0 for ; Tue, 02 Jul 2024 06:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719927048; x=1720531848; 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=Fr1+sdiguyvehnp+x8gS3zldozFZxVm6TZIi52bVPcg=; b=qbpPb/CeeZRfU1ZwpdkZS4Fta8MmLcM1A+8p4icDxNgLBUnJo1aT6PwTotIgSmMYPO ZuK2CGPt2s8PizOyOS4FjRdnXIKVEiW4obTkc0h5K6pGWB90V2IoUt+qUZAqyaNm4ivE nCzFk4jQrbEfKprk2dtEv+3ihk4Ux7ZqlamtMMkni1+t4CZg7ysaoKepN75rZ1rSSIGK z2kwarVw3SnJBP/O5DCzRS6tFnwBJdaQQwEFAycaXgztr41Fy/iejW4wi81+OhLQO5bm Wj21KiEU8unkRIwcAq2PPVAhvVWCkNoUJZqvh3jC9cYSGoL7IRD25rbagjRtpqf9bPwU udZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719927048; x=1720531848; 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=Fr1+sdiguyvehnp+x8gS3zldozFZxVm6TZIi52bVPcg=; b=eJZy9KlQXrNxSb3oD0qoZ8c86cqf2Kjn1pc+kPsbPNFvXDvuDE7ltdZqH+X//ylc8T oG8WBx6uILIevLfCOEUUBZgbwPAKXYwooGKrgyJXAjLa/ybYXxzRtsMqE+txr+J6COO1 ElJm25B9LlbmayLtxpHu0A+LIReD2LEcMoW1E1rWbMtM7KZvBmBsRt9BlpxMQ6Lvqr1j CpAqO29NKTzaGuweUZaFtb86DdvRahttXZGNDcqrHUej3yrxwyttEAkok7oLfLUAsHkV kkbEjNc6qj4dFaAtJY5gq+sf7ZBM2aPE0Hhji+a5vHtJL8KlNK+sl6pUe9pe5xwmLTML ve7w== X-Forwarded-Encrypted: i=1; AJvYcCW8axOxash4ZuHLFwuQz2ZPj06UXatuGcDc6YHGnambIg4Hwi9Iat1CB/c2hGA5yQtRDqcTtT/hRBIwb4odwzzkWdjSXQ== X-Gm-Message-State: AOJu0YwNRLszpu1PHRzzgIo7q1oCZmGcZFNk6wIR59wRKCuPveGV8jt5 XAMiZ+Js2qlxacIBeX1Qhqs6e4JFm1PZgzrJ9UVDxl68XPuEJJXHKPLoRW2i3aQ= X-Received: by 2002:a17:906:4895:b0:a6f:e8a5:e8a6 with SMTP id a640c23a62f3a-a72aefa6328mr790106666b.23.1719927047883; Tue, 02 Jul 2024 06:30:47 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7430367d55sm323796166b.87.2024.07.02.06.30.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:30:47 -0700 (PDT) From: Caleb Connolly Date: Tue, 02 Jul 2024 15:30:43 +0200 Subject: [PATCH v4 03/10] efi: add a helper to generate dynamic UUIDs MIME-Version: 1.0 Message-Id: <20240702-b4-dynamic-uuid-v4-3-a00c82d1f504@linaro.org> References: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@linaro.org> In-Reply-To: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=4574; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=RBdJ7tsK8WK1Ra3J+ekcIQtZPMkLTswbLk0/LMsw0uY=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmhAECiNE8KaWv/+g45BiPeLreptCa3qHKVUYDQ fl/YpFwXiuJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZoQBAgAKCRAFgzErGV9k tgB4D/0UL5H5zYAcpIRKdWwTk6UKh6KXZD5h82X/mv8SWnOC7IYMJFQz+ngoB1PVoJC/Cfg+JPL gnrcCG3cY2xXuldw11/jeVLHT4aAbTibByAFxBAmO5FNIEhxWjp39Z/aa8DE8GoDosSe15NdzJV paQLtJtWegkhdXKOE+SODryZzdfYXoIdHiYLXLZtAgoyzaCo6960+eq+j3c1DjSkJPtFkqd0tUX q5ACJZRH2w7StJh2TBSMml8yWmLMDEIRTMKeunkBOkShwO6mk5Lh1UTW/ZbWNXXvTz/S9XE0J+1 yOQADs1sCz8axX4bvMcU2lty0RMsqovbnsMnZFpYasfXbbi2uiMxg3uSYP+dXy32XjnnkOS0l7n F7yTkDqNSJm7oMY2BRsc1r2O0BJFEzspxgHMwuCZRcP1otSFR8ue6xvo57tcpwYpVP0URNhs3dJ l3BqCqQxurDnaxtS4xChhpjlJ8yxKYkwfc2RIjkt7IFQaKDtHjT/MaznizXeqo0tkWStlrPXfRr RMkSMo0Kx54k/9U/x/Sp+XcSddD++DfrX0SuY5k33zkKW/DhnCtO7EexiM8m2GazyRHQ8bbe3dB RG1MvzerG66TaPgBxEuQmRWZ7dKITIRgg9NVJioaF4tUaqpuI347lbYYW0P5sedBf66geYTWq27 20bqd386hcyR+OQ== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Introduce a new helper efi_capsule_update_info_gen_ids() which populates the capsule update fw images image_type_id field. This allows for determinstic UUIDs to be used that can scale to a large number of different boards and board variants without the need to maintain a big list. We call this from efi_fill_image_desc_array() to populate the UUIDs lazily on-demand. Signed-off-by: Caleb Connolly --- lib/efi_loader/Kconfig | 12 ++++++++++ lib/efi_loader/efi_capsule.c | 1 + lib/efi_loader/efi_firmware.c | 52 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 430bb7f0f7dc..9553520c6bba 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -235,8 +235,20 @@ config EFI_CAPSULE_ON_DISK_EARLY If this option is enabled, capsules will be enforced to be executed as part of U-Boot initialisation so that they will surely take place whatever is set to distro_bootcmd. +config EFI_CAPSULE_NAMESPACE_GUID + string "Namespace for dynamic capsule GUIDs" + # v4 UUID as a default for upstream U-Boot boards + default "8c9f137e-91dc-427b-b2d6-b420faebaf2a" + depends on EFI_HAVE_CAPSULE_SUPPORT + help + Define the namespace or "salt" GUID used to generate the per-image + GUIDs. This should be a GUID in the standard 8-4-4-4-12 format. + + Device vendors are expected to generate their own namespace GUID + to avoid conflicts with upstream/community images. + config EFI_CAPSULE_FIRMWARE bool config EFI_CAPSULE_FIRMWARE_MANAGEMENT diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index 0937800e588f..ac02e79ae7d8 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -19,8 +19,9 @@ #include #include #include #include +#include #include #include #include diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c index ba5aba098c0f..81d060b47a34 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -244,8 +244,57 @@ void efi_firmware_fill_version_info(struct efi_firmware_image_descriptor *image_ free(var_state); } +/** + * efi_capsule_update_info_gen_ids - generate GUIDs for the images + * + * Generate the image_type_id for each image in the update_info.images array + * using the first compatible from the device tree and a salt + * UUID defined at build time. + * + * Returns: status code + */ +static efi_status_t efi_capsule_update_info_gen_ids(void) +{ + int ret, i; + struct uuid namespace; + const char *compatible; /* Full array including null bytes */ + struct efi_fw_image *fw_array; + + fw_array = update_info.images; + /* Check if we need to run (there are images and we didn't already generate their IDs) */ + if (!update_info.num_images || + memchr_inv(&fw_array[0].image_type_id, 0, sizeof(fw_array[0].image_type_id))) + return EFI_SUCCESS; + + ret = uuid_str_to_bin(CONFIG_EFI_CAPSULE_NAMESPACE_GUID, + (unsigned char *)&namespace, UUID_STR_FORMAT_GUID); + if (ret) { + log_debug("%s: EFI_CAPSULE_NAMESPACE_GUID is invalid: %d\n", __func__, ret); + return EFI_UNSUPPORTED; + } + + compatible = ofnode_read_string(ofnode_root(), "compatible"); + if (!compatible) { + log_debug("%s: model or compatible not defined\n", __func__); + return EFI_UNSUPPORTED; + } + + for (i = 0; i < update_info.num_images; i++) { + gen_v5_guid(&namespace, + &fw_array[i].image_type_id, + compatible, strlen(compatible), + fw_array[i].fw_name, u16_strlen(fw_array[i].fw_name) * sizeof(uint16_t), + NULL); + + log_debug("Image %ls UUID %pUl\n", fw_array[i].fw_name, + &fw_array[i].image_type_id); + } + + return EFI_SUCCESS; +} + /** * efi_fill_image_desc_array - populate image descriptor array * @image_info_size: Size of @image_info * @image_info: Image information @@ -282,8 +331,11 @@ static efi_status_t efi_fill_image_desc_array( return EFI_BUFFER_TOO_SMALL; } *image_info_size = total_size; + if (efi_capsule_update_info_gen_ids() != EFI_SUCCESS) + return EFI_UNSUPPORTED; + fw_array = update_info.images; *descriptor_count = update_info.num_images; *descriptor_version = EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION; *descriptor_size = sizeof(*image_info); From patchwork Tue Jul 2 13:30:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 809116 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp212211wru; Tue, 2 Jul 2024 06:31:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUbWcBee+kfy/wGQ6DFewyxwSYQ03o7IC7A3qZkAX+taBjWPgg9Nde70TKAyuBDxPlbtUPRrV6JT2aTJMRMeOdx X-Google-Smtp-Source: AGHT+IFmK9FA/D5lGAyF6ix6SU9gyrR0uRN2tuHjPT3R8Cp59BtwmjuEBcAonvVUkjgmV5DO+Gpb X-Received: by 2002:a17:907:bb8e:b0:a72:7a70:f2e3 with SMTP id a640c23a62f3a-a7514451af5mr553392166b.39.1719927096344; Tue, 02 Jul 2024 06:31:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719927096; cv=none; d=google.com; s=arc-20160816; b=PzxbCzMTrT3Xh/WDBckykzH+0H1r4ooY11DkePxF+fb5BtjuGhcXVStiPy9UOqYiWX xQkn5JXUOdvtR6v8IHhrqIcFKtZ20Jkmz+dMAhYoMXP9/GHx5WMB/kC+yGB34gCXFvRf Xnv2N/vKhGZpn5ud5Kt7a/HRwOWSnrrFEfDSGbk2iUTFXp1M2u8UU+Iuns94mhV9vVEK zh6UZZCJCPoLV2axWctSeij5XQ7QtJyUl9KeZ+Se7DutGZW2fJURYl7QE+zxX3bkaA5M B4zF69FABUA6O8jgBD603UolkeN569ZZckILLSgiBceQKEsCy+1rxNlqAW0C6UGc3XbX CI9Q== 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=gN9DoT9GCRFkCrGOvTijcwQaySiqv9geeCMsx1qW1o8=; fh=sDOllG/o36AjTyq/6Jg9OXEbA0vYesHr/jSGiYyR/J0=; b=xGC8NzLF3TJJ7n60Z2cU/vvc+ZorsPvbvVeiwFjjcPsvUksM0ZMYcdCfDTy2e47HhX /0d//QDL/s5fmq1I4ZPfUjTy5rzt4GZEpQ1aLyf1pvBYDAJkc5y6YD5hwJzDqY7YQpEe HlOVQHeBEPsXEVB6bGtEoCB0rtvwhoM0GRcf2dggTIx9qoncpMr3/eAw19wXaDoSKgt+ /CqKvqiRNXNolovKkaecJe6uod+Uwqg/3ppS+C4OfrtCnHU63cwd0VPdPJRzKsH75a41 q8+6HrmN/9ETNe13U4th1+2BHEmA9s9xJwK5RmDjP2t4JAntJYHfpS2zLDp8wZZKW1/2 f14A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zAt6faOZ; 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 Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-a72ab0989f2si467144066b.904.2024.07.02.06.31.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:31:36 -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=zAt6faOZ; 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 Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 20C6788725; Tue, 2 Jul 2024 15:30:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="zAt6faOZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7F4948871B; Tue, 2 Jul 2024 15:30:51 +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 70673886FD for ; Tue, 2 Jul 2024 15:30:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-57d044aa5beso1911847a12.2 for ; Tue, 02 Jul 2024 06:30:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719927049; x=1720531849; 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=gN9DoT9GCRFkCrGOvTijcwQaySiqv9geeCMsx1qW1o8=; b=zAt6faOZJtkqr1x3jiwk2H5nBQ4voCVBq5wWjDGE6gpDg46vPPK245n9USdqOXPJQ4 nqg1LBqoP8p45F5oJM+pBmrVHRmY6AwYdGw/j4YEjaP6nW8/YGZ3UOzRL9BdNSQHs55q mJBm0sFNnwDWtGFZ3fbYdEXmPUg7JJLXO0GEMdLnTaOxEDjsR68tU5X+wc4+HB1r1vyn 7yju9fvUTngTr2eVsQv57usJBpyEyyqkEu6OqMNnnBz1nRcfihW8iaCyM/N9PSqan+/L hnnQj1JoGXxU6svgWcko5GRv/RQ+uwdqhgDLxMo6I0pNwVGYjwUEV6hsvaJTOrqUYOye 9uxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719927049; x=1720531849; 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=gN9DoT9GCRFkCrGOvTijcwQaySiqv9geeCMsx1qW1o8=; b=eV/qLDstqOz24wDQPLL/NWJ02dN9frRbe1SfVpuU9tIScWQdoF5wLtwbmUMFpKZyDM zs2alF06iIRYSf04wl25e1I/WKU82MmOWKs/TOHX+G+uTx3w2szaD4ujXc6GHjp5K/tO q10L+nj4mjplCCCqlcFlFq75dT1NG6YWTMrX09/HeHohlqAS2eS0U97kH8D+K/oc0iYx D7Xzi8WS2DV2FkXArEITSBNnsLTn4ZGIUwEQxp8kmV495DM4RcSVMSfhq3bmcLLIIG0j bdjUuD8gjXWgERzcQtl7u1cfTYpvTQ5xzY3fkIuFmJhVWdewVmce+z935ivKquK6uFA4 EBxQ== X-Forwarded-Encrypted: i=1; AJvYcCWl1yzTC2OG6kK0/t7wjcK2H3itMSrMLfGDu7EK53p5y/+fOX9jJR0HKbUWwY7P0YCSapsE75nPds+OEih60rleJ1Rsug== X-Gm-Message-State: AOJu0Ywy+ioYDy8qNbitkbWJJUw8E6RV8SvJjM0rMftHjPpWqRKe63lH 20G/4cNXCUhg6KuyoG3x29RCsLv0heQWntnXMCXhWd6LRbjOA0+/LH1b5PM1Wcw= X-Received: by 2002:a17:907:2cc2:b0:a72:6055:788d with SMTP id a640c23a62f3a-a7514452aefmr748210466b.42.1719927048934; Tue, 02 Jul 2024 06:30:48 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7430367d55sm323796166b.87.2024.07.02.06.30.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:30:48 -0700 (PDT) From: Caleb Connolly Date: Tue, 02 Jul 2024 15:30:44 +0200 Subject: [PATCH v4 04/10] doc: uefi: document dynamic UUID generation MIME-Version: 1.0 Message-Id: <20240702-b4-dynamic-uuid-v4-4-a00c82d1f504@linaro.org> References: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@linaro.org> In-Reply-To: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2204; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=m34fpCQOsOSaLRHycWoKBc/ZZ93pL9gtpyIdV2TquYQ=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmhAECT1RAowug9C52VpkfQkHu1DFOR0rHrmw2u RraUGpc/dGJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZoQBAgAKCRAFgzErGV9k th0cD/9xp++wB5kS9msm+4bo2cy5M/mR9G7EBnNxbhZ4QGBiZDnjtJna7w/t3rL1p0DkYT0ftHR gLkUUKsQcZ79oxkPicCxDLmAo+jaR3pmYp2Xkjq0rtW9MWkpWvnUViwJq4jKvCGsEnRdVmVwlqD 3NKVsdgPXUgSvrsPvP5AgZfukfK0QkcXPRDmsIbaw6fp7+xmNFHN0ViRRdmFtvq2gqlbAWHhvXK VOPV25SJRUYgjWw1/Z4D2Sp5QC5YBUmCsJvLZzKx4H4MnRw1ZIC4XHHwMfkNL+sDVx6R5dSnwMf Tewgty59cDXY1U4lZ0U+DooSB1JUGszbJc52/OhsqLbBuOcRGOxJBQSVad5JyBywGIHkaD6F9cd Vi5lAVWvwrpm76cIvbKUYHh18vgwj+VI0V0NUmD1PHdPRX7BY1ifFlD+IDGLgly32S843Vr5Qs+ t0qUOAw4qz+7IwVs128RObH3aaaT6cI8dRQYYZWfHvQat1a3Blw/zsNSWHwJ9BWJLUHO4dHUT8A 0dC9GVcOjWB1Q71DPJSjaVXZSgqZoJ25BxNRXgDwaq8LwBKUdpET0tWDozFrrFZJEQlzaBEns8p Na2ztvbAMfzsYC0UDYa+j3k4uoKhsloK/Z/rH9bd4erZnyncaoiOTZrJUrzPD5o6IuNz+Va7Xut RfWML+Fn9kXBr7g== 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 0389b269c01b..19931af9ced7 100644 --- a/doc/develop/uefi/uefi.rst +++ b/doc/develop/uefi/uefi.rst @@ -448,8 +448,35 @@ the location of the firmware updates is not a very secure practice. Getting this information from the firmware itself is more secure, assuming the firmware has been verified by a previous stage boot loader. +Dynamic FWU GUIDs +***************** + +The image_type_id contains a GUID value which is specific to the image +and board being updated, that is to say it should uniquely identify the +board model (and revision if relevant) and image pair. Traditionally, +these GUIDs are generated manually and hardcoded on a per-board basis, +however this scheme makes it difficult to scale up to support many +boards. + +To address this, v5 GUIDs can be used to generate board-specific GUIDs +at runtime, based on the board's devicetree root compatible +(e.g. "qcom,qrb5165-rb5"). + +These strings are combined with the fw_image name to generate GUIDs for +each image. Support for dynamic UUIDs can be enabled by generating a new +namespace UUID and setting EFI_CAPSULE_NAMESPACE_GUID to it. Dynamic GUID +generation is only enabled if the image_type_id property is unset for your +firmware images, this is to avoid breaking existing boards with hardcoded +GUIDs. + +The mkeficapsule tool can be used to determine the GUIDs for a particular +board and image. It can be found in the tools directory. + +Firmware update images +********************** + The firmware images structure defines the GUID values, image index values and the name of the images that are to be updated through the capsule update feature. These values are to be defined as part of an array. These GUID values would be used by the Firmware Management From patchwork Tue Jul 2 13:30:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 809117 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp212328wru; Tue, 2 Jul 2024 06:31:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWPktue3jJsaNvZdIGHUeEA44snnzwMHOfwsSMtW2dFeGRn8CaRrkiQ3wyNi1QUu5+3i5oanuY+c1g2sUC4YDgv X-Google-Smtp-Source: AGHT+IFJlMg/Nnp0uHzbnJJrRkdySFkbYRxCGl5Bc8nAqbqzHsZbrjO07tLJ4oPpZyagCKp3Jmah X-Received: by 2002:a05:6402:40c7:b0:57d:5bc:56d9 with SMTP id 4fb4d7f45d1cf-5879eaff7e9mr6008732a12.2.1719927109258; Tue, 02 Jul 2024 06:31:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719927109; cv=none; d=google.com; s=arc-20160816; b=R2qgbMzxLm4Lsx3Pf7E3h2GOXOjGRm5KfExJtYiZUiDMlqRwyM4RePmjkPlTTENTUY dpygREYTOaZc2j3RPVgTUz/NzN1z0f1hYoadYh+nLJ6qlvpYtqL0tgvuual3NFhnjiji UNNHOLXbbdAzYLwHUqvcs0BCXk1wmgywMMD4w1cAGOgZNXSmhEO6Xf97iN+COQBCrG29 9DuWotus6Bxa/navfpNLniJWAeibOiovqKuYPzKx2w33/emMUkXl7mVQM1i9VA8Q+/9C LtLO38JWO7WKrOgxFKnPx2JniLa/WDEkWww7EHUNWBLjhRk4DqMWsBXq3hYh5LDN5s2A 604Q== 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=7y2Aqe9bNKKYxPOwwmHZj4GaTeg6kQWNiSCUi9GjQ/M=; fh=feJImn82i+z/BA1gjJM1Gu3hDzKaZIb47vFvvfVCoyU=; b=1Jc3Y4R9Y37uOoOCoMW+fBUXcd3j62nY6Ud6uaGyAdWf9kDajhWPtVIJg6FWnzgnqs Xtoit07o0cXZye+UBVtTsZxA4fWr6voFtgRsZbfEeubtYe7Jp95GguRHB5w78MPoGQy0 9mjeq2oyv4majahd351bMl/tiIQFicAMdH1XyEf2lIhio1MASVdlkb+0E6j23ei1o3C8 5X0SxCNPxznm/gahLERKarbJTpVzlKICRGc5Z1rdr+XXPp1gx3rv3nkb8BD/bAK67ElF 6InNiaRuwziq5hlMpMNcpkmCHGbhbJvMmC3Vttr1PfcI3YQP9WViRPIXolkD8PovaK+1 PvSw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Vo5ck9vg; 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 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-58615033780si4841901a12.324.2024.07.02.06.31.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:31: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=Vo5ck9vg; 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 Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8314588709; Tue, 2 Jul 2024 15:30:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Vo5ck9vg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C59B287CF8; Tue, 2 Jul 2024 15:30:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-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 9A37C8850A for ; Tue, 2 Jul 2024 15:30:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-58bac81f3f9so829287a12.2 for ; Tue, 02 Jul 2024 06:30:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719927050; x=1720531850; 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=7y2Aqe9bNKKYxPOwwmHZj4GaTeg6kQWNiSCUi9GjQ/M=; b=Vo5ck9vgSTA4abiECiElAcMcE29EdwaoErnT0O18glv+C8orzT/dIGC8BvqO3y3/Yd TE38v3F/WVe5JMESGlekjzmZIJj1lwXXCru0o1TFbO6L4fpWai4SAOQ91XyV6HcMDdzm VvjYNh14/pLL/P7OrtoUIXca0NZ8gIPD7mxr9Fi3KQeEJoh2jshxhr/ND2g9sLq47Pge /R0+MoayNDdzxrR2L5pI40Y8kqJTiS8ULm1Wp+qt4l9+2vL8LQuACQDdV91gMwbx3j0x SLvbsFkF99prX9YLst4oE845i9s/1rHpaJLcXaI5Ez+DzhS+h4cYoxUF6cUj5fM1vlV+ PaAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719927050; x=1720531850; 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=7y2Aqe9bNKKYxPOwwmHZj4GaTeg6kQWNiSCUi9GjQ/M=; b=n5MEk5LK228q2i7DOEBGm1dip+A65fsFl8e1q+5EB59Apn1ZS1qc5h6CPA7sm2uTuW Tjswj3JjZHTzQ/BSPh2thTNvWffbDyZbiakg2pXt9jBQstQMnq4GEDKXCyZKWmuXkDWX qjs7CGaB5BdN1Ncx3uM6uVDZrJfzliu9P5xHW2Cc/tfVcmbzDi9F4aZfJyFc3xNxEH3F 4Q8WfolrRZEqYxdBOyRLmwvl2iTHVXdCzk5OSyvkW5UfddG8PfZNqsIpC+VNL/gaYkD/ QE/pYukd/D6a0TL+gsOXWjsGIla3ZuXYwIIMHIn21ZjkEqHpaaWH5FqnDY13SLapUCKd AlhQ== X-Forwarded-Encrypted: i=1; AJvYcCUb23MOZfMfoS2deypLYT4LtuRR35oO0X0F86fQCD/9+TrODvgktMEvmEK8qVxAxjaTOwfKFc3LzaF7isLU8Pxg36GC8Q== X-Gm-Message-State: AOJu0YwFETBpuNiWVsK9exiHkiXrSm0OKaiggt60HNBnTLw5AgBxAQsG CJMkGR5+gfhCn6UBH1gm6pgW/mgd2CtKA/3PgLFkLIzQaWYBGjOKVMxHZPY/He0= X-Received: by 2002:a17:907:72c2:b0:a69:13a2:4f6e with SMTP id a640c23a62f3a-a7514512d6fmr695901866b.74.1719927050060; Tue, 02 Jul 2024 06:30:50 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7430367d55sm323796166b.87.2024.07.02.06.30.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:30:49 -0700 (PDT) From: Caleb Connolly Date: Tue, 02 Jul 2024 15:30:45 +0200 Subject: [PATCH v4 05/10] sandbox: switch to dynamic UUIDs MIME-Version: 1.0 Message-Id: <20240702-b4-dynamic-uuid-v4-5-a00c82d1f504@linaro.org> References: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@linaro.org> In-Reply-To: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=10572; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=zv4jofCF6+YseWsXVvbv52gSZxVgEi77F83BqYSOU5w=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmhAECUAtQUaSTnNUUiqbq5bda64aOPgXQSPruV cA3hfghDFKJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZoQBAgAKCRAFgzErGV9k tsRuD/9iGS4PoM4u2gVkVyxr73suk2J5jxqx6ML+PAOI09x2myGVYSsAMW1UMOVswx70u78Okci QBSoEitoygX67ctCJEEfEeH+zwRHD5CJbBUDytM1ld532jtJlFVDdBmHRHqgSBwxBJhmNJMphD0 5lCTkugZC9JwxXhcpc4eU8zULV1Nuwta5vzIxpQwb3H8550HmW7pSloYhncHE5IaGr/pkGzUOjP bubivG8KcN1pzr34dJQVHsJzmSWY74XUBZQsAgmTD1C/aSzB046ubQNW+vuoMKqrhz8Bm/NrYk2 ijyFU4l6BhudFTCEwEhSgDBUYUbdpwNFnt8UxTtLET4+R/3juMBAk7xlByFXGuhJ0mTmgY3uOZ2 aNid9oB6lQLYDEXOrrHhv5oyOloIvR8Elb8nH7s/jJ42Jl5sI9bMf01OFD9Qq35Diu2ieeZf8n1 3GWqrLaLxV8RzMTE5NhiXXz0jYLPYflcGlfLJB9nuDS0ybyFCxOqdvc61H0UhbdXyyn4EieAwbl IIDovi5M0rZtYBY8atWBfoe6c3UOta0hyxxU8WzCOv/6O92ZSBE07fqgkL95pTGudJt68x+6U6E 4D+b6jT5EyB1heGlfcVnGdSZNkXic3DX1TxFquNaxv5NfOElZvoramFrGBR4HmoeyFCI1OGluIl 3dyat55R4GsZl+Q== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Migrate sandbox over to generating it's capsule update image GUIDs dynamically from the namespace and board/image info. Update the reference and tests to use the new GUIDs. Signed-off-by: Caleb Connolly --- board/sandbox/sandbox.c | 16 ---------------- include/sandbox_efi_capsule.h | 6 +++--- .../tests/test_efi_capsule/test_capsule_firmware_fit.py | 2 +- .../tests/test_efi_capsule/test_capsule_firmware_raw.py | 8 ++++---- .../test_efi_capsule/test_capsule_firmware_signed_fit.py | 2 +- .../test_efi_capsule/test_capsule_firmware_signed_raw.py | 4 ++-- test/py/tests/test_efi_capsule/version.dts | 6 +++--- tools/binman/etype/efi_capsule.py | 2 +- tools/binman/ftest.py | 2 +- 9 files changed, 16 insertions(+), 32 deletions(-) diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c index 802596569c64..d97945e58fcf 100644 --- a/board/sandbox/sandbox.c +++ b/board/sandbox/sandbox.c @@ -31,36 +31,20 @@ */ gd_t *gd; #if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) -/* GUIDs for capsule updatable firmware images */ -#define SANDBOX_UBOOT_IMAGE_GUID \ - EFI_GUID(0x09d7cf52, 0x0720, 0x4710, 0x91, 0xd1, \ - 0x08, 0x46, 0x9b, 0x7f, 0xe9, 0xc8) - -#define SANDBOX_UBOOT_ENV_IMAGE_GUID \ - EFI_GUID(0x5a7021f5, 0xfef2, 0x48b4, 0xaa, 0xba, \ - 0x83, 0x2e, 0x77, 0x74, 0x18, 0xc0) - -#define SANDBOX_FIT_IMAGE_GUID \ - EFI_GUID(0x3673b45d, 0x6a7c, 0x46f3, 0x9e, 0x60, \ - 0xad, 0xab, 0xb0, 0x3f, 0x79, 0x37) - struct efi_fw_image fw_images[] = { #if defined(CONFIG_EFI_CAPSULE_FIRMWARE_RAW) { - .image_type_id = SANDBOX_UBOOT_IMAGE_GUID, .fw_name = u"SANDBOX-UBOOT", .image_index = 1, }, { - .image_type_id = SANDBOX_UBOOT_ENV_IMAGE_GUID, .fw_name = u"SANDBOX-UBOOT-ENV", .image_index = 2, }, #elif defined(CONFIG_EFI_CAPSULE_FIRMWARE_FIT) { - .image_type_id = SANDBOX_FIT_IMAGE_GUID, .fw_name = u"SANDBOX-FIT", .image_index = 1, }, #endif diff --git a/include/sandbox_efi_capsule.h b/include/sandbox_efi_capsule.h index 3e288e8a84a2..84d45ec5cfd5 100644 --- a/include/sandbox_efi_capsule.h +++ b/include/sandbox_efi_capsule.h @@ -5,11 +5,11 @@ #if !defined(_SANDBOX_EFI_CAPSULE_H_) #define _SANDBOX_EFI_CAPSULE_H_ -#define SANDBOX_UBOOT_IMAGE_GUID "09d7cf52-0720-4710-91d1-08469b7fe9c8" -#define SANDBOX_UBOOT_ENV_IMAGE_GUID "5a7021f5-fef2-48b4-aaba-832e777418c0" -#define SANDBOX_FIT_IMAGE_GUID "3673b45d-6a7c-46f3-9e60-adabb03f7937" +#define SANDBOX_UBOOT_IMAGE_GUID "985f2937-7c2e-5e9a-8a5e-8e063312964b" +#define SANDBOX_UBOOT_ENV_IMAGE_GUID "9e339473-c2eb-530a-a69b-0cd6bbbed40e" +#define SANDBOX_FIT_IMAGE_GUID "46610520-469e-59dc-a8dd-c11832b877ea" #define SANDBOX_INCORRECT_GUID "058b7d83-50d5-4c47-a195-60d86ad341c4" #define UBOOT_FIT_IMAGE "u-boot_bin_env.itb" diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py b/test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py index 11bcdc2bb293..a726c71c1138 100644 --- a/test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py +++ b/test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py @@ -146,9 +146,9 @@ class TestEfiCapsuleFirmwareFit(): verify_content(u_boot_console, '100000', 'u-boot:Old') verify_content(u_boot_console, '150000', 'u-boot-env:Old') else: # ensure that SANDBOX_UBOOT_IMAGE_GUID is in the ESRT. - assert '3673B45D-6A7C-46F3-9E60-ADABB03F7937' in ''.join(output) + assert '985F2937-7C2E-5E9A-8A5E-8E063312964B' in ''.join(output) assert 'ESRT: fw_version=5' in ''.join(output) assert 'ESRT: lowest_supported_fw_version=3' in ''.join(output) verify_content(u_boot_console, '100000', 'u-boot:New') diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware_raw.py b/test/py/tests/test_efi_capsule/test_capsule_firmware_raw.py index a5b5c8a3853a..ca51a279763f 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 @@ -133,12 +133,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' @@ -187,14 +187,14 @@ class TestEfiCapsuleFirmwareRaw: verify_content(u_boot_console, '100000', 'u-boot:Old') verify_content(u_boot_console, '150000', 'u-boot-env:Old') else: # ensure that SANDBOX_UBOOT_IMAGE_GUID is in the ESRT. - assert '09D7CF52-0720-4710-91D1-08469B7FE9C8' in ''.join(output) + assert '985F2937-7C2E-5E9A-8A5E-8E063312964B' in ''.join(output) assert 'ESRT: fw_version=5' in ''.join(output) assert 'ESRT: lowest_supported_fw_version=3' in ''.join(output) # ensure that SANDBOX_UBOOT_ENV_IMAGE_GUID is in the ESRT. - assert '5A7021F5-FEF2-48B4-AABA-832E777418C0' in ''.join(output) + assert '9E339473-C2EB-530A-A69B-0CD6BBBED40E' in ''.join(output) assert 'ESRT: fw_version=10' in ''.join(output) assert 'ESRT: lowest_supported_fw_version=7' in ''.join(output) verify_content(u_boot_console, '100000', 'u-boot:New') diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_fit.py b/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_fit.py index 44a58baa3106..debbce8bdbdf 100644 --- a/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_fit.py +++ b/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_fit.py @@ -156,9 +156,9 @@ class TestEfiCapsuleFirmwareSignedFit(): 'u-boot-env raw 0x150000 0x200000"', 'efidebug capsule esrt']) # ensure that SANDBOX_UBOOT_IMAGE_GUID is in the ESRT. - assert '3673B45D-6A7C-46F3-9E60-ADABB03F7937' in ''.join(output) + assert '46610520-469E-59DC-A8DD-C11832B877EA' in ''.join(output) assert 'ESRT: fw_version=5' in ''.join(output) assert 'ESRT: lowest_supported_fw_version=3' in ''.join(output) verify_content(u_boot_console, '100000', 'u-boot:New') diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_raw.py b/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_raw.py index 83a10e160b8c..439bd71b3a7d 100644 --- a/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_raw.py +++ b/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_raw.py @@ -150,14 +150,14 @@ class TestEfiCapsuleFirmwareSignedRaw(): 'u-boot-env raw 0x150000 0x200000"', 'efidebug capsule esrt']) # ensure that SANDBOX_UBOOT_IMAGE_GUID is in the ESRT. - assert '09D7CF52-0720-4710-91D1-08469B7FE9C8' in ''.join(output) + assert '985F2937-7C2E-5E9A-8A5E-8E063312964B' in ''.join(output) assert 'ESRT: fw_version=5' in ''.join(output) assert 'ESRT: lowest_supported_fw_version=3' in ''.join(output) # ensure that SANDBOX_UBOOT_ENV_IMAGE_GUID is in the ESRT. - assert '5A7021F5-FEF2-48B4-AABA-832E777418C0' in ''.join(output) + assert '9E339473-C2EB-530A-A69B-0CD6BBBED40E' in ''.join(output) assert 'ESRT: fw_version=10' in ''.join(output) assert 'ESRT: lowest_supported_fw_version=7' in ''.join(output) verify_content(u_boot_console, '100000', 'u-boot:New') diff --git a/test/py/tests/test_efi_capsule/version.dts b/test/py/tests/test_efi_capsule/version.dts index 07850cc6064c..3aebb5b64fbd 100644 --- a/test/py/tests/test_efi_capsule/version.dts +++ b/test/py/tests/test_efi_capsule/version.dts @@ -7,18 +7,18 @@ firmware-version { image1 { lowest-supported-version = <3>; image-index = <1>; - image-type-id = "09D7CF52-0720-4710-91D1-08469B7FE9C8"; + image-type-id = "985F2937-7C2E-5E9A-8A5E-8E063312964B"; }; image2 { lowest-supported-version = <7>; image-index = <2>; - image-type-id = "5A7021F5-FEF2-48B4-AABA-832E777418C0"; + image-type-id = "9E339473-C2EB-530A-A69B-0CD6BBBED40E"; }; image3 { lowest-supported-version = <3>; image-index = <1>; - image-type-id = "3673B45D-6A7C-46F3-9E60-ADABB03F7937"; + image-type-id = "46610520-469E-59DC-A8DD-C11832B877EA"; }; }; }; diff --git a/tools/binman/etype/efi_capsule.py b/tools/binman/etype/efi_capsule.py index e32037178221..0609760d7174 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 8a44bc051b36..d12f1561b367 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -123,9 +123,9 @@ TEE_ADDR = 0x5678 # Firmware Management Protocol(FMP) GUID FW_MGMT_GUID = '6dcbd5ed-e82d-4c44-bda1-7194199ad92a' # Image GUID specified in the DTS -CAPSULE_IMAGE_GUID = '09d7cf52-0720-4710-91d1-08469b7fe9c8' +CAPSULE_IMAGE_GUID = '985F2937-7C2E-5E9A-8A5E-8E063312964B' # Windows cert GUID WIN_CERT_TYPE_EFI_GUID = '4aafd29d-68df-49ee-8aa9-347d375665a7' # Empty capsule GUIDs EMPTY_CAPSULE_ACCEPT_GUID = '0c996046-bcc0-4d04-85ec-e1fcedf1c6f8' From patchwork Tue Jul 2 13:30:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 809118 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp212416wru; Tue, 2 Jul 2024 06:32:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV0hfsJSA/CUoW5X0enSh8pxZiMcYeNwD8xMa1aCwXJVGO7Iv+5YxNBNkXx9X1N8FqtT9w6VbB4m/xa27LuPoxX X-Google-Smtp-Source: AGHT+IEBXgRs7+WJQpfd8PNEl8sCLb/R0Nrq4JWps6c4VVXn3GIotaVMf/4DNEYL6yVx5c3dEK4D X-Received: by 2002:a05:6512:124a:b0:529:b718:8d00 with SMTP id 2adb3069b0e04-52e8264b5dfmr8049507e87.8.1719927120954; Tue, 02 Jul 2024 06:32:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719927120; cv=none; d=google.com; s=arc-20160816; b=PpDJ0oTQoF1fkLnefcUscV8ALIlx96KpkN/KqPyeNqJlxwJLwBxJpgNhUKfU7AZaid 31bpe8z8FlGYV6VFdtWbEsZJaZF7LqmUbrZD33DvyVINu8axI51K2vR17t1T3GXPl91O cnGJTGzociPco2eumsybEV+1ghUnrSdXqn9OGSSx2zcsL3o4HaGj+AZCwpW2lE/wD4XX ufmcBbI9ciVDQuBzeCTduDxAa62cOk6+97UP/z4jx/MXCdP8do1gDB8lmmwJQrqt8IWe UOuOjsfSe8HfqeJA1/uTqoY7qZTSoK39BVg7hBUi+bHMRDFcd+UuOD7g82bVDtTmPJme dzSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=r/tH18cOYdnbYI0rrw7CpCVnGxtTU4g0IPgerw/jV5c=; fh=/lYJ7dEMrxEe8J8194d4JBcA/Ogi90zPpPtbINhI0ss=; b=TodR5s5m8uMs28ngrWOVmDVOO6Wtoj47wWyz5lwzLw95j13atO5vO8I/PIwMiAYdAg g1Zx9c5xe08/8lQYsco2wDHhD8qcFAm/6Jt9KORKIb+XM+0Wti03Pi3pQdCfajzp1jve lira1Rhh4Ha7N/HE4zPehtJAOXzCmx8ZlJHx6SRA+JdeHT+wx4L8Za8rxh7Lsm4Z0IuG rApwr96KIYjPftX9FgUYOrgaBISpMiGl4biBzPPRP3Elpld53mTy7AgKTawSz+MRCLM/ RWPVCgETHH2R0/WzxhSHW31B3EP5dtw4BqBtY4j3xhkiLF27NlstG4mKmJWWUVdio00i BA/Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hBtGfDJg; 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 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-a72aaef5f60si468497566b.142.2024.07.02.06.32.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:32:00 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hBtGfDJg; 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 Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E336F8874C; Tue, 2 Jul 2024 15:30:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="hBtGfDJg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 09FEB8871F; Tue, 2 Jul 2024 15:30:54 +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-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) (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 DF53288725 for ; Tue, 2 Jul 2024 15:30:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-52ce9ba0cedso7329418e87.2 for ; Tue, 02 Jul 2024 06:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719927051; x=1720531851; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=r/tH18cOYdnbYI0rrw7CpCVnGxtTU4g0IPgerw/jV5c=; b=hBtGfDJg3s7JLR2wxUa32gpSIa0sUIM9Rri8xjlcNlQFnAvCrPg7vxK0oE9UyYkT/J JycXVTBVN8PFdqxBmZSaix4zBhDkAHDHWQVpR2SCd5xVT9pqSVAJ7KQeUMl/xNEIuk/9 mpbFTgyBsnlJt+/A/uQklO/3ZGjR3uSpQcUuxQs3ct644+xfM8HwLG5mdvQP+InNgl2A r8pbmhcdgdGlxIvQGdC466uziSJku7S/uJdrM2FscoRPMtVD7YVhBlzRTZ4zVleigGzw 3cyeUB5ddMRiV8HD5ZcH1rTb8jNvI+3CFa0tW6ipMaWgwgde3FkpXGV3NX4yZt2jLrxl wfOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719927051; x=1720531851; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r/tH18cOYdnbYI0rrw7CpCVnGxtTU4g0IPgerw/jV5c=; b=hWt1pt7+w97cq2a0LZkCz5lJVWgj4kDYuYj7Oi7Oa62OdZi8U3a8i/pVWGe2y/pFKP 8+iMq5uQgMHGe+oqTWh2LuEdYpwpVoTr5pK9Pm/C4QN6R18O6DSqhe2/7QQxvr1OQtPy X9V/Eq5PKR4zPU66e/S6xE9/gWN46r2SF+1JOl8f8yGQf4ftZv+J0ywck4l1IbSPaWiZ gN8+nSdMKOEhlRFma5ReWKKO2W61rPf1jJGiWtLehhkc1geZARirLIVnBkK/n7JdlusS 06nEgmlW/ELH46ldD2k7r2D173ljmLwSkcJXOsGF0HhZtyegZuCsXnV74eze1MygVuNc R3ow== X-Forwarded-Encrypted: i=1; AJvYcCWeWPkEdQJnMJeoZZvWFwx3xK2XcUM7IeKAhn5qyiAt0INIMyfkbSmD1ifWcSABqi4xIIGBI9S6b9JWE3NZxQa7aaQCyg== X-Gm-Message-State: AOJu0YxmD+kvuQdQWd0yAlh9bZCl5GIKE7g3a+4OVDWQck4MyOenrHtA ungowU+Lexwado+LQ7/RMwK8yq85ndbE7xfX2xCxCx1Zvngvo434ekUArrI7c2c= X-Received: by 2002:ac2:5e22:0:b0:52e:7498:118c with SMTP id 2adb3069b0e04-52e8266ea3emr5324000e87.21.1719927051145; Tue, 02 Jul 2024 06:30:51 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7430367d55sm323796166b.87.2024.07.02.06.30.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:30:50 -0700 (PDT) From: Caleb Connolly Date: Tue, 02 Jul 2024 15:30:46 +0200 Subject: [PATCH v4 06/10] lib: uuid: supporting building as part of host tools MIME-Version: 1.0 Message-Id: <20240702-b4-dynamic-uuid-v4-6-a00c82d1f504@linaro.org> References: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@linaro.org> In-Reply-To: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=5243; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=O65GT19i9rQOizkC2sebcSaH7hMe5ytzOraTZ22qXA0=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmhAEC3AyiWuOKjOpzaDd0f3QlfKbLvm2voA1qT zLAFt4TH7OJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZoQBAgAKCRAFgzErGV9k tvmSD/0fndkvqFnRJOwzb0MYy9Jk9ODoWbrDIIi1bUulN46xP/P6X5itDMz1c4S2Zo7SwiBIUjS OKaaUM6L3Qhakn9cyGsjvJoIK/EbPzbjfQNJedG5GWq8etRJtpPP97ya3brtOynWYF7O0XyjywH qo2Jwxd6K6gNJI7pz0Qvbl29oK3cuUvpFy17wi5T3JpI+TNvydKZVrYcFvLhXVVhtvwr2bGGp8Y UxnWEZR5XPdpoEC2UCqerIkHNh8+gS97wZOc3F8/ZiXk9XGBxqKrJKEDWnOQ3LYKrBlTOQwps6G /snR39uHxYYTRGxoqFF1KIDWW0ReFXfaJQ1JUdSXDXhiGChEHasD/CfUdX4OZou2S/sS+QEmKDK 3GR1KeJMfm648yE0MlJGz/JeEwFtacvNmFUzYx2ufzpSQCvWXJPqEpgcQWkCaKrdmwFNdzBXegb zcAHlspHcItBfIB04XhVILBx4v954xSbqcY/QIDX+++JvDloKmfNHL1iqGNy9nCLk2sU7TVZwOT l/v4t2mPMGvOsMsEHElcZ3z/MVxuCZV6DKO/5tsmFKMSFEsWca8P2yr/l/eoXFA3IF3uG62K29X 4Y/TkjuxaadS/AkAILlWl08z7PXBaCbGihN7LCtV1XCrtIIXjoStWXjtbdACQKxOPjrOPppx86x ZZiiCJrYjCtiAkw== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Adjust the UUID library code so that it can be compiled as part of a host tool. This removes the one redundant log_debug() call, as well as the incorrectly defined LOG_CATEGORY. In general this is a fairly trivial change, just adjusting includes and disabling list_guid. This will be used by a new genguid tool to generate v5 GUIDs that match those generated by U-Boot at runtime. Signed-off-by: Caleb Connolly --- include/uuid.h | 4 ++-- lib/uuid.c | 44 ++++++++++++++++++++++++++++++-------------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/include/uuid.h b/include/uuid.h index 1f4fa103b5e9..7f8414dc906c 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -69,10 +69,10 @@ struct uuid { } __packed; /* Bits of a bitmask specifying the output format for GUIDs */ #define UUID_STR_FORMAT_STD 0 -#define UUID_STR_FORMAT_GUID BIT(0) -#define UUID_STR_UPPER_CASE BIT(1) +#define UUID_STR_FORMAT_GUID 0x1 +#define UUID_STR_UPPER_CASE 0x2 /* Use UUID_STR_LEN + 1 for string space */ #define UUID_STR_LEN 36 #define UUID_BIN_LEN sizeof(struct uuid) diff --git a/lib/uuid.c b/lib/uuid.c index 7d0a8273d157..272e07dc1613 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -6,25 +6,38 @@ * Authors: * Abdellatif El Khlifi */ -#define LOG_CATEGOT LOGC_CORE - +#ifndef USE_HOSTCC #include #include #include #include #include -#include -#include -#include #include #include #include #include #include +#include +#include +#else +#include +#include +#include +#include +#endif +#include +#include +#include +#include #include +#ifdef USE_HOSTCC +/* polyfill hextoul to avoid pulling in strto.c */ +#define hextoul(cp, endp) strtoul(cp, endp, 16) +#endif + int uuid_str_valid(const char *uuid) { int i, valid; @@ -51,8 +64,9 @@ int uuid_str_valid(const char *uuid) static const struct { const char *string; efi_guid_t guid; } list_guid[] = { +#ifndef USE_HOSTCC #ifdef CONFIG_PARTITION_TYPE_GUID {"system", PARTITION_SYSTEM_GUID}, {"mbr", LEGACY_MBR_PARTITION_GUID}, {"msft", PARTITION_MSFT_RESERVED_GUID}, @@ -231,8 +245,9 @@ static const struct { { "EFI_MEMORY_TYPE", EFI_MEMORY_TYPE }, { "EFI_MEM_STATUS_CODE_REC", EFI_MEM_STATUS_CODE_REC }, { "EFI_GUID_EFI_ACPI1", EFI_GUID_EFI_ACPI1 }, #endif +#endif /* !USE_HOSTCC */ }; int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin) { @@ -266,9 +281,8 @@ int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin, uint32_t tmp32; uint64_t tmp64; if (!uuid_str_valid(uuid_str)) { - log_debug("not valid\n"); #ifdef CONFIG_PARTITION_TYPE_GUID if (!uuid_guid_get_bin(uuid_str, uuid_bin)) return 0; #endif @@ -297,19 +311,19 @@ int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin, tmp16 = cpu_to_be16(hextoul(uuid_str + 19, NULL)); memcpy(uuid_bin + 8, &tmp16, 2); - tmp64 = cpu_to_be64(simple_strtoull(uuid_str + 24, NULL, 16)); + tmp64 = cpu_to_be64(hextoul(uuid_str + 24, NULL)); memcpy(uuid_bin + 10, (char *)&tmp64 + 2, 6); return 0; } int uuid_str_to_le_bin(const char *uuid_str, unsigned char *uuid_bin) { - u16 tmp16; - u32 tmp32; - u64 tmp64; + uint16_t tmp16; + uint32_t tmp32; + uint64_t tmp64; if (!uuid_str_valid(uuid_str) || !uuid_bin) return -EINVAL; @@ -324,22 +338,22 @@ int uuid_str_to_le_bin(const char *uuid_str, unsigned char *uuid_bin) tmp16 = cpu_to_le16(hextoul(uuid_str + 19, NULL)); memcpy(uuid_bin + 8, &tmp16, 2); - tmp64 = cpu_to_le64(simple_strtoull(uuid_str + 24, NULL, 16)); + tmp64 = cpu_to_le64(hextoul(uuid_str + 24, NULL)); memcpy(uuid_bin + 10, &tmp64, 6); return 0; } void uuid_bin_to_str(const unsigned char *uuid_bin, char *uuid_str, int str_format) { - const u8 uuid_char_order[UUID_BIN_LEN] = {0, 1, 2, 3, 4, 5, 6, 7, 8, + const uint8_t uuid_char_order[UUID_BIN_LEN] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; - const u8 guid_char_order[UUID_BIN_LEN] = {3, 2, 1, 0, 5, 4, 7, 6, 8, + const uint8_t guid_char_order[UUID_BIN_LEN] = {3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15}; - const u8 *char_order; + const uint8_t *char_order; const char *format; int i; /* @@ -418,8 +432,9 @@ void gen_v5_guid(const struct uuid *namespace, struct efi_guid *guid, ...) tmp16 = (uint16_t *)&guid->b[6]; *tmp16 = be16_to_cpu(*tmp16); } +#ifndef USE_HOSTCC #if defined(CONFIG_RANDOM_UUID) || defined(CONFIG_CMD_UUID) void gen_rand_uuid(unsigned char *uuid_bin) { u32 ptr[4]; @@ -501,4 +516,5 @@ U_BOOT_CMD(guid, CONFIG_SYS_MAXARGS, 1, do_uuid, "e.g. guid guid_env" ); #endif /* CONFIG_CMD_UUID */ #endif /* CONFIG_RANDOM_UUID || CONFIG_CMD_UUID */ +#endif /* !USE_HOSTCC */ From patchwork Tue Jul 2 13:30:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 809119 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp212536wru; Tue, 2 Jul 2024 06:32:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU5oeXF/Z4ur2G4ahO6QNQEOig+DdL/lZwHXZkWo3QNOKCzYSpRZtn0ncQxeURbmiCJlKZjKKcCAUxXyAKG7OBq X-Google-Smtp-Source: AGHT+IE3jRH+1rHqHn5Ej/LheL5LEYIlMTevgAjClWyooQlSq1fEk2GwBMbEGo2FD3TGk938Z7wa X-Received: by 2002:a17:906:194d:b0:a72:5a0d:4831 with SMTP id a640c23a62f3a-a7513935e0cmr663657866b.23.1719927132738; Tue, 02 Jul 2024 06:32:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719927132; cv=none; d=google.com; s=arc-20160816; b=G5GkTHGehjKOI59xYDe2R5c7XpDvnG4g0CtjwCicBjbb5C3DY72H+zuJXMe4YypeZ7 VM21B+hfZANrBykKJcmtv5oDTOUkKv+rh4pdiAVUvlV+4ZlS5/iEEPRdrToAGx2yw4aG pK4G1VGrVN1gubUs6L2IjNaR3wBU8ofDo9bSjCnytzo4GiMvBmw/S3JRs4Tdx5w3J2b8 +CohZffjjIbbvmvxJElCt7JeIvpAb3CgLZ9B/Umc3y6qLeABoTf7E20LJ0HyNdw76xST CZKXHOu4Ztl1uKUaiUgxp4hPA9Ejr69IoXGIHRyox9juL01SW9+2dVC0bNWPD5Yhk5N4 LFJQ== 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=UMZNQLIxkLDQlOwgeDd47anWZHxKsgk2gbcJMAISzOQ=; fh=BzqJvbLCJosCCu5y9xuSrp5qInYp76k/jlaIYbiWA6w=; b=ktmaWYi7xNXzBlKhH3TcagEioSdgKJbwkRq0yk3tygWwn8Hr7ECSmPx66XeeWhiWL4 pIt8FDojsjKL8/OluVk+tDE7BXW5dApp3nfxe+AoK8fbimkwdhHbRJcdKatg8r9YPJlm Xev54+R5z8tWQntUbeU+EYKCQeToAjdL38sh1ObSPXikfzXZKkwz87b4N/2b2C9do1Iy F7/Mxr2kavgml0ZYWg8ry3PxLXPzmVBgDED1oQkimZ7m8x0eXwHKZo28MNHfIv4hWXMB 3LDGHGUwwdUBtJSkpp+LKBF7l9FHqXqMpk1TmC4boaHYxq7byx283ViDXWcpM2dgYhAW 5wUw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O8MAHj8X; 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 Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-a7541b3db3csi74379466b.778.2024.07.02.06.32.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:32:12 -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=O8MAHj8X; 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 Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 533A088729; Tue, 2 Jul 2024 15:30: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=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="O8MAHj8X"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DC0C0886FD; Tue, 2 Jul 2024 15:30:55 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) (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 852FD88730 for ; Tue, 2 Jul 2024 15:30:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-a729d9d7086so824467166b.0 for ; Tue, 02 Jul 2024 06:30:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719927053; x=1720531853; 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=UMZNQLIxkLDQlOwgeDd47anWZHxKsgk2gbcJMAISzOQ=; b=O8MAHj8Xcuy8wM50eBA/hId9oJHATs6rJvUHBwMtc6Q3dVhcjSQAFBon1kgWqEAHx7 EoAHviuk6qtgr2CHbG3bHgQ3r/6KDTbYQZcb9lyMAabFEQo0P34V4gYzZYC+i/Y8gHtS eT74q3qSNDwpAgGQM4TrOaNfupe4q38/68Y88QU0JGjZT3EFk4n4lJArymWtaiKRGdgd 5sl1oQHYqV58/MtheEsGoJftQVRFcCnPHepsA2Vr2Pdmlmd9xQM5GtUA8gAKBBK1mE2T CoNdaD3GBSdtJcwfG9kIL91hjyYKHR+SIk6JH9Mb0wuNSQ9sofm2v/al0cEgnk3ReOKP pVsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719927053; x=1720531853; 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=UMZNQLIxkLDQlOwgeDd47anWZHxKsgk2gbcJMAISzOQ=; b=l1QbzxmjTRVUJZ032jraB9Fnu5dxXQiLqMev0pjFmF5lbEzFjDLA+7iJRxM9OydSAq Nbh995/akHknoEPQDEKZtyYGmp6qwPsp0g+9qcqSa2WW0Q2/xKDMRXqttCqJIGsbjrhT KMs8v87zDyjIX9+pJxgC2s8Y/S3/qrCwNoV2X4yHi9U5cKQrBWumB6B2pCWelZ63N9JB 3h1w6JPgJ3Xk23ZpV4VkDst+a1KowdLgzKk04Zdy2NIZzqkDb9zRvCE6H0kDZwLhB0ka RvvtSUodBVC/Fm/EmpMtdwyt5walWJU20pOSfLitgL6RGo0h2LOWwiSP4JOmIIoEVyIv PTFg== X-Forwarded-Encrypted: i=1; AJvYcCWoKhHjhPQ7yokNw37Jn004f8w1LaksE3lxoVO7C7CNYYsmQbcahd5XCe0Nzsmx7U1ZCRuSb/nOPeMd2R8CvSEGrz+kiA== X-Gm-Message-State: AOJu0YzKxK+R9veYwvWc3CJY4Wj0SVaQFOm6d7JRX2Ob2f3MSL3Jqa+N hXskR/n9zhoakfMEURmriS0Q2pwczIIja57PHgJDA5QVP9WmXWfm9pYmj+moqyY= X-Received: by 2002:a17:907:70a:b0:a72:634d:d843 with SMTP id a640c23a62f3a-a7513954ddfmr789597066b.34.1719927052813; Tue, 02 Jul 2024 06:30:52 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7430367d55sm323796166b.87.2024.07.02.06.30.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:30:52 -0700 (PDT) From: Caleb Connolly Date: Tue, 02 Jul 2024 15:30:47 +0200 Subject: [PATCH v4 07/10] include: export uuid.h MIME-Version: 1.0 Message-Id: <20240702-b4-dynamic-uuid-v4-7-a00c82d1f504@linaro.org> References: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@linaro.org> In-Reply-To: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=15727; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=JxHRkZy037e6RpWqgqKaco9xK0TZR5Qw5ZARyJiq3rs=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmhAECT5Adf2cl1voriN68hITKpQ2zcNsUQmqLZ EDivgG8INCJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZoQBAgAKCRAFgzErGV9k tqg0EACd5EOTRTjwuUfWSgkk2tf3X539fjypXgTaznkyl9o+dwtZEQp1MaKh5H2GeQmSAlxSCkT 6CwqRLj4iEi52BagrErJfD8XR5UEBOK7VOXrvJxThf75kDDiBIhXtpkjh//WJS88PmAnrofQ23n d20w1S0emGvT3zHSz2LFtwjGH5MPYmz6dZyhKm1E5lxDf6VII8eN9jl25TfaPM72TyZC4Xa1G1Z I7HT8mInxiZR0LTqIhDlQUbV4Z25uPAE64jnlKHbR9wjeXUn04UAMeqmsVgJW/WC5K55bPZItsp ZbJFfwgbxXED6yc2EL9gc9pHnUIjwx4HfbfMHH7IoomL6GAqKfUtjdS0pWoXvlc2+LhEYFTa+sE DzhMIVh+G61dnhksycO/RsImyrNsuO7ODMbKB4Eb2AozAVSiGnppjEsbWRjDU8v+k1+Hh9xHhb+ IMBvVqmriqfuzaQWph6XkRxHvrWEBEnvAf3MxZq0S+USAzs0aKZxe6034+0DC/8Zt/7JoADKijU 4u3MvUA2l0x+mSe9uk4+6OhG6Dn+1L08mDbM6TLivx8upWoRkcl6rISrwN8xtYkRqqI1kdu6Gz6 pd6APUdnoOBPjjhfKbuYojBP7vLEOA1dwbKGo94AUB89zbDapQlw0JRJRQWYrw73hXCGIbzTkai zLFL5cfFET6gmPQ== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Move this header to include/u-boot/ so that it can be used by external tools. Signed-off-by: Caleb Connolly --- arch/arm/mach-rockchip/board.c | 2 +- board/cobra5272/flash.c | 2 +- board/gardena/smart-gateway-mt7688/board.c | 2 +- board/socrates/socrates.c | 2 +- board/xilinx/common/board.c | 2 +- cmd/efi.c | 2 +- cmd/efi_common.c | 2 +- cmd/flash.c | 2 +- cmd/gpt.c | 2 +- cmd/nvedit_efi.c | 2 +- cmd/x86/hob.c | 2 +- common/flash.c | 2 +- disk/part_efi.c | 2 +- drivers/firmware/arm-ffa/arm-ffa-uclass.c | 2 +- env/sf.c | 2 +- fs/btrfs/btrfs.c | 2 +- fs/btrfs/compat.h | 2 +- fs/btrfs/disk-io.c | 2 +- fs/ext4/ext4fs.c | 2 +- include/fwu.h | 2 +- include/part.h | 2 +- include/rkmtd.h | 2 +- include/{ => u-boot}/uuid.h | 0 lib/acpi/acpi_dp.c | 2 +- lib/acpi/acpigen.c | 2 +- lib/efi/efi_app.c | 2 +- lib/efi_loader/efi_capsule.c | 2 +- lib/efi_loader/efi_device_path.c | 2 +- lib/efi_loader/efi_variable.c | 2 +- lib/fwu_updates/fwu_mtd.c | 2 +- lib/uuid.c | 2 +- lib/vsprintf.c | 2 +- net/bootp.c | 2 +- test/dm/acpi_dp.c | 2 +- test/dm/acpigen.c | 2 +- test/lib/uuid.c | 2 +- 36 files changed, 35 insertions(+), 35 deletions(-) diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index 8a57b8217ff2..0fdf9365b41e 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -24,9 +24,9 @@ #include #include #include #include -#include +#include #include #include #include #include diff --git a/board/cobra5272/flash.c b/board/cobra5272/flash.c index 157b71da85e8..0c1b1c7decd8 100644 --- a/board/cobra5272/flash.c +++ b/board/cobra5272/flash.c @@ -10,9 +10,9 @@ #include #include #include #include -#include +#include #include #include #include diff --git a/board/gardena/smart-gateway-mt7688/board.c b/board/gardena/smart-gateway-mt7688/board.c index c6b14bed41fb..eb7fcd630a10 100644 --- a/board/gardena/smart-gateway-mt7688/board.c +++ b/board/gardena/smart-gateway-mt7688/board.c @@ -15,9 +15,9 @@ #include #include #include #include -#include +#include #include #include #define MT76XX_AGPIO_CFG 0x1000003c diff --git a/board/socrates/socrates.c b/board/socrates/socrates.c index 6e6e276cc741..5e5a45ee00db 100644 --- a/board/socrates/socrates.c +++ b/board/socrates/socrates.c @@ -14,9 +14,9 @@ #include #include #include #include -#include +#include #include #include #include #include diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index 30a81376ac41..e11141b94260 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 36b112d59784..be040d7f94a6 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 e5bfaf461c2b..8dac7c57cd30 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-2.0+ #include #include -#include +#include #include #include "kernel-shared/btrfs_tree.h" #include "common/rbtree-utils.h" #include "disk-io.h" diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c index da59cb008fce..15587e92e3e7 100644 --- a/fs/ext4/ext4fs.c +++ b/fs/ext4/ext4fs.c @@ -26,9 +26,9 @@ #include "ext4_common.h" #include #include #include -#include +#include int ext4fs_symlinknest; struct ext_filesystem ext_fs; diff --git a/include/fwu.h b/include/fwu.h index 77ec65e61807..c317613eaaab 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -9,9 +9,9 @@ #include #include #include #include -#include +#include #include struct fwu_mdata; diff --git a/include/part.h b/include/part.h index afae51f1b933..678eb4d7ee99 100644 --- a/include/part.h +++ b/include/part.h @@ -7,9 +7,9 @@ #define _PART_H #include #include -#include +#include #include #include #include diff --git a/include/rkmtd.h b/include/rkmtd.h index 145fede6c840..b7479036b397 100644 --- a/include/rkmtd.h +++ b/include/rkmtd.h @@ -10,9 +10,9 @@ #ifndef __RKMTD__ #define __RKMTD__ #include -#include +#include #define LBA 64 + 512 + 33 #define RK_TAG 0xFCDC8C3B diff --git a/include/uuid.h b/include/u-boot/uuid.h similarity index 100% rename from include/uuid.h rename to include/u-boot/uuid.h diff --git a/lib/acpi/acpi_dp.c b/lib/acpi/acpi_dp.c index 6733809986ae..5714acce0882 100644 --- a/lib/acpi/acpi_dp.c +++ b/lib/acpi/acpi_dp.c @@ -8,9 +8,9 @@ #include #include #include -#include +#include #include #include #include diff --git a/lib/acpi/acpigen.c b/lib/acpi/acpigen.c index b95cabb91493..ecff5a50d504 100644 --- a/lib/acpi/acpigen.c +++ b/lib/acpi/acpigen.c @@ -9,9 +9,9 @@ #define LOG_CATEGORY LOGC_ACPI #include #include -#include +#include #include #include #include #include diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c index 88332c3c910a..9b94a93ee4f1 100644 --- a/lib/efi/efi_app.c +++ b/lib/efi/efi_app.c @@ -16,9 +16,9 @@ #include #include #include #include -#include +#include #include #include #include #include diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index ac02e79ae7d8..d482eac81b25 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 1cc02acb3b26..4d906acd56af 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -15,9 +15,9 @@ #include #include #include #include -#include +#include #include #include #include #include diff --git a/lib/fwu_updates/fwu_mtd.c b/lib/fwu_updates/fwu_mtd.c index ccaba3f3115a..11b42a3d796c 100644 --- a/lib/fwu_updates/fwu_mtd.c +++ b/lib/fwu_updates/fwu_mtd.c @@ -9,9 +9,9 @@ #include #include #include #include -#include +#include #include #include diff --git a/lib/uuid.c b/lib/uuid.c index 272e07dc1613..17d1c4b4a186 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -28,9 +28,9 @@ #endif #include #include #include -#include +#include #include #ifdef USE_HOSTCC /* polyfill hextoul to avoid pulling in strto.c */ diff --git a/lib/vsprintf.c b/lib/vsprintf.c index cfd1f1914edf..e5802866632e 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -17,9 +17,9 @@ #include #include #include #include -#include +#include #include #include #include #include diff --git a/net/bootp.c b/net/bootp.c index 9dfb50749b49..512ab2ed7c81 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -14,9 +14,9 @@ #include #include #include #include -#include +#include #include #include #include "bootp.h" #ifdef CONFIG_LED_STATUS diff --git a/test/dm/acpi_dp.c b/test/dm/acpi_dp.c index 87bd8ae6749b..fe3ffcb2f8bc 100644 --- a/test/dm/acpi_dp.c +++ b/test/dm/acpi_dp.c @@ -6,9 +6,9 @@ * Written by Simon Glass */ #include -#include +#include #include #include #include #include diff --git a/test/dm/acpigen.c b/test/dm/acpigen.c index 7113219792e6..7637ad0e312b 100644 --- a/test/dm/acpigen.c +++ b/test/dm/acpigen.c @@ -8,9 +8,9 @@ #include #include #include -#include +#include #include #include #include #include diff --git a/test/lib/uuid.c b/test/lib/uuid.c index 0914f2c47e77..9629d378c329 100644 --- a/test/lib/uuid.c +++ b/test/lib/uuid.c @@ -7,9 +7,9 @@ * Authors: * Abdellatif El Khlifi */ -#include +#include #include #include #include From patchwork Tue Jul 2 13:30: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: 809120 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp212649wru; Tue, 2 Jul 2024 06:32:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXWETsFqwS8thZ1DzyrVO0V6B4BwY4VnJGV3dTT+YRKEO5NyjmQIhCGxTPHJrNMMZg6phvOChOUZfwKyw8Lztm6 X-Google-Smtp-Source: AGHT+IEYMPfB8wmzkxVXebIy5piVbla5z4oU2qPTfd/7W0X51WzWzsmDXJw+RQzMaICRP2YHYyLc X-Received: by 2002:a05:6402:3484:b0:57d:4692:ba54 with SMTP id 4fb4d7f45d1cf-587806456a3mr7605813a12.6.1719927143647; Tue, 02 Jul 2024 06:32:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719927143; cv=none; d=google.com; s=arc-20160816; b=dc+/b7gEF9wwAkQ6o5c2V1lICKK2XXiFbDutWGowDFfmQR0iaPRTYhNymW0xJ0MQ78 6G1dkD3zrZzaR+Q3Wh3k1wyuGavnh/onhXMpg0NlNMnSDJGsU8aJkjijlqhZj4YblkhP 8BlRH/Bzp3kbffnQAmc7viAqp3WI7SsHiqcR5mC7aaD9yjVaoJ0wisURo+c2XCEmdass 2zherfpq4Asnih1MOQMpdPsS1HpbNFqjQmQnndD6gUGmKH55ruQZnAYnVD6C9s7+7yy4 b8Z/id3/UB54IOzo2NZmTO65agR9/+fnl3F/Sn4NmLSh5GQcC+ywjKBMYwcuBqkTciNP tPyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=yjYV9PN0xWDSskdBgidOP6JWHJHFlMDPu72voIUQ+z8=; fh=jUfErNn+d/7VgEqeCHlsYRXCxn19PY6q7rO1UkgXkpg=; b=MDDRtmBwEvAcQYdFEX4w2/vadVxI5GcVCVOJZulU6RGKr1hIf7l6v6fOFup/nKsmUn ihuCoqFpCB1hZafttbCsUBIwCw+ccYhqgm0gPQJj8n/DpBbcIDm5hcQrCXO9L06YxJdB UZ+ToDQAjHhtQgPm/RTNe2tS0jYxhDvALAxNX12tn4Wyn7bBb3RSyGNfrHk+naBH5XO3 Q0O7ksS8WKJ6dd4tmrIk6rcYlZL10vGdPqPX189rp2Biui3ZX1gl/Ir0OyOUqwaneT1p PReToH10I2RY2/i7D7zrvhFg9mzEtvpJ9bQINd4KZbJX8C1z4D5UPu/jqH5059pUaVAi HpsA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZzS4gO1l; 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 Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-58615c4155fsi4726352a12.683.2024.07.02.06.32.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:32:23 -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=ZzS4gO1l; 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 Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B7D2E88749; Tue, 2 Jul 2024 15:30: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=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="ZzS4gO1l"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C402E8858B; Tue, 2 Jul 2024 15:30:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) (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 B87CC88748 for ; Tue, 2 Jul 2024 15:30: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-ej1-x636.google.com with SMTP id a640c23a62f3a-a7245453319so668874166b.1 for ; Tue, 02 Jul 2024 06:30:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719927054; x=1720531854; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=yjYV9PN0xWDSskdBgidOP6JWHJHFlMDPu72voIUQ+z8=; b=ZzS4gO1lETZuETgVgFEvAYZHCeYWPLit7WlUJmjZSOismzQBADKWtKtT4HHSIdCoK2 X2eILzybDOfAGj3qxBmw1dR/tN+mM/k1iEkfNHkbirsOGYzMG3fU9wqwGwDu6qrXk/8J y/niYpfAQ5ZCO0wahFQW9AFcbbtgtgd9oJrAZzF7gPULEZ1yJbQeahGpOFSQe2s8Hl8/ Jbi+MinAc4I3XH0SjX/zl1hY+CWjVRcbYrALqLBg8jib7akThk5cwfc/lHOncBOCtIer JHDN1ha8H5N+YBEazSoqdwOIye1M92yhA5jTiQblJYal18TmZx/SfXXXOfJ8zj1CuhpA PcuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719927054; x=1720531854; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yjYV9PN0xWDSskdBgidOP6JWHJHFlMDPu72voIUQ+z8=; b=cQ2fzAeIO5egggHDURBk3RxX3ADw8cqjG9EeAYRhUVVjl9Eiwt6/JdLW0ppKnj0SeV 327M+m3xnUpEAsJ892+01l5oTxV3P69uf92AXMvxss/74XjFjj/97boxP6hVxQxXXSWX Y6JPVYxrOsCdlRqDYeFG1X+fo3tUTYGYd2SgZtWkndtPJvWspcPqHo6ViC/DJHEk4/F6 /ulngRpfB+tUCa9NKI4mpEWL+7yCqhFmgdTagu9+/IPYKwK44TnbLXylpxzPgE9hAMZO WCgniF+crB5kUCzTdzgCPm0BWSBqfuXFVYP0/H8GyficJDP66EK+yViOm+m4QfUJxhEr V+sA== X-Forwarded-Encrypted: i=1; AJvYcCWlP39+U59By/Uwa9Yg+GMJURZqPWr0REWa5s7BJwcfLGqZuEgWHMDatQSsS3AKgLafj5Q8JXsvCcTsl2T/ApTvGUObAQ== X-Gm-Message-State: AOJu0YzwWcwSslGQ05JwmIjY/ubPTE0wfe6XnS9aCAbujJHJIT9dVr1m HyXKyNo2RovPsGxg+lem6Pm6fJESdn3OEDNb1aksO1l5/ykLcEbK/fa0pRq2V8M= X-Received: by 2002:a17:907:268e:b0:a6f:e03a:99d with SMTP id a640c23a62f3a-a72aebe5e2bmr1215315266b.0.1719927054245; Tue, 02 Jul 2024 06:30:54 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7430367d55sm323796166b.87.2024.07.02.06.30.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:30:53 -0700 (PDT) From: Caleb Connolly Date: Tue, 02 Jul 2024 15:30:48 +0200 Subject: [PATCH v4 08/10] tools: mkeficapsule: use u-boot UUID library MIME-Version: 1.0 Message-Id: <20240702-b4-dynamic-uuid-v4-8-a00c82d1f504@linaro.org> References: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@linaro.org> In-Reply-To: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=3757; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=aiqd52H8SbFQqjf61URtk1GpaBu2VRarurf54E5zAHs=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmhAEC0BWBqp6szlDj7/JWWG3qPJL7oQYKrHQm/ +gYuO+hXHKJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZoQBAgAKCRAFgzErGV9k tk0WD/0Ro1IE5xZ6NVPsTyYf94QdmNECpbd5oV9bUYluWECzdFrgvB22aFVNoA1jQ2ITom65s1b zNb6cCCTVv6nQXaOiimEbKTGuluTW/VOC+GgqtQYT2sqcJwJjGtCk+QvwOUYQ9iuZc1nItbyjnP MhXSbhWWA//AjOgClWrcsSHoNOIOcgBSS9a60C1cGBtnd6dtWOp0MZvPZZ+NuBXL4yq/+1Cc/2D /qeAWPelzMjRyfSleMaG+sgpUwEzAWPf7Ql9y58PHA062JY7WcAjykLrD3yfTuLTN3LlAYmTVHG d1vhSddsDHiGAcjHCRfwSREZKCwrETav5dk9ALA5oAEiiitNwgx0AEZqgZ+Ljfpx4f1BFQCWA45 BTrpU8Yb/jqgioZ81pGASXROUZ/qz1+wz3H9ytHkmTHf+v24QmLXKCUWO7n2JSV/PcbuX82NF+X UkhRLitwBOKX/EEScRHE58wVfkc/T8nOsxHOnmiqlMnN1KVnO5bJtRa1Y3AWuhYkDxKXKkx43Qy zyKgRJGJJGU9Ob6xKTbV0KCtMbSh4h7gdphW3SkZLuNAwaNnlSDjIlNeU/NBoAkUD9SXmOL0mLi 3J7DK/nglwDhkbO8Uyw9tFQErExFfh3vIPK7tUBk3MWCuliaG5HVXZ7p3CMgrM95Ym+b1gk47v2 Xdk6idsitUDDHuw== 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 Tue Jul 2 13:30: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: 809121 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp212740wru; Tue, 2 Jul 2024 06:32:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXQzzEudyVd2NChFe+Av+YlFWYqGgw6cXPOEIvLMSn4XuLPYKCHtNkS3kOZFnauVUqjfmWCCXXTBnISwxPIBCHe X-Google-Smtp-Source: AGHT+IFUsG9buX3uRgDCofhYquGAAOQzqa68uZyikAH5Eeg737NUAFke9neMUrIeqdeidwyttvbY X-Received: by 2002:a17:906:1317:b0:a6f:33d6:2d45 with SMTP id a640c23a62f3a-a75144857bamr503737666b.60.1719927154391; Tue, 02 Jul 2024 06:32:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719927154; cv=none; d=google.com; s=arc-20160816; b=V/G5RQhzoSRjvs9gYaHdoZhdbw8mUFeVInWVH0iL8LthzVythI/sUognReIVuehHfO nFYP12UiiVJFz6W2juBYiKPJyWIrpNYPLEyry57TaWJTBsAMHj5rS60kpIDzNCKG76NK IVRWbk+vaUKHoXrV0v5wQWc0g9D+/+0Uq5NCNWKvSzGZUAgW8wa90zVJ2TMXpWZO/pYz 2/Tm19q3qItYvAmUEuV+3gLlczRySIrTpOt9aBGDWvBB0kQpEpETiAF2c2e2arP9UEIf 5R2Mywv3jwvmG8nV+vF18Ap5R/g97QEOnM6A00r7Bj1KwbE17wRyiiNWBEdkLK4rg6iC QY3Q== 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=YV2NcFeEzAsvTLEphuDLuL3Tf5clYpOsZQGdEfQjYwA=; fh=/ictCKbt839JlZLMsWZXKKVOmFDZKTZvXUEHbMmRung=; b=0oN8Kaczt+PhrVWw3kHGVV5m2xjcxmeRZ/p31jtJstcoUV7f0xhrTWBNnsSJ8wgfbP el/saWqTghyka8Jzyjo2S3Mb+75h2X1CnsfLvFGosYnJJR5hLhtaiNxzgGuwWwCYUgWK 7Xgw9hThOMjcfEdb0XnC+A0eLGWLXRVZyTEgYm3ma+MCFwpF8HZ0GByCavqOOL+5a/WE 6AJ9mhfKh/8abCwl+VgLM69ipXTfr21RlNXaC7DxdclzFYPJnHV8aVVL5FsZ/AfUx5RQ SWKT+bGC+1HyxRQlwIA0DDCXKl8NbrB5uut1zuz69Hf62e3M96gpD8DmX8N0OQThJxQv 68yA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fUKEN9Vh; 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 Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-a72aaef6666si501661566b.151.2024.07.02.06.32.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:32:34 -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=fUKEN9Vh; 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 Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 26A4F8871B; Tue, 2 Jul 2024 15:31:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="fUKEN9Vh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 41CE188754; Tue, 2 Jul 2024 15:30:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1F71D8858B for ; Tue, 2 Jul 2024 15:30: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-ej1-x630.google.com with SMTP id a640c23a62f3a-a6265d3ba8fso436783966b.0 for ; Tue, 02 Jul 2024 06:30:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719927056; x=1720531856; 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=YV2NcFeEzAsvTLEphuDLuL3Tf5clYpOsZQGdEfQjYwA=; b=fUKEN9VhXLaYAnzzPqh3o4Yq2N72gCKtzI2brIEWHlv3FzorBHqe6iwJ24tqEHuhjY jrqQu9uSvQeDhbA7OYIH+QufsdkMQ0dHcPtrZPA7MVRWTVgVGJn8PlfZQ30FxxgIsWmJ hcKRH+GQeCzgeDxAzxlSV/9pgliYgs1zmuLYqcwsD9y/N3h2juZgmBHcO/naFBYASWn8 nu0rE/CylKC/H8IdGzfQfcu71y55V8imqBx5ZfxgDojBME+SRm9LXIcxaD1a+MjjVBYK 9pyrhs94kAbbmG2ItVq+OMLX0PlOg6g494zsEK0zKUpdY7OsDFvDG1tgP1xG6fiyw3zn 2/4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719927056; x=1720531856; 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=YV2NcFeEzAsvTLEphuDLuL3Tf5clYpOsZQGdEfQjYwA=; b=MPiAqwCdPg6Ek6fJ4NvskmPO5r4jII2wsfbvoPxMciI1xQSJ+LMRwUkMbtolWRNecO Q+5i7Xik1Xa605OcwjpbefNza5jOtVQ4iqDtF0gdEwpgfVHULRgk+A1FBIUsSWH7pvvJ F82gsl6e4R5CmTfIGs50bxTiZbHi5r/aYV+H3I+o6mOobAepn7Y/UeKK+w+BXE4h7MDu bxTC+KafHjH7Dko8arQuzoANeYtLXyorJMIRBlF6qPCtFP3foHTSgAQJ7VV6ANCxIK0V 128frkiiBteQU1BSFzc7Xo8Wo/gqLu7wPMNHyikDgV2LVnHYhHGGCc54/hvGu2AAlUKQ b/nQ== X-Forwarded-Encrypted: i=1; AJvYcCUitqpUDj4RvVmYCGkwkqnlvBiGYqm9K2l8a6Enkz2pjnrHaCRwlLQztKds2ccdR0DmvjR2RWJFRcShgp1Gl5T+M3l9mA== X-Gm-Message-State: AOJu0YwXiFxhQPqoOP85YAbtAGXpSsHu0fIA6Ps7yKf1kshWA4c5QBB2 ncopChQt/raqM82ZJvrc276w6fhfmuEobmLUfkWDvav+IrUp5NJJoHx333QYa1CziIAjApfM1AE A X-Received: by 2002:a17:906:4ace:b0:a72:8597:39b3 with SMTP id a640c23a62f3a-a751440ddaamr425093866b.18.1719927055491; Tue, 02 Jul 2024 06:30:55 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7430367d55sm323796166b.87.2024.07.02.06.30.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:30:54 -0700 (PDT) From: Caleb Connolly Date: Tue, 02 Jul 2024 15:30:49 +0200 Subject: [PATCH v4 09/10] tools: mkeficapsule: support generating dynamic GUIDs MIME-Version: 1.0 Message-Id: <20240702-b4-dynamic-uuid-v4-9-a00c82d1f504@linaro.org> References: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@linaro.org> In-Reply-To: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@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=9203; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=gWVLxgIabVWBwmAZZUHjaH19Cdy5AihUq2j6AQC2WYE=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmhAEDN6E+KUZm4a9CShIMVxg5dnNJA8uWKCeB4 h8HokQ3y9mJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZoQBAwAKCRAFgzErGV9k tjNAD/9Sfby3Cw+NUDI37PK+6iegKzp+c7Nl0CjQXy/VxkGcrHpU4+eLJXHwGu670whZfPLquv0 1FhTJyczmXdyGGzfCImh3LOyEGNGNwKNZxqFNmwWrUPw6lMkR4kNAAkq2upW4weLhd7m7z2wIBx F6IWSSwCgXkE0RYnY1Anm/9Q7sxXZwb3brT2OMgpoFxYl7g03xC7OWBG6Xq3MBjH4v6ADas/u3C xXANCqqklKkY3sxa3TZsehaVK0gzbhuuawGWiJcCs5zOghfaru7knj+kWkelBn4P3WZ/k/kMOPK nkYXTBKSAddJSwZ93rrjf8WqGo+HdoJxpBb6lfnjRyCgdzXcVUA6I/Cv52XJyEE9Kot3eCutORw jMsJzUQKMh0rtrwZiu0RQcFEY8MqXwABExBJhEdjsRGqX/h8+f0reqB783Wb8x/gdP9rY50XI5S N85Gw7aF7hti+i1eTus6KP0NJN6czH6P1J/6z2qLWMkVVLZItbfXFZhu9AAqBlV/XugabRvwwkc 2BYVOrJesPYeKQjNRMcMA3W4sppF0605uJIRV42lql0Az5xcb8luLwRNpHrZo/B1mhFfVgiQkUu 6Jfm+4F4SjBkXqROBaB1ZC4aUsDRttl/xduo6ksrb9GF5kvYxJVIMOx9l2cgl2d/uvCx2ACL2LL k/yLFai/9idxnjA== 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 tool that can generate GUIDs that match those generated internally by U-Boot for capsule update fw_images. Dynamic UUIDs in U-Boot work by taking a namespace UUID and hashing it with the board compatible and fw_image name. This tool accepts the same inputs and will produce the same GUID as U-Boot would at runtime. Signed-off-by: Caleb Connolly --- doc/mkeficapsule.1 | 23 ++++++++ tools/Makefile | 3 + tools/mkeficapsule.c | 157 +++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 178 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/Makefile b/tools/Makefile index ee08a9675df8..7d1b29943471 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -253,8 +253,11 @@ mkeficapsule-objs := generated/lib/uuid.o \ $(LIBFDT_OBJS) \ mkeficapsule.o hostprogs-$(CONFIG_TOOLS_MKEFICAPSULE) += mkeficapsule +genguid-objs := generated/lib/uuid.o generated/lib/sha1.o genguid.o +hostprogs-$(CONFIG_TOOLS_GENGUID) += genguid + mkfwumdata-objs := mkfwumdata.o generated/lib/crc32.o HOSTLDLIBS_mkfwumdata += -luuid hostprogs-$(CONFIG_TOOLS_MKFWUMDATA) += mkfwumdata diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c index 54fb4dee3ee5..593380e4236a 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; @@ -38,8 +42,9 @@ enum { } capsule_type; static struct option options[] = { {"guid", required_argument, NULL, 'g'}, + {"dtb", required_argument, NULL, 'd'}, {"index", required_argument, NULL, 'i'}, {"instance", required_argument, NULL, 'I'}, {"fw-version", required_argument, NULL, 'v'}, {"private-key", required_argument, NULL, 'p'}, @@ -53,11 +58,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 +87,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 +834,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 +980,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 +1075,9 @@ int main(int argc, char **argv) case 'D': capsule_dump = true; break; default: - print_usage(); + print_usage_mkeficapsule(); exit(EXIT_SUCCESS); } } @@ -951,9 +1098,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 Tue Jul 2 13:30: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: 809122 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp212820wru; Tue, 2 Jul 2024 06:32:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVu7lwKtZNV/4t8n/WmWFs88a+fGo8eNd8DRSRWodmkC2ssUE0z0pc7vZEjwp4SSHYSJrAoUHzvRn1qHmSCVE/E X-Google-Smtp-Source: AGHT+IFKW96TcwK71rndCLz58C4OdIvBsscEo/QONt5YgOUnBQgqx87BAzXVsaILYhANPAQnCb3L X-Received: by 2002:a17:907:6088:b0:a72:9d25:8ad7 with SMTP id a640c23a62f3a-a7514468621mr749065566b.1.1719927165383; Tue, 02 Jul 2024 06:32:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719927165; cv=none; d=google.com; s=arc-20160816; b=LKdJgzqeKZ7vJkki2V48+SoAqxIlQcDWumGcsRP/uSdsq/EaNfxNMWG4Pcs2M+E9mx xaFtb+fiNp2v8qdJ8gpVUB7G0XnBOPHGhWRnIc/FMdzxUPfb4DYyvUo54dTe+akpyXy6 IkId1p3q2wDiRzFS3HVr7kRxpt6DwL0S01jFEkbEleVkvCP4nYXONfKhjYqGF7Ea4+vX B/IT8YH4XqOhpC8V3rGXXkbjb9W8OrEuv8xKiPxk8g9IcVPWWa9JPvffG8VNelLd7z2Q i/I3kqbOsnI7NWUuWGe6a9AGnjqp9lKSauGPQ2+gUvLo7KKmqK3miI7Ddu94H5BMIhtc yuYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=zgTGsECpuui4joumBLRrHZBmSfd26OhIye1/OmJYNpI=; fh=OnAEr2BxDyZrsVSbLV8tXWogfa9nSZL/z4SGxC5ojdo=; b=P+EYGHi7/pyySHs7lnYHxbY19eCTICKP2fI56b5NzbLxh9e1RIsdBZ4HGQDC5HghOJ YDQRpoPpWWA4UlmXIMRpnSG7VVrKcD5FJvniOGwFZpFRKK0atfsKRHat69s+BirFil/S 9/OB7zbGyUAfzJk868VMpmUBWyvSh9N1tPirBWU5zP1aEFcesNK6ase+4xWK5+WiGVVS 7bVTnd2Ogg26SetiBkLZl9Qokg2xdN5musIXLdR3Khtemf2QPvzV2EB2L2TjZfDqV6Wq cbw4AM9IlCuDP+E9UrVz7p9xxY/7WEobcXRlZJjOx9QxuHvtXbZu7tb/6p7boJWabinR gniw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dpTGmj2I; 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 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-a72b7144372si388064766b.67.2024.07.02.06.32.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:32: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=dpTGmj2I; 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 Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 90FF3886FD; Tue, 2 Jul 2024 15:31: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="dpTGmj2I"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 31BE088748; Tue, 2 Jul 2024 15:31:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) (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 16FD488732 for ; Tue, 2 Jul 2024 15:30: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-ej1-x62b.google.com with SMTP id a640c23a62f3a-a754746f3easo63521866b.0 for ; Tue, 02 Jul 2024 06:30:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719927057; x=1720531857; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=zgTGsECpuui4joumBLRrHZBmSfd26OhIye1/OmJYNpI=; b=dpTGmj2I0ZZpK9Ng5b+zwKRFv9n3mFTeGb8IZHVvvcWGcu+Z4+i4gtM6Ef/+du0zFP BZ03u6nMq94wenGHBBsCB2MNkqA+y7xKnKYqEOu/l8amUCNkoRQ3swf4Jbyalf70V6LU 68+CBbxwAlDBv40ymFsrDNtVVTSlFV0JI1dtFjVR1vaCEzKQ1JySX0E0FUNmtIfu/5g/ rmmwcArCyxGDE8UctmJ3YC6WeIYWnPD9jdMKVA1HMfwdUMG8aqCBX3ekQsQacz7+PeRY U4daQZFYYx1Co704iLiQxFGjovWbq1ww0CnlAkaF+CTKybTjZA5vYIQTRB9JTt+B0Euv wyuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719927057; x=1720531857; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zgTGsECpuui4joumBLRrHZBmSfd26OhIye1/OmJYNpI=; b=WNmipc7rqCEWVqUWXOdeE5ycF1MlqbYAIJRLIY22bZXVgztnwO4wsu8MrtBDTUg3F0 BAp2v0qY0Hu+OnidqkGo82G12yjk29OXaCX+yfmiU9XbDDqV0f2DRmTvnPb8KdQ+cDAj mpKT4hLZNAL3Qfx87EiYY9UIkh5kwmfIw3NJFNE7F0PBE3SCEYtfQ8s7k1IiR1bzqLlY IC8rEIjU0JGS8Qhiz6nAIT9K/F2ey8oahxpimdKDRP+S+7Z/rowxSWH01q2aYKOu/3kG nA/cIyg83pIbea1mQwmKoAUcf0vahhJgABlwvYQpEG2C1GBv3EJ1tpWYT5A0ZxQZcXd5 WT/Q== X-Forwarded-Encrypted: i=1; AJvYcCUP5gefEVWcdqtIGHw/w+tR4SCVYscVWMBDoBD2QKMgulsTbHE/3i8MnehLcLdx4kINnQEgfgTkCyV8i5UsFbMOEhlPdA== X-Gm-Message-State: AOJu0YzX9G5cJ2/T7F/Kj7z8Hm6v2iBohp7QbL42o2HVEt6dE3wKVX+E tog7K8qaAJPmNMx8HC6u2G0gYdQS4aQHP6K8A79ekK9Y2Ty7CeVLDocLTyWL9DM= X-Received: by 2002:a17:906:a292:b0:a70:c02f:8a7e with SMTP id a640c23a62f3a-a751451385dmr660757766b.54.1719927057572; Tue, 02 Jul 2024 06:30:57 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7430367d55sm323796166b.87.2024.07.02.06.30.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:30:57 -0700 (PDT) From: Caleb Connolly Date: Tue, 02 Jul 2024 15:30:50 +0200 Subject: [PATCH v4 10/10] test: lib/uuid: add unit tests for dynamic UUIDs MIME-Version: 1.0 Message-Id: <20240702-b4-dynamic-uuid-v4-10-a00c82d1f504@linaro.org> References: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@linaro.org> In-Reply-To: <20240702-b4-dynamic-uuid-v4-0-a00c82d1f504@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Mario Six , Alper Nebi Yasak , Abdellatif El Khlifi Cc: Richard Hughes , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=3008; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=ZETTwLjb7NljHuT9g0TrbGD3/tc1AKgjAkUPham0EcU=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmhAEDtTMOQihyajtp2Xee3UYIPlphcmDAbZJoC 0OPy/5UZy6JAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZoQBAwAKCRAFgzErGV9k tu8rD/9defrNDiL0y/GlXRy+oW35vJEsLFvpnMO1UHMJ/o3MspF0+KU5mAAVPPM5VCgO6eBbm06 FDC7UPV//BJpEvMOVfRy/SRz9jlMDnZGugH94/nX8RELl0lTb2DpnRpEFl9Rr//2hPkJg5uc4fh GUUI4LGjKBRPlNMEj3jOjjePelQxDR9I/kbHfShCqUNhfKMZz2tfWwWYAFzn9+59t7f2cHXLpk3 WrWEFXPIRT1L6wXrW28fXq8c49Iu1rXjblf7bLkTDtSeID1F4TKvgYTK6PbRKITNOnXUGL9CeXm U9kQ0fohz8I8/RVwO6jV/FVqcFNJwzfYoNT9l4mEVX/vLEK4J1ZBckvtpbLLScBUD4ygsZ7697E vs1l+n/auFHrwZwo8Nj0vyaEw1SQ1MtKYF3mhwReA1o0krLAj5vMlwxmLGTkSpiQYF8thkm6RDZ RBzrih5x4061sPyGSFezYvlGEDmZXunN+BKB4gQWLiuuRxtW2gFkTbUUYdxPSgJqv90shEjADvK boW2sJJHhOlRtfpBoKLKfXt78hTaD8VG2HatLEbteZO2OsTPGD/u5GEoFLOc0KD0o15Ijorlf4m iQ5KfY24yVKxCcaGiOUV61nq5wt0BciK+r4+PbIxH1MRezl9t9jqFI4c7qAYfM2WUyRzidZfYAe ArCm90XLrAYW6TQ== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Add some basic unit tests to validate that the UUID generation behaves as expected. This matches the implementation in efi_loader for sandbox and a Qualcomm board and should catch any regressions. Signed-off-by: Caleb Connolly --- 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); +