1 /*
2  * Copyright (C) 2022 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 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 // Main function for Rust implementation of KeyMint.
23 // - fd_in: file descriptor for incoming serialized request messages
24 // - fd_out: file descriptor for outgoing serialized response messages
25 // - security_level: security level to advertise; should be one of the integer
26 //   values from SecurityLevel.aidl.
27 // - trm: pointer to a valid `TpmResourceManager`, which must remain valid
28 //   for the entire duration of the function execution.
29 // - snapshot_socket_fd: file descriptor for a socket used to communicate with
30 //   the secure_env suspend-resume handler thread.
31 void kmr_ta_main(int fd_in, int fd_out, int security_level, void* trm,
32                  int snapshot_socket_fd);
33 
34 #ifdef __cplusplus
35 }
36 #endif
37