1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <lk/compiler.h>
20 #include <stdint.h>
21 
22 __BEGIN_CDECLS
23 
24 #define ACVP_PORT "com.android.trusty.acvp"
25 
26 /*
27  * Maximum number of arguments
28  */
29 #define ACVP_MAX_NUM_ARGUMENTS 9
30 
31 /*
32  * Maximum length of an algorithm name
33  */
34 #define ACVP_MAX_NAME_LENGTH 30
35 
36 /*
37  * Maximum length of an ACVP request message
38  */
39 #define ACVP_MAX_MESSAGE_LENGTH sizeof(struct acvp_req)
40 
41 /**
42  * acvp_req - Request for the Trusty ACVP app
43  * @num_args: Number of acvp_arg structures following this struct
44  * @buffer_size: Total size of shared memory buffer
45  * @lengths: Length of each argument in the shared memory buffer
46  *
47  * @num_args copies of the acvp_arg struct follow this structure.
48  */
49 struct acvp_req {
50     uint32_t num_args;
51     uint32_t buffer_size;
52     uint32_t lengths[ACVP_MAX_NUM_ARGUMENTS];
53 };
54 
55 /**
56  * acvp_resp - Response to a ACVP request
57  *
58  * @num_spans: Number of response sections
59  * @lengths: Length of each response section
60  */
61 struct acvp_resp {
62     uint32_t num_spans;
63     uint32_t lengths[ACVP_MAX_NUM_ARGUMENTS];
64 };
65 
66 __END_CDECLS
67