summaryrefslogtreecommitdiff
path: root/include/keys
diff options
context:
space:
mode:
authorUdit Agarwal <udit.agarwal@nxp.com>2018-07-04 09:51:59 +0530
committerDong Aisheng <aisheng.dong@nxp.com>2019-11-25 15:43:20 +0800
commite2173ee9874b74843341562659ba15593f33ed72 (patch)
tree24ce324224ebcd4a47a71f149959b3610298546d /include/keys
parent219d54332a09e8d8741c1e1982f5eae56099de85 (diff)
security/keys/secure_key: Adds the secure key support based on CAAM.
Secure keys are derieved using CAAM crypto block. Secure keys derieved are the random number symmetric keys from CAAM. Blobs corresponding to the key are formed using CAAM. User space will only be able to view the blob of the key. Signed-off-by: Udit Agarwal <udit.agarwal@nxp.com> Reviewed-by: Sahil Malhotra <sahil.malhotra@nxp.com>
Diffstat (limited to 'include/keys')
-rw-r--r--include/keys/secure-type.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/keys/secure-type.h b/include/keys/secure-type.h
new file mode 100644
index 000000000000..5b7a5f144e41
--- /dev/null
+++ b/include/keys/secure-type.h
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2018 NXP.
+ *
+ */
+
+#ifndef _KEYS_SECURE_TYPE_H
+#define _KEYS_SECURE_TYPE_H
+
+#include <linux/key.h>
+#include <linux/rcupdate.h>
+
+/* Minimum key size to be used is 32 bytes and maximum key size fixed
+ * is 128 bytes.
+ * Blob size to be kept is Maximum key size + blob header added by CAAM.
+ */
+
+#define MIN_KEY_SIZE 32
+#define MAX_KEY_SIZE 128
+#define BLOB_HEADER_SIZE 48
+
+#define MAX_BLOB_SIZE (MAX_KEY_SIZE + BLOB_HEADER_SIZE)
+
+struct secure_key_payload {
+ struct rcu_head rcu;
+ unsigned int key_len;
+ unsigned int blob_len;
+ unsigned char key[MAX_KEY_SIZE + 1];
+ unsigned char blob[MAX_BLOB_SIZE];
+};
+
+extern struct key_type key_type_secure;
+#endif