From patchwork Wed Apr 3 07:21:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gstir X-Patchwork-Id: 13615075 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 609064D133 for ; Wed, 3 Apr 2024 07:21:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712128907; cv=none; b=XOOPCVdz+XYvb+YR+NF1T4hTWskTDUddAerY7b/h9N+fcnj35EDPQ3gQA3l6Bu5nOITX7YFKTAj2Z23s4Ze31yGFHsRFVkGTBdqf9HkUAqUf3Jltnxq+4McnTCrKHKhxaE78UcOBS5T0nNijMRXKsp6gE0rUHsjR06vQasHtsEY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712128907; c=relaxed/simple; bh=bRYywF4wQq0rFQo//c05z8eFKnTGTyCsCUjV2hS/RGY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QvG4PXOCWwZGsNgxWxwZgCAHmHJXa5PDWFUnlIaKEIWboS9zM/vE9VTFSUC9of3Lec3LanzVJzlEc1vnRfVfYw83HW8h9Xu5PSLpqMxgRW/wRZzF7tBvMOdut0YCi5XKorYu4H1sOynEEn6FdJo7sD1dFnhiopl7ixZZOLWXRoY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sigma-star.at; spf=pass smtp.mailfrom=sigma-star.at; dkim=pass (2048-bit key) header.d=sigma-star.at header.i=@sigma-star.at header.b=gnzXb7bf; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sigma-star.at Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sigma-star.at Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sigma-star.at header.i=@sigma-star.at header.b="gnzXb7bf" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-41624fe40a3so260725e9.1 for ; Wed, 03 Apr 2024 00:21:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sigma-star.at; s=google; t=1712128903; x=1712733703; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZLnAdyE+lMa8L2TlOW7Lr0VmL77gsDlT8pRhecvobmg=; b=gnzXb7bfcozfwKxTR3/Zpfz8W1YSsUkkrRElgo4StRZfe20jT+VBwQVKuJpNcFc5Co 6RbC3CC98I8a0x//t9TpHunevVufZO1PmojCt8ryNBjNsFC9LXdEbJ2gwVVoZgR78/7x 4W9Z+FmAcG+D3jmK3TDwCqjKXDQDI6ueZBXEfZca05vWcJqEUp43KUX0FM9DLLjSraGf fHyGB9XKGK20bmikS3CvqXfBo2PcujtZNUH5Z6IHqgPKTEow1I6Da2rB7mJBYOFdLzr2 IcWTdAuKlhmVRGiQIMQxdQb3qFY55ri59A9jpLGD5jlnkK/oxelr6wco/n9qXdUJ8IT9 7adw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712128904; x=1712733704; 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:message-id:reply-to; bh=ZLnAdyE+lMa8L2TlOW7Lr0VmL77gsDlT8pRhecvobmg=; b=wYbpECsUD9olNiGBrovwXm4aD68HQcrslxWHyvJrcrSpzVOQDdKMk1Jt2+7/bOCK5q /MNfVw+JHNpbyfRlCjciA06Qs/t9/K2HEjaG/muTcsurza64p16te1GGJIn195+5kcZx lkDC+AoF0Fh+jIhEV9BCVQGZ6kEd3ljc3YiDAEbbL+wgFSkWTiRbhnf08/WnE5WVBiLc BmrRt1DnTTeVgdDUmu75O6pWjq8ZyE8ccqXKLXcI+r8GX8jpWLOwFGGiqq9mfliH/Qad EmgLxzH2XEPQesYtsNZM1Zmr8JCl0BUcUxeZ+8j73KcIpGJKTlzIQGlaULjS6o85nIbV Fauw== X-Forwarded-Encrypted: i=1; AJvYcCWNx3FUXW3jiPuV2cV30K2UbkxfiJxGc7XQq/AAB98dzVH8404DFu+MXRa+UgPI63ULj3ay3MO7gIDiEnEek0dgJ6tSSNDEx3k= X-Gm-Message-State: AOJu0Yw/1MN33Nym2aynvcIL3qXc5JM2hoQQus0+Kck5FZlTy8J3HqpZ h8w896aGG5ZPKzIxazTRohXMUYIFd4wJD/0pwPjXXuidv+QTXp9bHyyKApHhVrg= X-Google-Smtp-Source: AGHT+IGBKQFCUXIuGuB/3ITVSTmpwBRNnzhoeJUE1hf5xtsCdWq2cIwS9vpwQ4hO/jWGP/x1CquarA== X-Received: by 2002:a05:600c:3c99:b0:414:8e3:d8e0 with SMTP id bg25-20020a05600c3c9900b0041408e3d8e0mr11942948wmb.17.1712128903715; Wed, 03 Apr 2024 00:21:43 -0700 (PDT) Received: from localhost ([82.150.214.1]) by smtp.gmail.com with UTF8SMTPSA id v13-20020a5d4b0d000000b0034356c434d0sm1436269wrq.117.2024.04.03.00.21.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 Apr 2024 00:21:43 -0700 (PDT) From: David Gstir To: Mimi Zohar , James Bottomley , Jarkko Sakkinen , Herbert Xu , "David S. Miller" Cc: David Gstir , Shawn Guo , Jonathan Corbet , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Ahmad Fatoum , sigma star Kernel Team , David Howells , Li Yang , Paul Moore , James Morris , "Serge E. Hallyn" , "Paul E. McKenney" , Randy Dunlap , Catalin Marinas , "Rafael J. Wysocki" , Tejun Heo , "Steven Rostedt (Google)" , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org, keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-security-module@vger.kernel.org Subject: [PATCH v8 2/6] KEYS: trusted: improve scalability of trust source config Date: Wed, 3 Apr 2024 09:21:18 +0200 Message-ID: <20240403072131.54935-3-david@sigma-star.at> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240403072131.54935-1-david@sigma-star.at> References: <20240403072131.54935-1-david@sigma-star.at> Precedence: bulk X-Mailing-List: keyrings@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Enabling trusted keys requires at least one trust source implementation (currently TPM, TEE or CAAM) to be enabled. Currently, this is done by checking each trust source's config option individually. This does not scale when more trust sources like the one for DCP are added, because the condition will get long and hard to read. Add config HAVE_TRUSTED_KEYS which is set to true by each trust source once its enabled and adapt the check for having at least one active trust source to use this option. Whenever a new trust source is added, it now needs to select HAVE_TRUSTED_KEYS. Signed-off-by: David Gstir Tested-by: Jarkko Sakkinen # for TRUSTED_KEYS_TPM Reviewed-by: Jarkko Sakkinen --- security/keys/trusted-keys/Kconfig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/security/keys/trusted-keys/Kconfig b/security/keys/trusted-keys/Kconfig index dbfdd8536468..553dc117f385 100644 --- a/security/keys/trusted-keys/Kconfig +++ b/security/keys/trusted-keys/Kconfig @@ -1,3 +1,6 @@ +config HAVE_TRUSTED_KEYS + bool + config TRUSTED_KEYS_TPM bool "TPM-based trusted keys" depends on TCG_TPM >= TRUSTED_KEYS @@ -9,6 +12,7 @@ config TRUSTED_KEYS_TPM select ASN1_ENCODER select OID_REGISTRY select ASN1 + select HAVE_TRUSTED_KEYS help Enable use of the Trusted Platform Module (TPM) as trusted key backend. Trusted keys are random number symmetric keys, @@ -20,6 +24,7 @@ config TRUSTED_KEYS_TEE bool "TEE-based trusted keys" depends on TEE >= TRUSTED_KEYS default y + select HAVE_TRUSTED_KEYS help Enable use of the Trusted Execution Environment (TEE) as trusted key backend. @@ -29,10 +34,11 @@ config TRUSTED_KEYS_CAAM depends on CRYPTO_DEV_FSL_CAAM_JR >= TRUSTED_KEYS select CRYPTO_DEV_FSL_CAAM_BLOB_GEN default y + select HAVE_TRUSTED_KEYS help Enable use of NXP's Cryptographic Accelerator and Assurance Module (CAAM) as trusted key backend. -if !TRUSTED_KEYS_TPM && !TRUSTED_KEYS_TEE && !TRUSTED_KEYS_CAAM -comment "No trust source selected!" +if !HAVE_TRUSTED_KEYS + comment "No trust source selected!" endif