1 // 2 // Copyright (C) 2023 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 #pragma once 17 18 #include <windows.h> 19 20 #if !defined(SECURE_ENV_DLL) 21 #define SECURE_ENV_DLL_SYMBOL 22 #elif defined(SECURE_ENV_BUILD_DLL) 23 #define SECURE_ENV_DLL_SYMBOL __declspec(dllexport) 24 #else 25 #define SECURE_ENV_DLL_SYMBOL __declspec(dllimport) 26 #endif 27 28 namespace secure_env { 29 extern "C" { 30 /* Starts and runs remote keymaster and gatekeeper in separate threads. 31 * All cryptography is performed in software. Returns on failure, or once 32 * the connections are dropped on success. 33 * 34 */ 35 SECURE_ENV_DLL_SYMBOL bool StartSecureEnv(const char* keymaster_pipe, 36 const char* gatekeeper_pipe, 37 bool use_tpm); 38 39 /* Starts and runs remote keymaster and gatekeeper using handles to preexisting 40 * async named pipes. Returns on failure, or once the connections are dropped on 41 * success. 42 */ 43 SECURE_ENV_DLL_SYMBOL bool StartSecureEnvWithHandles( 44 HANDLE keymaster_pipe_handle, HANDLE gatekeeper_pipe_handle, bool use_tpm); 45 } 46 47 } // namespace secure_env 48