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: 13615045 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (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 776FD5B69E for ; Wed, 3 Apr 2024 07:21:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712128907; cv=none; b=RbX6RXEwvuXpq1gYMRmLZJWcYigYzQ8AImf4NkMXZLxgZpQ/riOfoL7MY4BXWZQdfxw7r2qSfPwo+V1+XmIM1VoTJgQipcEujHJetTAyF80lGYcxHM7d2oRANrVKQ1XwTmm9VUmIxy0PRRW/0sq2BskWVOGJ3p5mOV0gONVAc2E= 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.50 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-f50.google.com with SMTP id 5b1f17b1804b1-41551639550so29337575e9.2 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=1712128903; x=1712733703; 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=dR9ixbfeVO2qgXvPQ9AqABZbR6NT+cdZkzSFr9jz2VY7JZpBVHWisErXfXMgw7SiFR NKQnUZSrAFl+8RHA2Wv72hNA6yp9uW7avamVdjHw63PWlQ5M2dkdHey7xfrjK9hl+9sM +ZMAIm5bfYrZKVGjmLY9fBF29k59hFsgyB9XP5yzZ1UYql4e0XOBV1AYZ2QOgLJBYDBg 5mLWYKFbtNOpu4/rd6WXfkgwuj1YQ1a1gFUJsAVZ+A1yEBLEgeEwmgFfVs9rtenUvh28 qU2bLdSWwLdaTm3rObTFYc9Dkk0kboim7IiSMpSluM7Gzj1uwG0DnIVj61gVMqm9vBad fe0w== X-Forwarded-Encrypted: i=1; AJvYcCWi4/hhfk0V5NpFQCsZNu8XtqAW6GW9dvbdsGST2Eaj/+W4ud+dSjmGFgONzxDhLw3RE/C581z7PFSXy2M+CkLFHz6lUwuhTh5i7I0E X-Gm-Message-State: AOJu0YzUEFnS1co1Z0qnMRb12Kt8/V1aQOjiBCZQR3wfrAfm6fgboXfs b7n5PNtWWS1B653vO4kJngtUmBwbWg29NSYM0CeJBy+yXRa2ZhdKLCknw4WoF64= 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: linux-crypto@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