From patchwork Wed Oct 16 05:14:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 176418 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6866805ill; Tue, 15 Oct 2019 22:15:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqw60ItBPs5LNe45QDSbE/JjE5vMgSLPMDDXqFWEG+eOjyOK1aaKAPRnK1uJ2SAG3lAiXQ/P X-Received: by 2002:aa7:cd06:: with SMTP id b6mr38519881edw.58.1571202947431; Tue, 15 Oct 2019 22:15:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571202947; cv=none; d=google.com; s=arc-20160816; b=zCAT8zKdyJFqjcVv6tmflezfoKfluON3sxjOwJ6iiV4HWSkwUekjAFojM7ju9KNcDc 58XtA6/1Ttvtjp98etoNqWsTJg612ieYTVAb6AR/Fti51U0gnd09blzTPkknShyi5ZKB zhvfIXgjBNZvVXtpPhHS9EPGeE6NEV2YkMSU+dsLK5AVRv3sMsLsUJmTyTFi0gRYXdsY e9s3EIMA0yj43wOBEIbZTZ9mIKliNyDR9HxE1EH5LkyTrgCwvi+bUoMPAlfVlaEcBmv7 dSHkHN439umUfrUQV3dB0+T1XCZ99Z5lfalGbwief6q3Mb6XkoFca0ZhduAHndWEHppC FExQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=81Smj8hEjVGZHa4t6tbqbgnCLHuFdqzlQro1oH/HrWE=; b=Myp8V79837pWcsD3UbotAfvwLaVrCXrdwwudCKcdLmOfT0Q4cSPVN5DW1yPBVd0+dD dCVVmZTPtq2WKEcdgodEV/gQVeqcYj1g6jpBAZERXurX62iXzMMJeXb50T2bEQp8RhQ+ Srh1ihVJLjttHbMIzyse3QEzLpyI1aDyRxpEB0LX41UxD/7pQ8wH2kUyeboyDWmkETfj zJg1wThnSJjwt21v6tdgayT54HHN6sVkM/nb2+I7ILZOKJZSr080XLmdzAp1+Qj1tgMc 8INjtaW3aOAcJZ9kNBBXjN6zheDCRdBHnBJ30x2o1gkKjNbZWJwIVFcqcbuK4J1oMXTQ MPJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p4Ig7iBt; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v53si15935701edc.378.2019.10.15.22.15.47; Tue, 15 Oct 2019 22:15:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p4Ig7iBt; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729828AbfJPFPq (ORCPT + 3 others); Wed, 16 Oct 2019 01:15:46 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:38596 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728716AbfJPFPq (ORCPT ); Wed, 16 Oct 2019 01:15:46 -0400 Received: by mail-pf1-f193.google.com with SMTP id h195so13933340pfe.5 for ; Tue, 15 Oct 2019 22:15:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=81Smj8hEjVGZHa4t6tbqbgnCLHuFdqzlQro1oH/HrWE=; b=p4Ig7iBtTIMZ2SD7LG2ZW/fu2F7wrhTzaHthC+pSAall4UQ8iBGLk8VCtUZiRfCnZc WIae2/c4XoJ6RsHbLednBKAj/q6WbJUGQ0iXZagl0Ms6ExVYY3RyECLPRbmcGdM4FYcZ hKfkNVQls9ec4KxhItqNWecDsF0keruuNjY0PvUGrwFgBmL5CCByu68JxHfp08ECHLga WL+BS7yNKCQ6QYoCXi0IhvAfNl4JQovYZ1Vfev3vd2F8FvkkPgur1Bd33tz0MFIKuZOc 4xm6yJUaADcsK3eWAyJJc8fFWkBQ9A2zTLHIHdjTrzJiEzPJ8D9ZoyPEzih/hsSilalR Mm2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=81Smj8hEjVGZHa4t6tbqbgnCLHuFdqzlQro1oH/HrWE=; b=tLw9RCAMiUyRiIXRWtzSR59zi5kZ7ZJEKkG4FkVxe9RDErCWzIXQ2iLrkZMdcAtiJI EH2CBRXLpgs+d4M+CInSzAV9mAMuI7Bn9Tz/E14O5g1BuITVcf+nY0nMZu0as/FNlCdh O1P3WTA9hRMp3X58SXOvkzuBfbdEsymFESL+3IOrLeyKZbV3OuzxA6BLdd9NJ1mGeyve IRxP7ZBqW4bqIw1j+VcEGadlRAfpl5hpyCcyFXefqVn9kwMcFC6Ehgl322pNNJqqSjzQ NMy2Lr/QnXsuhHOGAkcKsjf438aHm2GzBj7Is3SKRiPgJemVaAkgor6IFYY5E/7ilXR+ KZ8g== X-Gm-Message-State: APjAAAWLLXmnJB5XIqasM8yFoCrT33iOFFmyxGl5JahB7xd9qAG0Qq4g iXN3UdSWy4UNI8/KBLnb+aPytA== X-Received: by 2002:a63:5c52:: with SMTP id n18mr2112914pgm.354.1571202944725; Tue, 15 Oct 2019 22:15:44 -0700 (PDT) Received: from localhost.localdomain ([117.252.65.194]) by smtp.gmail.com with ESMTPSA id r81sm953297pgr.17.2019.10.15.22.15.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 15 Oct 2019 22:15:43 -0700 (PDT) From: Sumit Garg To: jarkko.sakkinen@linux.intel.com, dhowells@redhat.com, peterhuewe@gmx.de Cc: keyrings@vger.kernel.org, linux-integrity@vger.kernel.org, linux-crypto@vger.kernel.org, linux-security-module@vger.kernel.org, herbert@gondor.apana.org.au, davem@davemloft.net, jgg@ziepe.ca, arnd@arndb.de, gregkh@linuxfoundation.org, jejb@linux.ibm.com, zohar@linux.ibm.com, jmorris@namei.org, serge@hallyn.com, jsnitsel@redhat.com, linux-kernel@vger.kernel.org, daniel.thompson@linaro.org, Sumit Garg Subject: [Patch v8 3/4] KEYS: trusted: Create trusted keys subsystem Date: Wed, 16 Oct 2019 10:44:54 +0530 Message-Id: <1571202895-32651-4-git-send-email-sumit.garg@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1571202895-32651-1-git-send-email-sumit.garg@linaro.org> References: <1571202895-32651-1-git-send-email-sumit.garg@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Move existing code to trusted keys subsystem. Also, rename files with "tpm" as suffix which provides the underlying implementation. Suggested-by: Jarkko Sakkinen Signed-off-by: Sumit Garg Reviewed-by: Jarkko Sakkinen --- crypto/asymmetric_keys/asym_tpm.c | 2 +- include/Kbuild | 1 - include/keys/{trusted.h => trusted_tpm.h} | 7 +++++-- security/keys/Makefile | 2 +- security/keys/trusted-keys/Makefile | 7 +++++++ security/keys/{trusted.c => trusted-keys/trusted_tpm1.c} | 2 +- 6 files changed, 15 insertions(+), 6 deletions(-) rename include/keys/{trusted.h => trusted_tpm.h} (96%) create mode 100644 security/keys/trusted-keys/Makefile rename security/keys/{trusted.c => trusted-keys/trusted_tpm1.c} (99%) -- 2.7.4 diff --git a/crypto/asymmetric_keys/asym_tpm.c b/crypto/asymmetric_keys/asym_tpm.c index a2b2a61..d16d893 100644 --- a/crypto/asymmetric_keys/asym_tpm.c +++ b/crypto/asymmetric_keys/asym_tpm.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include diff --git a/include/Kbuild b/include/Kbuild index ffba794..6f9ec5a 100644 --- a/include/Kbuild +++ b/include/Kbuild @@ -65,7 +65,6 @@ header-test- += keys/asymmetric-subtype.h header-test- += keys/asymmetric-type.h header-test- += keys/big_key-type.h header-test- += keys/request_key_auth-type.h -header-test- += keys/trusted.h header-test- += kvm/arm_arch_timer.h header-test- += kvm/arm_pmu.h header-test-$(CONFIG_ARM) += kvm/arm_psci.h diff --git a/include/keys/trusted.h b/include/keys/trusted_tpm.h similarity index 96% rename from include/keys/trusted.h rename to include/keys/trusted_tpm.h index 29e3e9b..7b9d7b4 100644 --- a/include/keys/trusted.h +++ b/include/keys/trusted_tpm.h @@ -1,6 +1,9 @@ /* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __TRUSTED_KEY_H -#define __TRUSTED_KEY_H +#ifndef __TRUSTED_TPM_H +#define __TRUSTED_TPM_H + +#include +#include /* implementation specific TPM constants */ #define MAX_BUF_SIZE 1024 diff --git a/security/keys/Makefile b/security/keys/Makefile index 9cef540..074f275 100644 --- a/security/keys/Makefile +++ b/security/keys/Makefile @@ -28,5 +28,5 @@ obj-$(CONFIG_ASYMMETRIC_KEY_TYPE) += keyctl_pkey.o # Key types # obj-$(CONFIG_BIG_KEYS) += big_key.o -obj-$(CONFIG_TRUSTED_KEYS) += trusted.o +obj-$(CONFIG_TRUSTED_KEYS) += trusted-keys/ obj-$(CONFIG_ENCRYPTED_KEYS) += encrypted-keys/ diff --git a/security/keys/trusted-keys/Makefile b/security/keys/trusted-keys/Makefile new file mode 100644 index 0000000..1a24680 --- /dev/null +++ b/security/keys/trusted-keys/Makefile @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for trusted keys +# + +obj-$(CONFIG_TRUSTED_KEYS) += trusted.o +trusted-y += trusted_tpm1.o diff --git a/security/keys/trusted.c b/security/keys/trusted-keys/trusted_tpm1.c similarity index 99% rename from security/keys/trusted.c rename to security/keys/trusted-keys/trusted_tpm1.c index 7071011..e3155fd 100644 --- a/security/keys/trusted.c +++ b/security/keys/trusted-keys/trusted_tpm1.c @@ -27,7 +27,7 @@ #include #include -#include +#include static const char hmac_alg[] = "hmac(sha1)"; static const char hash_alg[] = "sha1";