Oscar Montemayor | 52219a6 | 2010-02-25 16:47:02 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2009 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 | #include <stdio.h> |
| 18 | |
| 19 | #ifndef __ENCRYPTEDFS_PROVISIONING_H__ |
| 20 | #define __ENCRYPTEDFS_PROVISIONING_H__ |
| 21 | |
| 22 | #define MODE_ENCRYPTED_FS_DISABLED 0 |
| 23 | #define MODE_ENCRYPTED_FS_ENABLED 1 |
| 24 | |
| 25 | #define ENCRYPTED_FS_OK 0 |
| 26 | #define ENCRYPTED_FS_ERROR (-1) |
| 27 | |
| 28 | #define ENCRYPTED_FS_KEY_SIZE 16 |
| 29 | #define ENCRYPTED_FS_SALT_SIZE 16 |
| 30 | #define ENCRYPTED_FS_MAX_HASH_SIZE 128 |
| 31 | #define ENTROPY_MAX_SIZE 4096 |
| 32 | |
| 33 | struct encrypted_fs_info { |
| 34 | int mode; |
| 35 | char key[ENCRYPTED_FS_KEY_SIZE]; |
| 36 | char salt[ENCRYPTED_FS_SALT_SIZE]; |
| 37 | int salt_length; |
| 38 | char hash[ENCRYPTED_FS_MAX_HASH_SIZE]; |
| 39 | int hash_length; |
| 40 | char entropy[ENTROPY_MAX_SIZE]; |
| 41 | int entropy_length; |
| 42 | }; |
| 43 | |
| 44 | typedef struct encrypted_fs_info encrypted_fs_info; |
| 45 | |
| 46 | int read_encrypted_fs_info(encrypted_fs_info *secure_fs_data); |
| 47 | |
| 48 | int restore_encrypted_fs_info(encrypted_fs_info *secure_data); |
| 49 | |
| 50 | #endif /* __ENCRYPTEDFS_PROVISIONING_H__ */ |
| 51 | |