TF-RMM Release v0.1.0
This is the first external release of TF-RMM and provides a reference
implementation of Realm Management Monitor (RMM) as specified by the
RMM Beta0 specification[1].
The `docs/readme.rst` has more details about the project and
`docs/getting_started/getting-started.rst` has details on how to get
started with TF-RMM.
[1] https://developer.arm.com/documentation/den0137/1-0bet0/?lang=en
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
Change-Id: I205ef14c015e4a37ae9ae1a64e4cd22eb8da746e
diff --git a/lib/attestation/include/attestation.h b/lib/attestation/include/attestation.h
new file mode 100644
index 0000000..a843688
--- /dev/null
+++ b/lib/attestation/include/attestation.h
@@ -0,0 +1,81 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * SPDX-FileCopyrightText: Copyright TF-RMM Contributors.
+ */
+
+#ifndef ATTESTATION_H
+#define ATTESTATION_H
+
+#include <t_cose/q_useful_buf.h>
+
+struct buffer_alloc_ctx;
+
+/*
+ * Performs any early initialization needed for the crypto library.
+ */
+int attestation_init(void);
+
+/*
+ * Return the platform token that was previously retrieved from the monitor.
+ *
+ * Arguments:
+ * buf - pointer to a q_useful_buf structure where the reference to the
+ * platform token will be returned.
+ *
+ * Returns 0 on success, and a negative error code otherwise.
+ */
+int attest_get_platform_token(struct q_useful_buf_c **buf);
+
+/*
+ * Initialize the heap buffer to be used with the given buffer_alloc_ctx.
+ * This is done when a REC is created.
+ *
+ * As a pre-requisite, ensure that a buffer_alloc_ctx has been assigned to this
+ * PE prior to calling this function.
+ *
+ * Arguments:
+ * buf - pointer to start of heap
+ * buf_size - size of the heap
+ *
+ * Returns 0 on success, negative error code on error.
+ */
+int attestation_heap_ctx_init(unsigned char *buf, size_t buf_size);
+
+/*
+ * Assign a given buf_alloc_ctx to this CPU. This needs to be called
+ * prior to entering a Realm to allow it invoking RMM crypto operations.
+ *
+ * Arguments:
+ * ctx - pointer to buffer_alloc_ctx
+ *
+ * Returns 0 on success, negative error code on error.
+ */
+int attestation_heap_ctx_assign_pe(struct buffer_alloc_ctx *ctx);
+
+
+/*
+ * Unassign a given buf_alloc_ctx from CPU. This needs to be called
+ * after exiting the realm.
+ *
+ * Arguments:
+ * ctx - pointer to buffer_alloc_ctx
+ *
+ * Returns 0 on success, negative error code on error.
+ */
+int attestation_heap_ctx_unassign_pe(struct buffer_alloc_ctx *ctx);
+
+/*
+ * Reinit the heap on this CPU used for attestation operations.
+ *
+ * Arguments:
+ * buf - Buffer to use as heap.
+ * buf_size - Size of the buffer to use as heap.
+ *
+ * Returns 0 on success, negative error code otherwise.
+ *
+ * Note: This function assumes that a the allocator has a
+ * buffer_alloc_ctx assigned to it.
+ */
+int attestation_heap_reinit_pe(unsigned char *buf, size_t buf_size);
+
+#endif /* ATTESTATION_H */