blob: 10b3b7d7d8b4e6286bbf0404e5e5b61a4a8c8d8e [file] [log] [blame]
Ken Sumrall8f869aa2010-12-03 03:47:09 -08001/*
2 * Copyright (C) 2010 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/* This structure starts 16,384 bytes before the end of a hardware
18 * partition that is encrypted.
19 * Immediately following this structure is the encrypted key.
20 * Obviously, the filesystem does not include the last 16 kbytes
21 * of the partition.
22 */
23
24#define CRYPT_FOOTER_OFFSET 0x4000
25
26#define MAX_CRYPTO_TYPE_NAME_LEN 64
27
28/* definitions of flags in the structure below */
29#define CRYPT_MNT_KEY_UNENCRYPTED 0x1 /* The key for the partition is not encrypted. */
30
31#define CRYPT_MNT_MAGIC 0xD0B5B1C4
32
33#define __le32 unsigned int
34#define __le16 unsigned short int
35
36struct crypt_mnt_ftr {
37 __le32 magic; /* See above */
38 __le16 major_version;
39 __le16 minor_version;
40 __le32 ftr_size; /* in bytes, not including key following */
41 __le32 flags; /* See above */
42 __le32 keysize; /* in bytes */
43 __le32 spare1; /* ignored */
44 __le64 fs_size; /* Size of the encrypted fs, in 512 byte sectors */
45 __le32 failed_decrypt_count; /* count of # of failed attempts to decrypt and
46 mount, set to 0 on successful mount */
47 unsigned char crypto_type_name[MAX_CRYPTO_TYPE_NAME_LEN]; /* The type of encryption
48 needed to decrypt this
49 partition, null terminated */
50};
51
52#ifdef __cplusplus
53extern "C" {
54#endif
55 int cryptfs_check_passwd(char *pw);
Ken Sumrall6864b7e2011-01-14 15:20:02 -080056 int cryptfs_restart(void);
Ken Sumrall8f869aa2010-12-03 03:47:09 -080057 int cryptfs_enable(char *flag, char *passwd);
58#ifdef __cplusplus
59}
60#endif
61