From patchwork Fri Sep 16 11:46:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Whitcroft X-Patchwork-Id: 1678649 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=JsCb6v7R; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MTXqG0zk8z1yp0 for ; Fri, 16 Sep 2022 22:06:34 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1oZA72-0006oH-Pj; Fri, 16 Sep 2022 12:06:28 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1oZA70-0006o3-9D for kernel-team@lists.ubuntu.com; Fri, 16 Sep 2022 12:06:26 +0000 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 8DC493F337 for ; Fri, 16 Sep 2022 12:06:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1663329985; bh=m/cwHIE3v5VoequN1ct6AekTIgmhBxHB6dyxANpal4w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JsCb6v7R4U7JUfiiC+hTfPIbBKz0Y3OMFmSHnyLk/20pxS3skDCDfBtZwrgRusaZK FNDOUVUEYqThKzE4SFaIkcJC8zMno9KRnvH4RkuarvK1tsz/cxFOlDvSzSWzChBq8x 5CyGdm1gAbgvzLZ4kjeUxgimDFIma1E1b351j6cn5hxvJ2N+MsbrL8AZ7KiNfE6fda z8xx1XMafwiq5rsM0ZhZOG68no78tLkOmNsHjTXubxom+YrI118KQHNeZ/gLVU4kvu gBK9kVpgHKIug2kbKO1MeyeztZXsueWs8Sskp2LD4U3ozTaMm7I/PPXZgSLh+ZAp1B ZH6+vEqeJ0/+A== Received: by mail-ed1-f69.google.com with SMTP id b16-20020a056402279000b0044f1102e6e2so15272293ede.20 for ; Fri, 16 Sep 2022 05:06:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=m/cwHIE3v5VoequN1ct6AekTIgmhBxHB6dyxANpal4w=; b=EM5veWiErk/rTFG0s8+7plzL0dkBLFxLgVad0DNx6s71OgOHXdLQmUJNDRDWCeeRcv k7+waNKhdmt+4+yOk2leciZOMy5xgg3KiTdRoam0/kHMkHbE15NXLUAxJjpNn7D0KeTI 3DocN4WKDj7HrKJqYGXPy8y6ciqmD+4yyFnxm2/IP+iBTd4zs4t+mEgAij0mR9BnrdOn zdxJ5iftgvRyRkNThPP562tdev8IVeEWqFl/C6U4Km/TTO8b1aa3q1PO6n2ovsuj87Sm QASigM0hw4j4RLOoDqoHJ+g32FSh2WfsB4wqUyoDZn6wJjS5yupeBX/vJtLQZ0kx/wB0 P+5w== X-Gm-Message-State: ACrzQf2S/u8Gvcbpj8kXZ0SjzY/A5DiGRw8YkJAxSQPtozhe3X+M9K13 mmszSGwP4PdMZv5hqWxCCBAd8XAYbVxXeLnq5dM5mVFGTgKdznxDDjgU3tAnsZlmAfHng7B0y7l NhVoEZgJJ+T1XVXgIbA2d4/Rq4sDAvG+pU3bm0XAs/w== X-Received: by 2002:a05:6402:40d3:b0:451:5249:d516 with SMTP id z19-20020a05640240d300b004515249d516mr3704820edb.154.1663329984635; Fri, 16 Sep 2022 05:06:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6TuSDWOhPY465y25jKqPd+EnXPnRtOkiJ/5DBPAizIG5d6bWPCEFVc/MDPCuKrvs3rTM11TA== X-Received: by 2002:a05:6402:40d3:b0:451:5249:d516 with SMTP id z19-20020a05640240d300b004515249d516mr3704806edb.154.1663329984364; Fri, 16 Sep 2022 05:06:24 -0700 (PDT) Received: from localhost (host5-81-229-118.range5-81.btcentralplus.com. [5.81.229.118]) by smtp.gmail.com with ESMTPSA id r20-20020aa7d594000000b0044e9a3690e0sm13449343edq.9.2022.09.16.05.06.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Sep 2022 05:06:23 -0700 (PDT) From: Andy Whitcroft To: kernel-team@lists.ubuntu.com Subject: [PATCH 08/13] UBUNTU: [Packaging] generate: add HMAC support Date: Fri, 16 Sep 2022 12:46:37 +0100 Message-Id: <20220916114642.2953019-9-apw@canonical.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220916114642.2953019-1-apw@canonical.com> References: <20220916114642.2953019-1-apw@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andy Whitcroft Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" Signed-off-by: Andy Whitcroft --- debian/rules | 12 ++++++++++++ debian/scripts/config.py | 2 ++ debian/scripts/generate-control | 14 ++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/debian/rules b/debian/rules index 711b749..1c8333a 100755 --- a/debian/rules +++ b/debian/rules @@ -80,6 +80,18 @@ override_dh_auto_install: -e "s@-$(abi)-.*@@"); \ verflav="$(abi)-$$flavour"; \ \ + hmac_pkg="linux-image-hmac-$$verflav"; \ + if grep -q "^Package: *$$hmac_pkg\\$$" debian/control; then \ + unsigned_hmac_pkg="linux-image-unsigned-hmac-$$verflav";\ + hmac="$$(dirname "$$signed")/.$$(basename "$$signed").hmac"; \ + sha512hmac "$$signed" | \ + awk -vpkg="/boot/$$(basename "$$signed")" \ + '{ printf("%s %s\n", $$1, pkg) }' \ + > "$$hmac"; \ + echo "$$hmac_pkg: adding $$hmac"; \ + echo "$$hmac boot" >>"debian/$$hmac_pkg.install"; \ + fi; \ + \ package="kernel-signed-image-$$verflav-di"; \ if grep -q "^Package: *$$package\\$$" debian/control; then \ echo "$$package: adding $$signed"; \ diff --git a/debian/scripts/config.py b/debian/scripts/config.py index 34bd08d..f937150 100644 --- a/debian/scripts/config.py +++ b/debian/scripts/config.py @@ -12,6 +12,8 @@ class Signing: self._package_to_flavour_to_arch.setdefault("image", {}).setdefault(flavour, set()).add(arch) if "di" in options: self._package_to_flavour_to_arch.setdefault("di", {}).setdefault(flavour, set()).add(arch) + if "hmac" in options: + self._package_to_flavour_to_arch.setdefault("hmac", {}).setdefault(flavour, set()).add(arch) @property def flavour_archs(self): diff --git a/debian/scripts/generate-control b/debian/scripts/generate-control index b9b2f48..b0c3c15 100755 --- a/debian/scripts/generate-control +++ b/debian/scripts/generate-control @@ -50,6 +50,20 @@ with open("debian/control.stub") as tfd, open("debian/control", "w") as cfd: Canonical's UEFI signing key. It is intended for the Debian installer, it does _not_ provide a usable kernel for your full Debian system. """).rstrip(), file=cfd) + for flavour, archs in signing.package_flavour_archs("hmac"): + print(dedent(f"""\ + + Package: linux-image-hmac-{abi_version}-{flavour} + Build-Profiles: + Architecture: {" ".join(archs)} + Section: kernel + Priority: optional + Depends: ${{misc:Depends}}, ${{shlibs:Depends}}, linux-image-{abi_version}-{flavour} + Suggests: fips-initramfs-generic + Description: HMAC file for linux kernel image {abi_version}-{flavour} + This package contains the HMAC file for Linux kernel image for version + {abi_version}-{flavour} + """).rstrip(), file=cfd) # XXX: all dbgsym packages _must_ be at the end of debian/control else the # build will hang forever on the builder. for flavour, archs in signing.package_flavour_archs("image"):