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 <stdint.h> 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 #define ACVP_PORT "com.android.trusty.acvp" 26 27 /* 28 * Maximum number of arguments 29 */ 30 #define ACVP_MAX_NUM_ARGUMENTS 9 31 32 /* 33 * Maximum length of an algorithm name 34 */ 35 #define ACVP_MAX_NAME_LENGTH 30 36 37 /* 38 * Maximum length of an ACVP request message 39 */ 40 #define ACVP_MAX_MESSAGE_LENGTH sizeof(struct acvp_req) 41 42 /* 43 * Minimum length of the shared memory buffer 44 * 45 * This must be at least as long as the longest reply from the ACVP service 46 * (currently the reply from getConfig()). 47 */ 48 #define ACVP_MIN_SHARED_MEMORY 32768 49 50 /** 51 * acvp_req - Request for the Trusty ACVP app 52 * @num_args: Number of acvp_arg structures following this struct 53 * @buffer_size: Total size of shared memory buffer 54 * @lengths: Length of each argument in the shared memory buffer 55 * 56 * @num_args copies of the acvp_arg struct follow this structure. 57 */ 58 struct acvp_req { 59 uint32_t num_args; 60 uint32_t buffer_size; 61 uint32_t lengths[ACVP_MAX_NUM_ARGUMENTS]; 62 }; 63 64 /** 65 * acvp_resp - Response to a ACVP request 66 * 67 * @num_spans: Number of response sections 68 * @lengths: Length of each response section 69 */ 70 struct acvp_resp { 71 uint32_t num_spans; 72 uint32_t lengths[ACVP_MAX_NUM_ARGUMENTS]; 73 }; 74 75 #ifdef __cplusplus 76 } // extern "C" 77 #endif 78