Skip to contentSkip to conversation

KEYS: asym_tpm: add skeleton for asym_tpm

RFC Superseded Denis Kenzior 1 participant 1 message Jun 12, 2018

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

RFC v2 2/13 KEYS: asym_tpm: add skeleton for asym_tpm

This patch adds the basic skeleton for the asym_tpm asymmetric key subtype.

---
 crypto/asymmetric_keys/Kconfig    | 11 +++++
 crypto/asymmetric_keys/Makefile   |  1 +
 crypto/asymmetric_keys/asym_tpm.c | 94 +++++++++++++++++++++++++++++++++++++++
 include/crypto/asym_tpm_subtype.h | 16 +++++++
 4 files changed, 122 insertions(+)
 create mode 100644 crypto/asymmetric_keys/asym_tpm.c
 create mode 100644 include/crypto/asym_tpm_subtype.h
crypto/asymmetric_keys/Kconfig +11 -0
index 66a7dad7ed3d..b75555c7d8ae 100644
@@ -21,6 +21,17 @@ config ASYMMETRIC_PUBLIC_KEY_SUBTYPE
 	  appropriate hash algorithms (such as SHA-1) must be available.
 	  ENOPKG will be reported if the requisite algorithm is unavailable.
 
+config ASYMMETRIC_TPM_KEY_SUBTYPE
+	tristate "Asymmetric TPM backed private key subtype"
+	depends on TCG_TPM
+	select CRYPTO_HMAC
+	select CRYPTO_SHA1
+	select CRYPTO_HASH_INFO
+	help
+	  This option provides support for TPM backed private key type handling.
+	  Operations such as sign, verify, encrypt, decrypt are performed by
+	  the TPM after the private key is loaded.
+
 config X509_CERTIFICATE_PARSER
 	tristate "X.509 certificate parser"
 	depends on ASYMMETRIC_PUBLIC_KEY_SUBTYPE
crypto/asymmetric_keys/Makefile +1 -0
index a67ad834dacb..1dfa125317dc 100644
@@ -11,6 +11,7 @@ asymmetric_keys-y := \
 	signature.o
 
 obj-$(CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE) += public_key.o
+obj-$(CONFIG_ASYMMETRIC_TPM_KEY_SUBTYPE) += asym_tpm.o
 
 #
 # X.509 Certificate handling
crypto/asymmetric_keys/asym_tpm.c new file +94 -0

94 lines not on this page · raw message

include/crypto/asym_tpm_subtype.h new file +16 -0
new file mode 100644
index 000000000000..03550b850998
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0
+#ifndef _LINUX_ASYM_TPM_SUBTYPE_H
+#define _LINUX_ASYM_TPM_SUBTYPE_H
+
+#include <linux/keyctl.h>
+
+struct tpm_key {
+	void *blob;
+	u32 blob_len;
+};
+
+struct tpm_key *tpm_key_create(const void *blob, uint32_t blob_len);
+
+extern struct asymmetric_key_subtype asym_tpm_subtype;
+
+#endif /* _LINUX_ASYM_TPM_SUBTYPE_H */
Signature · 1 line
2.16.1