Interface: Add PSA Internal Trusted Storage header
Adds version 1.0.0 of the psa/internal_trusted_storage.h header to the
include directory, as well as the psa/storage_common.h header it
depends on.
Change-Id: I6fd76eb8edb13151505351804ca73ddc14e2a0a9
Signed-off-by: Jamie Fox <jamie.fox@arm.com>
diff --git a/interface/include/psa/internal_trusted_storage.h b/interface/include/psa/internal_trusted_storage.h
new file mode 100644
index 0000000..8f67f22
--- /dev/null
+++ b/interface/include/psa/internal_trusted_storage.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+/** This file describes the PSA Internal Trusted Storage API
+*/
+
+#ifndef PSA_INTERNAL_TRUSTED_STORAGE_H
+#define PSA_INTERNAL_TRUSTED_STORAGE_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "psa/error.h"
+#include "psa/storage_common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define PSA_ITS_API_VERSION_MAJOR 1
+#define PSA_ITS_API_VERSION_MINOR 0
+
+// This version of the header file is associated with 1.0 final release.
+
+/**
+ * Create a new or modify an existing uid/value pair
+ */
+psa_status_t psa_its_set(psa_storage_uid_t uid,
+ size_t data_length,
+ const void *p_data,
+ psa_storage_create_flags_t create_flags);
+
+/**
+ * Retrieve data associated with a provided UID
+ */
+psa_status_t psa_its_get(psa_storage_uid_t uid,
+ size_t data_offset,
+ size_t data_size,
+ void *p_data,
+ size_t *p_data_length);
+
+/**
+ * Retrieve the metadata about the provided uid
+ */
+psa_status_t psa_its_get_info(psa_storage_uid_t uid,
+ struct psa_storage_info_t *p_info);
+
+/**
+ * Remove the provided key and its associated data from the storage
+ */
+psa_status_t psa_its_remove(psa_storage_uid_t uid);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // PSA_INTERNAL_TRUSTED_STORAGE_H
diff --git a/interface/include/psa/storage_common.h b/interface/include/psa/storage_common.h
new file mode 100644
index 0000000..3f901c5
--- /dev/null
+++ b/interface/include/psa/storage_common.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+/* This file includes common definitions for PSA storage
+*/
+
+#ifndef PSA_STORAGE_COMMON_H
+#define PSA_STORAGE_COMMON_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef uint32_t psa_storage_create_flags_t;
+
+typedef uint64_t psa_storage_uid_t;
+
+/* Flags */
+
+#define PSA_STORAGE_FLAG_NONE 0u
+#define PSA_STORAGE_FLAG_WRITE_ONCE (1u << 0)
+#define PSA_STORAGE_FLAG_NO_CONFIDENTIALITY (1u << 1)
+#define PSA_STORAGE_FLAG_NO_REPLAY_PROTECTION (1u << 2)
+
+/* A container for metadata associated with a specific uid */
+
+struct psa_storage_info_t {
+ size_t capacity;
+ size_t size;
+ psa_storage_create_flags_t flags;
+};
+
+#define PSA_STORAGE_SUPPORT_SET_EXTENDED (1u << 0)
+
+#define PSA_ERROR_INVALID_SIGNATURE ((psa_status_t)-149)
+#define PSA_ERROR_DATA_CORRUPT ((psa_status_t)-152)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // PSA_STORAGE_COMMON_H