From patchwork Mon Sep 16 10:34:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 173819 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3321842ilq; Mon, 16 Sep 2019 03:35:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/ERs3LYu7kHX8A4cQkd/t+22755lP+jYDF9EKhpogSOZMW9X1DS4SgMFUmDcXE/bnBxQb X-Received: by 2002:a50:eb4c:: with SMTP id z12mr61506512edp.155.1568630127810; Mon, 16 Sep 2019 03:35:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568630127; cv=none; d=google.com; s=arc-20160816; b=bab/akLPDgoddIsKt14ds3nMu/808PXAqFa6ry2rLTeFdglDMM+M8iOi3/ZpDGx3c4 ATUiTygIhDdYiofqLh79s0oNA/VfWp9/Kybexlcx0QJMHhv9UlTMjWwDy8A06Ykscp9T PFHzj5a3cj+JoPiz8SukdP19Xp4j0w/+JtwjzZ3LK7j5BaCViqh7ApIlLMxswyZjt926 bPW1tfQBKOzhz/VO5jUyg7GtoYnM6YRE2IQXrqT6e4ppbyzbPHjBhh+BMj7yoPhnFG+n HHoUs2zh4NEcSHXzlBxJ03/X/K8Vz2dB4kpHJNtgXRxYDeegKjyGexU2gP3qyxPJkTOP zB1g== 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=vWhzdsB9uzCvRwKGknlCyYMC7XSQEgoYcx5GO5z/Lh8=; b=buJq+3m7r5+O6O8TltT9WJCFq7jfUm9V/STMTd+oY+Wm2ysNBDlM57NR9XS0CRy0D5 mdk0aoZ3L4srVRPxbXbx8cw2QvjzBxPKWUVKsIhAvQgd/iTqairwTMCjj+LPEOOhmUdA 02DvS6aCpEKi4kur79rtqZdrqxrhLuU3Cxuh5F0m3o6n0MS/gicR8raODEiJHsTHry8+ +hlgaSr/rqfpUGbR9qF08/jdriGeYDlKtjOZoOYfZhY6r/DG0qa/3I3u5mg9OstxOpB0 2x3wdxTSWMnVHe+SXJfXEoglX5fz7+77o3TbMvqQ3kvKb5Ax1S5GqQn8cJcor9DaEymH 7M0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FDPriqTU; 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 l19si4275162eds.389.2019.09.16.03.35.27; Mon, 16 Sep 2019 03:35:27 -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=FDPriqTU; 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 S1730831AbfIPKf0 (ORCPT + 3 others); Mon, 16 Sep 2019 06:35:26 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:46289 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730811AbfIPKf0 (ORCPT ); Mon, 16 Sep 2019 06:35:26 -0400 Received: by mail-pg1-f195.google.com with SMTP id a3so1729527pgm.13 for ; Mon, 16 Sep 2019 03:35:25 -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=vWhzdsB9uzCvRwKGknlCyYMC7XSQEgoYcx5GO5z/Lh8=; b=FDPriqTUPWFcKb3sARuBJvJwVUszQSO30TxZUq6p9pm/d0wIWU/VE6+GWbZpTP6RRv 5jooIua7dr1KGZoF7JijV8Uq8WqiAYfcgBnaNNivjtied4pIADTQOUFDyHC37iFECHBC BzF4ZlCKNOkpdz+BnZX4qSqhO14FCxBi8IUTkErPpZcMb6fhpmNK+sPTOu1KcgiD8Uw+ NYElPestVdaX18B9/zVWHZGkQfZYSxKPnMeRdMNGJYTtp1f00THuKp/Qp9Vhqf228S6F KlsWQWMSpAHdlKn+REMvw3aDmGqL25Q10pbXNauqYK3QAhp0BLJXE49ioBhbqMnAzLn2 KsfQ== 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=vWhzdsB9uzCvRwKGknlCyYMC7XSQEgoYcx5GO5z/Lh8=; b=H7i5MwVvSGTK6H9OIN38lWOaRHssz6jOI1YqQHWikUNHBc2bjlwwWlNrhPpFrkFLha 3Be097r+iMGJK7ikojcMUvWzO+1VHlF9C9zcuaks0tOItJKjEim62T76ByK6MF2fWZL0 FxzsDDFAiQejsmvgSMtTRiZL0uL6CCCsPPTvAEvkLehFv0dgdQEMRhj9moJ7BMLXHOG9 x4ccT+xGfNBcMYUuYHUszqEX5/6ABQwvJGwCzArXZVxU+Xsu1/tuPF71AM2lbNahZJXq 9WvVBVJCKXjoU1El/HBVEluhEF20O+9prZzeuz4+CkIluthT+KaNhFe+9In3D/EXQ6wR 0v2A== X-Gm-Message-State: APjAAAV5D4PpySAGE2JPB9TDGFV7bXB4aC41tCdyAaSm0jswVRzIOJML j9DyvgDjPrEzTxX2cvBANBTwQw== X-Received: by 2002:a63:4812:: with SMTP id v18mr26781025pga.83.1568630125215; Mon, 16 Sep 2019 03:35:25 -0700 (PDT) Received: from localhost.localdomain ([117.252.69.68]) by smtp.gmail.com with ESMTPSA id d14sm58256914pfh.36.2019.09.16.03.35.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Sep 2019 03:35:24 -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 v6 3/4] KEYS: trusted: Create trusted keys subsystem Date: Mon, 16 Sep 2019 16:04:23 +0530 Message-Id: <1568630064-14887-4-git-send-email-sumit.garg@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568630064-14887-1-git-send-email-sumit.garg@linaro.org> References: <1568630064-14887-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 c38f0d4..a5801c0 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";