Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92C3C606D811 for ; Fri, 6 Nov 2026 21:57:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=uue/7Hll; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=PViuOkrM Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 7048C60DA7; Fri, 6 Nov 2026 21:57:35 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id lejBFBwRkc5t; Fri, 6 Nov 2026 21:57:34 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org 8C6A960D61 Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1794002254; b=hViA4CmmBOoGFDwT5uob/70U8ELWlxB8e5olO2eyiWyIaZLUCj4GEc2i88hp3pVDvpEJ W8636sC/i/8EIl/JHBz8saDTHiBojUDts4zwgyh5ipGnBCgdZyj3nUA337r+tlXda2UDu kTwlSdZhhphwMLdzo/+MCVPHffAm+Mv42wTnL5qafsTU9zVmv/z06ezCzG55j9q7DD8Ct E+Edu7/JcXgTN2CA4k3bwAKIwXUY8YiXD3GAejlHuNp6iSYjXTXR+bfIIsCp++rpMSBLJ JHMBnz00ZJoCGCWHkD1VsKXV/Y0SY7n9we/85Ijut76pHk/cBYefTPvInbPU6QpAsdg== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1794002254; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg: X-Received:Received:From:To:Cc:Subject:Date:Message-ID:In-Reply-To: References:X-BeenThere:X-Mailman-Version:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Errors-To; bh=CfBkS+tIwarh5YmKFwnOzcmi9pU3CJVcbzuDxUEzLyw=; b=dEryWzQgzajGfPupYh6yihpa6fJwSJKLfPU1wUSQdA0XJb26kdZYT2T7sBGj4a8r0cOJ cjw19Rhx3HX5b5KA7LN/fKzBIHDEbtMIT1GXg24qq1xO1QBcFw+2RG7ejOsGRo3Gddm2F ENjLVL89jtbu3c8J8zC9mkMgPp+BJweIvjDJv8lxDAjXxoS4kmLSD3AgoH5xau61VXjC0 HGzgTEA1c0QI93uKFDbAhKjCVsXvO96KbtGFoAWEpTqGP54KQ1rb6adUJhfgFycUstq/w EIgPk5asPJ5V1GsDU6Bq9eZmXWAw/3qHeBjlk0EC9NBSNXeWOprVCnols7gp4M+Sxsw== ARC-Authentication-Results: i=1; smtp3.osuosl.org; dmarc=pass header.from=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=PViuOkrM; arc=none smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1794002254; bh=CfBkS+tIwarh5YmKFwnOzcmi9pU3CJVcbzuDxUEzLyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=uue/7HllMWNBg/35zyNOE9lautMT5EAQN3/Y4UaTYWy2K0nYi462Ej4ES1KyQXJkQ k5r3sfB+qgBrIivk0uf7r8wa3cqlIVG/rRrbOtEHsyfkTPRdZF8r/uHkaYbCEm/5/O hEoyIm9vhLlFSLCRoWeJjOa8uTVUwmlPXLo3hVGjSHDwJTZCMTKOr45Ryb5l1XP50q LGHYIVsXzTxKPVuygx+q1XehbVoHss6ohPQm0GylVYln52UIyAJESEZAnbXtZBJlUP 3Apkeaf3MD1/dD1wSxWFmPdWZ3te6C6bucBSvh4QZmOkii4NZQOdZ1m67Zs0LdCkkr D4Db8GZ9TqAGg== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 8C6A960D61; Fri, 6 Nov 2026 21:57:34 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists1.osuosl.org (Postfix) with ESMTP id 1EFB11C6 for ; Fri, 6 Nov 2026 21:57:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 00A9D60DDD for ; Fri, 6 Nov 2026 21:57:33 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 86xaQ_V-_9ex for ; Fri, 6 Nov 2026 21:57:32 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org 4C21660D94 Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip="2a00:1450:4864:20::434" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::434; helo=mail-wr1-x434.google.com; envelope-from=anabobillo3@gmail.com; receiver= Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=PViuOkrM Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by smtp3.osuosl.org (Postfix) with ESMTPS id 4C21660D94 for ; Fri, 6 Nov 2026 21:57:29 +0000 (UTC) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-48e1d0e5dafso46387f8f.1 for ; Fri, 06 Nov 2026 13:57:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794002248; x=1794607048; darn=lists.u-boot-project.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to:content-type; bh=CfBkS+tIwarh5YmKFwnOzcmi9pU3CJVcbzuDxUEzLyw=; b=PViuOkrMaJd/Zg+/rvm6dOdu9+Ff9g8Hkc/odkorN1NqK6/ggrhqBXl9ztQ2In3RMp BnytuwCdnRK4FOEO8BGYiyCHlq0e1X5Hiawh4rtZWYOVyj7WbXDKSzZXnv5faDWMd+EJ dcY0SUHnxsQV6K7L1UdNizuzq/bWoktedwAxlP+hFSeiY0sERjply443fdZGnuIE8mck QAjdXGRhKr/48itsGkt4V87yMw7Q3D86s0RuzrEWvomNZ5s4jWLcKcMWISGpQmKuCpUj Qjd6RyKqmgPYchTpoPdy6je3wtvh7VHZbJ9TG9tn4fULa0TbIZysOYpIXEXoh2Wyt4aq aJRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794002248; x=1794607048; h=references:in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=CfBkS+tIwarh5YmKFwnOzcmi9pU3CJVcbzuDxUEzLyw=; b=eH9PdRD/q+t2rWjwwmItft1eUS/aEca17bdsbltcGv9x+T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Received: by 2002:a05:6000:250c:b0:48e:6669:fefb with SMTP id ffacd0b85a97d-49421fb5055mr508712f8f.22.1794002248013; Fri, 06 Nov 2026 13:57:28 -0800 (PST) Received: from [127.0.0.1] ([85.204.204.133]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-492d7233297sm5992646f8f.27.2026.11.06.13.57.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Nov 2026 13:57:27 -0800 (PST) From: Ana Bobillo To: u-boot@lists.u-boot-project.org Cc: Heinrich Schuchardt , Ilias Apalodimas Subject: [PATCH v3 11/11] test: py: test invalid certificate lengths in signed images Date: Fri, 06 Nov 2026 21:57:26 +0000 Message-ID: In-Reply-To: References: X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: From: Ana Bobillo Add a Secure Boot test with two signed images whose first certificate has an invalid length: zero, which made efi_image_authenticate() loop forever, and one larger than the certificate table. Both images must be rejected. Signed-off-by: Ana Bobillo --- test/py/tests/test_efi_secboot/conftest.py | 31 ++++++++++++++++ test/py/tests/test_efi_secboot/test_signed.py | 36 +++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/test/py/tests/test_efi_secboot/conftest.py b/test/py/tests/test_efi_secboot/conftest.py index 0755497d46d..9858dd36f17 100644 --- a/test/py/tests/test_efi_secboot/conftest.py +++ b/test/py/tests/test_efi_secboot/conftest.py @@ -4,11 +4,36 @@ """Fixture for UEFI secure boot test.""" +import struct from subprocess import call, check_call, CalledProcessError from tests import fs_helper import pytest from defs import * + +def set_cert_length(src, dst, length): + """Copy a signed image, setting the length of its first certificate. + + Args: + src: Path of the signed image. + dst: Path of the image to write. + length: dwLength to set, or None for one past the certificate table. + """ + with open(src, 'rb') as inf: + data = bytearray(inf.read()) + pe_off = struct.unpack_from('