1 /*
2  * Copyright (C) 2015 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 #define GATEKEEPER_PORT "com.android.trusty.gatekeeper"
20 #define GATEKEEPER_MAX_BUFFER_LENGTH 1024
21 
22 enum gatekeeper_command {
23     GK_REQ_SHIFT = 1,
24     GK_RESP_BIT = 1,
25 
26     GK_ENROLL = (0 << GK_REQ_SHIFT),
27     GK_VERIFY = (1 << GK_REQ_SHIFT),
28     GK_DELETE_USER = (2 << GK_REQ_SHIFT),
29     GK_DELETE_ALL_USERS = (3 << GK_REQ_SHIFT),
30 };
31 
32 /**
33  * gatekeeper_message - Serial header for communicating with GK server
34  * @cmd: the command, one of ENROLL, VERIFY. Payload must be a serialized
35  *       buffer of the corresponding request object.
36  * @payload: start of the serialized command specific payload
37  */
38 struct gatekeeper_message {
39     uint32_t cmd;
40     uint8_t payload[0];
41 };
42 
43