1 /* 2 * Copyright (C) 2015 The Android Open Source Project 3 * Copyright (C) 2017 GlobalLogic 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 #ifndef OPTEE_KEYMASTER_OPTEE_KEYMASTER_IPC_H_ 19 #define OPTEE_KEYMASTER_OPTEE_KEYMASTER_IPC_H_ 20 21 #include <keymaster/android_keymaster_messages.h> 22 #include <optee_keymaster/ipc/keymaster_ipc.h> 23 24 __BEGIN_DECLS 25 26 const uint32_t OPTEE_KEYMASTER_RECV_BUF_SIZE = 2 * getpagesize(); 27 const uint32_t OPTEE_KEYMASTER_SEND_BUF_SIZE = 2 * getpagesize(); 28 29 int optee_keymaster_connect(void); 30 int optee_keymaster_call(uint32_t cmd, void* in, uint32_t in_size, uint8_t* out, 31 uint32_t* out_size); 32 void optee_keymaster_disconnect(void); 33 34 keymaster_error_t translate_error(int err); 35 keymaster_error_t optee_keymaster_send(uint32_t command, const keymaster::Serializable& req, 36 keymaster::KeymasterResponse* rsp); 37 38 __END_DECLS 39 40 #endif // OPTEE_KEYMASTER_OPTEE_KEYMASTER_IPC_H_ 41