Add crypto support for symmetric cipher operations
Adds a sub-provider for symmetric cipher operations.
Signed-off-by: Julian Hall <julian.hall@arm.com>
Change-Id: Ic36195ae6eeb2fb81d06f83755fa400d219febc0
diff --git a/protocols/service/crypto/packed-c/cipher.h b/protocols/service/crypto/packed-c/cipher.h
new file mode 100644
index 0000000..72cd427
--- /dev/null
+++ b/protocols/service/crypto/packed-c/cipher.h
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef TS_CRYPTO_CIPHER_H
+#define TS_CRYPTO_CIPHER_H
+
+#include <stdint.h>
+
+/**
+ * Cipher operations on arbitrary sized data involve three operations,
+ * a setup, called once, an update called 1..* times and a finish
+ * to finalise theh hash operation. Operations may be aborted
+ * using the abort operation.
+ */
+
+
+/****************************************
+ * cipher_setup operation definition (encrypt or decrypt)
+ */
+
+/* Mandatory fixed sized input parameters */
+struct __attribute__ ((__packed__)) ts_crypto_cipher_setup_in
+{
+ uint32_t key_id;
+ uint32_t alg;
+};
+
+/* Mandatory fixed sized output parameters */
+struct __attribute__ ((__packed__)) ts_crypto_cipher_setup_out
+{
+ uint32_t op_handle;
+};
+
+/****************************************
+ * cipher_generate_iv operation definition
+ */
+
+/* Mandatory fixed sized input parameters */
+struct __attribute__ ((__packed__)) ts_crypto_cipher_generate_iv_in
+{
+ uint32_t op_handle;
+};
+
+/* Variable length output parameter tags */
+enum
+{
+ TS_CRYPTO_CIPHER_GENERATE_IV_OUT_TAG_IV = 1
+};
+
+/****************************************
+ * cipher_set_iv operation definition
+ */
+
+/* Mandatory fixed sized input parameters */
+struct __attribute__ ((__packed__)) ts_crypto_cipher_set_iv_in
+{
+ uint32_t op_handle;
+};
+
+/* Variable length input parameter tags */
+enum
+{
+ TS_CRYPTO_CIPHER_SET_IV_IN_TAG_IV = 1
+};
+
+/****************************************
+ * cipher_update operation definition
+ */
+
+/* Mandatory fixed sized input parameters */
+struct __attribute__ ((__packed__)) ts_crypto_cipher_update_in
+{
+ uint32_t op_handle;
+};
+
+/* Variable length input parameter tags */
+enum
+{
+ TS_CRYPTO_CIPHER_UPDATE_IN_TAG_DATA = 1
+};
+
+/* Variable length output parameter tags */
+enum
+{
+ TS_CRYPTO_CIPHER_UPDATE_OUT_TAG_DATA = 1
+};
+
+/****************************************
+ * cipher_finish operation definition
+ */
+
+/* Mandatory fixed sized input parameters */
+struct __attribute__ ((__packed__)) ts_crypto_cipher_finish_in
+{
+ uint32_t op_handle;
+};
+
+/* Variable length output parameter tags */
+enum
+{
+ TS_CRYPTO_CIPHER_FINISH_OUT_TAG_DATA = 1
+};
+
+/****************************************
+ * cipher_abort operation definition
+ */
+
+/* Mandatory fixed sized input parameters */
+struct __attribute__ ((__packed__)) ts_crypto_cipher_abort_in
+{
+ uint32_t op_handle;
+};
+
+#endif /* TS_CRYPTO_CIPHER_H */