From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 BE7E6606A31A for ; Fri, 30 Oct 2026 06:14:41 +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=iBK4a9Ic; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=fMLT9nhD Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 9BADA40A58; Fri, 30 Oct 2026 06:14:41 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id xinEatYNZ22u; Fri, 30 Oct 2026 06:14:41 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp4.osuosl.org ADEC140A5B Authentication-Results: smtp4.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 ARC-Seal: i=2; d=osuosl.org; s=arc; a=rsa-sha256; cv=pass; t=1793340880; b=Ns2UuZkEd5vZmMsWUo/tA691xAb8bDrSy3rWUNqQlP/G7vZMOZ2A8uu5DRiJFfOcbCKp d3fheX5VcOp0837UdymUHqj5IGAy+wvhy0gPRZC6VVKALiR2BR5DTHmxgYPBfXqmUWmLW UJDp0O0p6wveYqZGUvw9gHao3VCjbp6kr+0VLdQ9ApsyJR7rE6EzZ8JD0qYWPQ6RZOOpt AIl2GwbNUqFHXyraZGkJFaOJrTZdfd8BR0mCS3lV3u+eUPGNPiBoFdtGll+jwqisnvT75 kG8l5nH6Mu5b8ICTy9NZvlC8zzGzDLipTFy9yl9W/TwAJbBi3n3zi7M7zxlgrOXwkjA== ARC-Message-Signature: i=2; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1793340880; 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=Z96/Jky2uPEuXbFkykrayfC8W46EZ9Zg46aXq2HyzlbJtR/UMZL+R/GMRWRnqTEHtlrS H6qmMXcCM+TUcb4biWyaK5hti0zkvABnn3I5uFW/pa2yOX929UvCnhdCXS0u6jjKR3p8q VFmRT/emwyMJQiioLOo/9VA6XfuCEpGD/F/WPElpCP+ZyGPbSTXCDr692JHR6Obabtik4 ETJe4P+LRKsJmu6V4JALVwfcT9GgorTATtz2/8YMmLEK975f6PY+lBYmwjClbtKujb1K4 leq2D/JQqY+oXJgn12Xxm5oZqfwS5o3RtT59pYjc7+xW0o+qrGeQuPjAaGSjUAJR/uw== ARC-Authentication-Results: i=2; smtp4.osuosl.org; arc=pass header.oldest-pass=0 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=1793340880; 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=iBK4a9IcxuxS7FINLEEeMeCveBz1V4R2SzwmkeKrW4p60jLDxqa/NUVKIs0n2Dl0S JKL976IKE9Yy3FiMXqvr3UeE8Pvr1uHGNp+oUQbd21/V2k03+FPcU+ZCfL5zajN+z6 5at5tOpA5t2EiNTESLNOofIozqOWLNqSoxSI68CrXoLoP3HArOZn5VKBr5tA3W9Av1 UBBra4W7Iw5FNZKxAT4IZIWxam3jc641sGgHBDlxY/mqFSjssRfEU9wVmrq0Ih5OJr zb1z0N692Ms+JCaibCS1nRqY9B6HhFKNh/CoDaXIErlK5uKw7i1HD7/Ycp1+0hVDdf K9nZJ5soPHbRA== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp4.osuosl.org (Postfix) with ESMTP id ADEC140A5B; Fri, 30 Oct 2026 06:14:40 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists1.osuosl.org (Postfix) with ESMTP id 85D30362 for ; Fri, 30 Oct 2026 06:14:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 6A58160AA1 for ; Fri, 30 Oct 2026 06:14:39 +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 i0f4nl9LstK5 for ; Fri, 30 Oct 2026 06:14:38 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org AFB9260AD6 Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip="2a00:1450:4864:20::332" ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1793340877; b=qFqJRrbvVJNu9ylwng1c9xQ6u6YMOWOBi/WcP6UqYHAPhBZNQ8+WgEHrVrn+bUTJCyyy Pitx/nDxWnkKQw+SQm6Ad0zNRQ8+lizQKoqGQypXGMLdH4DIzo7S6d7DMnPjZZrXO4n1a aeQ/AD7wWvIrNNWEXzbjgNwFoYuCxKEfDM03wHPLKTl4PLpugWFvrf9QzrBdRToLc8rwY mDE6Xs45BdGeTCapAJl5Nhv1hrPHiHslYE2jTfiquvSCjD/8WXZOyZ/1pqc6sfqzBsIMY GsRm1J0TsOPUM5cdqtQiA2/+WkHNly91gf6dqoHXI7wAZxwTqHuafzYLaXnh3GGaS4g== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1793340877; h=Received-SPF: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; bh=CfBkS+tIwarh5YmKFwnOzcmi9pU3CJVcbzuDxUEzLyw=; b=XMk9lMPkVqCi+P2p1xrUfaq3PJoxstsW9SehkyaU8h87ORwtzn5/kDmLSdNfMzziDvYH mpV5aVSziA+F+ZlhAbDhecEwX973cDYeWZ+FaZb4K2BoCL3TR2GtIG+rh8gpXgxdIRByS iIbq2/ZsbSU7xF2VBx4cUXQ8AB320IEH5+356GyCzqkuciDZ6oGmAsej/YYg2LZB7kdRw MaQXf6Gd2itOUJTsyYGXq4SPukULU/XzhOCPkLY1rTRYgs7CAl9jC4LEHembWt98A7oZL Bf4epeOow/1prcUrsK1j3lSlFkdJGNOyU+WbfpeA+FsyoDFIug95JHJfp6kqptBdGHA== 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=fMLT9nhD; arc=none smtp.remote-ip="2a00:1450:4864:20::332" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::332; helo=mail-wm1-x332.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=fMLT9nhD Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by smtp3.osuosl.org (Postfix) with ESMTPS id AFB9260AD6 for ; Fri, 30 Oct 2026 06:14:36 +0000 (UTC) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4a210470b49so1763375e9.2 for ; Thu, 29 Oct 2026 23:14:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793340874; x=1793945674; 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=fMLT9nhD179P9HTsjqZcHei2mAhvE42qlDFySa/cjwv4+pyA2zSfpnUyAUM9OXp5r0 0iB+A2bAIcZyw0/WRIkeZZlXJZAR7krk8CVTdVdJpdoLHABeTdhytbpB/N9h92WRhCFX Pgrj+m1UYYz0dub4YqiAw9ojwH7tmbb4djPadE52WgNAMHIfDeQSdnEc292tlWvMmn+M D0rjY4uZYQN38U8lvy8jzXIn7vlcWlM23E5KXbd0HTqRY73ocb0slnI3lFNw/vKpkptU tzfEdxXz+Ma26Mkwh2q7cmbTu5xq3/gCF9UZLqD/iZFztX/UZk9U3N5QygBpvVTIPxUs tetQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793340874; x=1793945674; 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=YedWJZxf9YSlusi4o7lsmEMEfLcY594K4KHMs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Smrwk8= X-Received: by 2002:a05:600c:8b63:b0:4a1:f688:a5d5 with SMTP id 5b1f17b1804b1-4ac187a7655mr22406145e9.23.1793340874420; Thu, 29 Oct 2026 23:14:34 -0700 (PDT) Received: from [127.0.0.1] ([85.204.204.133]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4abf396dfdbsm38707535e9.1.2026.10.29.23.14.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Oct 2026 23:14:34 -0700 (PDT) From: Ana Bobillo To: u-boot@lists.u-boot-project.org Cc: Heinrich Schuchardt , Ilias Apalodimas , Tom Rini Subject: [PATCH 10/10] test: py: test invalid certificate lengths in signed images Date: Fri, 30 Oct 2026 06:14:33 +0000 Message-ID: In-Reply-To: <633dddd6-ee22-4cd6-a8b6-cb7df0650fae@gmail.com> References: <633dddd6-ee22-4cd6-a8b6-cb7df0650fae@gmail.com> 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_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('