blob: 72cd4272c38ea9c594e955ae0df7d104784778fd [file] [log] [blame]
Julian Halle7bccbe2021-07-16 09:50:34 +01001/*
2 * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef TS_CRYPTO_CIPHER_H
7#define TS_CRYPTO_CIPHER_H
8
9#include <stdint.h>
10
11/**
12 * Cipher operations on arbitrary sized data involve three operations,
13 * a setup, called once, an update called 1..* times and a finish
14 * to finalise theh hash operation. Operations may be aborted
15 * using the abort operation.
16 */
17
18
19/****************************************
20 * cipher_setup operation definition (encrypt or decrypt)
21 */
22
23/* Mandatory fixed sized input parameters */
24struct __attribute__ ((__packed__)) ts_crypto_cipher_setup_in
25{
26 uint32_t key_id;
27 uint32_t alg;
28};
29
30/* Mandatory fixed sized output parameters */
31struct __attribute__ ((__packed__)) ts_crypto_cipher_setup_out
32{
33 uint32_t op_handle;
34};
35
36/****************************************
37 * cipher_generate_iv operation definition
38 */
39
40/* Mandatory fixed sized input parameters */
41struct __attribute__ ((__packed__)) ts_crypto_cipher_generate_iv_in
42{
43 uint32_t op_handle;
44};
45
46/* Variable length output parameter tags */
47enum
48{
49 TS_CRYPTO_CIPHER_GENERATE_IV_OUT_TAG_IV = 1
50};
51
52/****************************************
53 * cipher_set_iv operation definition
54 */
55
56/* Mandatory fixed sized input parameters */
57struct __attribute__ ((__packed__)) ts_crypto_cipher_set_iv_in
58{
59 uint32_t op_handle;
60};
61
62/* Variable length input parameter tags */
63enum
64{
65 TS_CRYPTO_CIPHER_SET_IV_IN_TAG_IV = 1
66};
67
68/****************************************
69 * cipher_update operation definition
70 */
71
72/* Mandatory fixed sized input parameters */
73struct __attribute__ ((__packed__)) ts_crypto_cipher_update_in
74{
75 uint32_t op_handle;
76};
77
78/* Variable length input parameter tags */
79enum
80{
81 TS_CRYPTO_CIPHER_UPDATE_IN_TAG_DATA = 1
82};
83
84/* Variable length output parameter tags */
85enum
86{
87 TS_CRYPTO_CIPHER_UPDATE_OUT_TAG_DATA = 1
88};
89
90/****************************************
91 * cipher_finish operation definition
92 */
93
94/* Mandatory fixed sized input parameters */
95struct __attribute__ ((__packed__)) ts_crypto_cipher_finish_in
96{
97 uint32_t op_handle;
98};
99
100/* Variable length output parameter tags */
101enum
102{
103 TS_CRYPTO_CIPHER_FINISH_OUT_TAG_DATA = 1
104};
105
106/****************************************
107 * cipher_abort operation definition
108 */
109
110/* Mandatory fixed sized input parameters */
111struct __attribute__ ((__packed__)) ts_crypto_cipher_abort_in
112{
113 uint32_t op_handle;
114};
115
116#endif /* TS_CRYPTO_CIPHER_H */