Chung-yih Wang | 70246eb | 2009-06-29 03:12:56 +0800 | [diff] [blame] | 1 | /* |
| 2 | ** |
| 3 | ** Copyright 2009, The Android Open Source Project |
| 4 | ** |
| 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | ** you may not use this file except in compliance with the License. |
| 7 | ** You may obtain a copy of the License at |
| 8 | ** |
| 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | ** |
| 11 | ** Unless required by applicable law or agreed to in writing, software |
| 12 | ** distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | ** See the License for the specific language governing permissions and |
| 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #ifndef __COMMON_H__ |
| 19 | #define __COMMON_H__ |
| 20 | |
| 21 | #define SOCKET_PATH "keystore" |
| 22 | #define KEYSTORE_DIR "/data/misc/keystore/" |
| 23 | |
| 24 | #define READ_TIMEOUT 3 |
| 25 | #define MAX_KEY_NAME_LENGTH 64 |
| 26 | #define MAX_NAMESPACE_LENGTH MAX_KEY_NAME_LENGTH |
| 27 | #define MAX_KEY_VALUE_LENGTH 4096 |
| 28 | |
| 29 | #define BUFFER_MAX MAX_KEY_VALUE_LENGTH |
| 30 | |
| 31 | typedef enum { |
| 32 | BOOTUP, |
| 33 | UNINITIALIZED, |
| 34 | LOCKED, |
| 35 | UNLOCKED, |
| 36 | } KEYSTORE_STATE; |
| 37 | |
| 38 | typedef enum { |
| 39 | LOCK, |
| 40 | UNLOCK, |
| 41 | PASSWD, |
| 42 | GETSTATE, |
| 43 | LISTKEYS, |
| 44 | GET, |
| 45 | PUT, |
| 46 | REMOVE, |
| 47 | RESET, |
| 48 | MAX_OPCODE |
| 49 | } KEYSTORE_OPCODE; |
| 50 | |
| 51 | typedef struct { |
| 52 | uint32_t len; |
| 53 | union { |
| 54 | uint32_t opcode; |
| 55 | uint32_t retcode; |
| 56 | }; |
| 57 | unsigned char data[BUFFER_MAX + 1]; |
| 58 | } LPC_MARSHAL; |
| 59 | |
| 60 | #endif |