Add update agent implementation

Adds an implementation of the generic update agent component. This
implements the FWU state machine that ensures that a valid update
sequence is followed.

Signed-off-by: Julian Hall <julian.hall@arm.com>
Change-Id: Icf51b6527f1f84eb0f693e1629f4d2b3b075d43a
diff --git a/components/service/fwu/agent/img_dir_serializer.h b/components/service/fwu/agent/img_dir_serializer.h
new file mode 100644
index 0000000..28274f2
--- /dev/null
+++ b/components/service/fwu/agent/img_dir_serializer.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2022, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef IMG_DIR_SERIALIZER_H
+#define IMG_DIR_SERIALIZER_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Interface dependencies
+ */
+struct fw_directory;
+struct fw_store;
+
+/**
+ * \brief Serialize the public image directory
+ *
+ *  Using content from the internal fw_directory and fw_store, create
+ *  a serialized image_directory that conforms to the FWU-A specification
+ *  format.
+ *
+ * \param[in]  fw_dir         Source fw_directory
+ * \param[in]  fw_store       Source fw_store
+ * \param[in]  buf            Serialize into this buffer
+ * \param[in]  buf_size       Size of buffer
+ * \param[out] data_len       Length of serialized data
+ *
+ * \return Status
+ */
+int img_dir_serializer_serialize(
+	const struct fw_directory *fw_dir,
+	const struct fw_store *fw_store,
+	uint8_t *buf,
+	size_t buf_size,
+	size_t *data_len);
+
+/**
+ * \brief Return the length in bytes of the serialized image directory
+ *
+ * \param[in]  fw_dir         Source fw_directory
+ *
+ * \return Size in bytes
+ */
+size_t img_dir_serializer_get_len(
+	const struct fw_directory *fw_dir);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IMG_DIR_SERIALIZER_H */