blob: 7ea6bb80b451ce586e08072a008c87be16631c8f [file] [log] [blame]
Kenny Root51878182012-03-13 12:53:19 -07001/*
2 * Copyright (C) 2012 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#ifndef __KEYSTORE_CLIENT_H__
18#define __KEYSTORE_CLIENT_H__
19
20#include <keystore.h>
21
22#define KEYSTORE_MESSAGE_SIZE 65535
23
24
25class Keystore_Reply {
26public:
27 Keystore_Reply();
28 ~Keystore_Reply();
29
30 uint8_t* get();
31 void setLength(size_t length);
32 size_t length() const;
33 void setCode(ResponseCode code);
34 ResponseCode code() const;
35 uint8_t* release();
36
37private:
38 ResponseCode mCode;
39 uint8_t* mData;
40 size_t mLength;
41};
42
43
44/**
45 * This sends a command to the keystore. The arguments must be of the format:
46 *
47 * size_t length, const uint8_t* data, [size_t length, const uint8_t* data, [...]]
48 */
49ResponseCode keystore_cmd(command_code_t cmd, Keystore_Reply* reply, int numArgs, ...);
50
51#endif /* __KEYSTORE_CLIENT_H__ */