blob: c778ebc7528d91d4bc5dfc9082465035300b3488 [file] [log] [blame]
Julian Hallfe487b72021-07-19 10:29:59 +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_KEY_DERIVATION_H
7#define TS_CRYPTO_KEY_DERIVATION_H
8
9#include <stdint.h>
10#include "key_attributes.h"
11
12/**
13 * Protocol definitions for key derivation operations
14 * using the packed-c serialization.
15 */
16
17
18/****************************************
19 * key_derivation_setup operation definition
20 */
21
22/* Mandatory fixed sized input parameters */
23struct __attribute__ ((__packed__)) ts_crypto_key_derivation_setup_in
24{
25 uint32_t alg;
26};
27
28/* Mandatory fixed sized output parameters */
29struct __attribute__ ((__packed__)) ts_crypto_key_derivation_setup_out
30{
31 uint32_t op_handle;
32};
33
34/****************************************
35 * key_derivation_get_capacity operation definition
36 */
37
38/* Mandatory fixed sized input parameters */
39struct __attribute__ ((__packed__)) ts_crypto_key_derivation_get_capacity_in
40{
41 uint32_t op_handle;
42};
43
44/* Mandatory fixed sized output parameters */
45struct __attribute__ ((__packed__)) ts_crypto_key_derivation_get_capacity_out
46{
47 uint32_t capacity;
48};
49
50/****************************************
51 * key_derivation_set_capacity operation definition
52 */
53
54/* Mandatory fixed sized input parameters */
55struct __attribute__ ((__packed__)) ts_crypto_key_derivation_set_capacity_in
56{
57 uint32_t op_handle;
58 uint32_t capacity;
59};
60
61/****************************************
62 * key_derivation_input_bytes operation definition
63 */
64
65/* Mandatory fixed sized input parameters */
66struct __attribute__ ((__packed__)) ts_crypto_key_derivation_input_bytes_in
67{
68 uint32_t op_handle;
69 uint32_t step;
70};
71
72/* Mandatory variable length input parameter tags */
73enum
74{
75 TS_CRYPTO_KEY_DERIVATION_INPUT_BYTES_IN_TAG_DATA = 1
76};
77
78/****************************************
79 * key_derivation_input_key operation definition
80 */
81
82/* Mandatory fixed sized input parameters */
83struct __attribute__ ((__packed__)) ts_crypto_key_derivation_input_key_in
84{
85 uint32_t op_handle;
86 uint32_t step;
87 uint32_t key_id;
88};
89
90/****************************************
91 * key_derivation_output_bytes operation definition
92 */
93
94/* Mandatory fixed sized input parameters */
95struct __attribute__ ((__packed__)) ts_crypto_key_derivation_output_bytes_in
96{
97 uint32_t op_handle;
98 uint32_t output_len;
99};
100
101/* Mandatory variable length output parameter tags */
102enum
103{
104 TS_CRYPTO_KEY_DERIVATION_OUTPUT_BYTES_OUT_TAG_DATA = 1
105};
106
107/****************************************
108 * key_derivation_output_key operation definition
109 */
110
111/* Mandatory fixed sized input parameters */
112struct __attribute__ ((__packed__)) ts_crypto_key_derivation_output_key_in
113{
114 uint32_t op_handle;
115 struct ts_crypto_key_attributes attributes;
116};
117
118/* Mandatory fixed sized output parameters */
119struct __attribute__ ((__packed__)) ts_crypto_key_derivation_output_key_out
120{
121 uint32_t key_id;
122};
123
124/****************************************
125 * key_derivation_abort operation definition
126 */
127
128/* Mandatory fixed sized input parameters */
129struct __attribute__ ((__packed__)) ts_crypto_key_derivation_abort_in
130{
131 uint32_t op_handle;
132};
133
134/****************************************
135 * key_derivation_key_agreement operation definition
136 */
137
138/* Mandatory fixed sized input parameters */
139struct __attribute__ ((__packed__)) ts_crypto_key_derivation_key_agreement_in
140{
141 uint32_t op_handle;
142 uint32_t step;
143 uint32_t private_key_id;
144};
145
146/* Mandatory variable length input parameter tags */
147enum
148{
149 TS_CRYPTO_KEY_DERIVATION_KEY_AGREEMENT_IN_TAG_PEER_KEY = 1
150};
151
152/****************************************
153 * raw_key_agreement operation definition
154 */
155
156/* Mandatory fixed sized input parameters */
157struct __attribute__ ((__packed__)) ts_crypto_raw_key_agreement_in
158{
159 uint32_t alg;
160 uint32_t private_key_id;
161};
162
163/* Mandatory variable length input parameter tags */
164enum
165{
166 TS_CRYPTO_RAW_KEY_AGREEMENT_IN_TAG_PEER_KEY = 1
167};
168
169/* Mandatory variable length output parameter tags */
170enum
171{
172 TS_CRYPTO_RAW_KEY_AGREEMENT_OUT_TAG_OUTPUT = 1
173};
174
175#endif /* TS_CRYPTO_KEY_DERIVATION_H */