1310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales/*
2310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales * Copyright (C) 2015 The Android Open Source Project
3310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales *
4310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales * Licensed under the Apache License, Version 2.0 (the "License");
5310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales * you may not use this file except in compliance with the License.
6310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales * You may obtain a copy of the License at
7310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales *
8310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales *      http://www.apache.org/licenses/LICENSE-2.0
9310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales *
10310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales * Unless required by applicable law or agreed to in writing, software
11310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales * distributed under the License is distributed on an "AS IS" BASIS,
12310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales * See the License for the specific language governing permissions and
14310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales * limitations under the License.
15310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales */
16310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales
17310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales#pragma once
18310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales
19310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales#define GATEKEEPER_PORT "com.android.trusty.gatekeeper"
20310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales#define GATEKEEPER_MAX_BUFFER_LENGTH 1024
21310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales
22310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Moralesenum gatekeeper_command {
23310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales	GK_REQ_SHIFT = 1,
24310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales	GK_RESP_BIT  = 1,
25310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales
26310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales	GK_ENROLL       = (0 << GK_REQ_SHIFT),
27310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales	GK_VERIFY       = (1 << GK_REQ_SHIFT),
28310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales};
29310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales
30310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales/**
31310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales * gatekeeper_message - Serial header for communicating with GK server
32310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales * @cmd: the command, one of ENROLL, VERIFY. Payload must be a serialized
33310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales *       buffer of the corresponding request object.
34310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales * @payload: start of the serialized command specific payload
35310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales */
36310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Moralesstruct gatekeeper_message {
37310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales    uint32_t cmd;
38310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales    uint8_t payload[0];
39310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales};
40310dcffbe0c57b686f459c9961ae7b03a1c86a93Andres Morales
41