1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * Copyright (C) 2009 The Android Open Source Project 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * Licensed under the Apache License, Version 2.0 (the "License"); 5*4882a593Smuzhiyun * you may not use this file except in compliance with the License. 6*4882a593Smuzhiyun * You may obtain a copy of the License at 7*4882a593Smuzhiyun * 8*4882a593Smuzhiyun * http://www.apache.org/licenses/LICENSE-2.0 9*4882a593Smuzhiyun * 10*4882a593Smuzhiyun * Unless required by applicable law or agreed to in writing, software 11*4882a593Smuzhiyun * distributed under the License is distributed on an "AS IS" BASIS, 12*4882a593Smuzhiyun * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*4882a593Smuzhiyun * See the License for the specific language governing permissions and 14*4882a593Smuzhiyun * limitations under the License. 15*4882a593Smuzhiyun */ 16*4882a593Smuzhiyun 17*4882a593Smuzhiyun #include <stdio.h> 18*4882a593Smuzhiyun 19*4882a593Smuzhiyun #ifndef __ENCRYPTEDFS_PROVISIONING_H__ 20*4882a593Smuzhiyun #define __ENCRYPTEDFS_PROVISIONING_H__ 21*4882a593Smuzhiyun 22*4882a593Smuzhiyun #define MODE_ENCRYPTED_FS_DISABLED 0 23*4882a593Smuzhiyun #define MODE_ENCRYPTED_FS_ENABLED 1 24*4882a593Smuzhiyun 25*4882a593Smuzhiyun #define ENCRYPTED_FS_OK 0 26*4882a593Smuzhiyun #define ENCRYPTED_FS_ERROR (-1) 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun #define ENCRYPTED_FS_KEY_SIZE 16 29*4882a593Smuzhiyun #define ENCRYPTED_FS_SALT_SIZE 16 30*4882a593Smuzhiyun #define ENCRYPTED_FS_MAX_HASH_SIZE 128 31*4882a593Smuzhiyun #define ENTROPY_MAX_SIZE 4096 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun struct encrypted_fs_info { 34*4882a593Smuzhiyun int mode; 35*4882a593Smuzhiyun char key[ENCRYPTED_FS_KEY_SIZE]; 36*4882a593Smuzhiyun char salt[ENCRYPTED_FS_SALT_SIZE]; 37*4882a593Smuzhiyun int salt_length; 38*4882a593Smuzhiyun char hash[ENCRYPTED_FS_MAX_HASH_SIZE]; 39*4882a593Smuzhiyun int hash_length; 40*4882a593Smuzhiyun char entropy[ENTROPY_MAX_SIZE]; 41*4882a593Smuzhiyun int entropy_length; 42*4882a593Smuzhiyun }; 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun typedef struct encrypted_fs_info encrypted_fs_info; 45*4882a593Smuzhiyun 46*4882a593Smuzhiyun int read_encrypted_fs_info(encrypted_fs_info *secure_fs_data); 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun int restore_encrypted_fs_info(encrypted_fs_info *secure_data); 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun #endif /* __ENCRYPTEDFS_PROVISIONING_H__ */ 51*4882a593Smuzhiyun 52