summaryrefslogtreecommitdiff
path: root/utility/mount-helpers.h
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2012-02-27 12:43:15 -0800
committerGerrit <chrome-bot@google.com>2012-04-04 12:47:23 -0700
commit498977af89510bf5e44af0a0b8171d23fb770f4b (patch)
treed02c241a80410659ca1b3ef603c347edad2f344f /utility/mount-helpers.h
parent27f8838fb4e1f157320c4ec871e57dcfcaea5fab (diff)
downloadvboot-498977af89510bf5e44af0a0b8171d23fb770f4b.tar.gz
mount-encrypted: add encrypted mount helper
This adds the utility needed to mount the encrypted partition at boot time, as defined by the design document: https://docs.google.com/a/google.com/document/d/1VQTDXvNsEFcrUOmNC4OmCfJst49Pd_mxZ41nfKu5EPc/edit This still needs Cryptohome support and chromeos_startup to switch to using it. BUG=chromium-os:22172 TEST=lumpy build & manual testing Change-Id: Ib9f0b4e5ba1a8aeb4737d0c8ec72a8e0dee049da Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/16889 Reviewed-by: Elly Jones <ellyjones@chromium.org>
Diffstat (limited to 'utility/mount-helpers.h')
-rw-r--r--utility/mount-helpers.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/utility/mount-helpers.h b/utility/mount-helpers.h
new file mode 100644
index 00000000..bc50fe54
--- /dev/null
+++ b/utility/mount-helpers.h
@@ -0,0 +1,40 @@
+/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Header file for mount helpers.
+ */
+#ifndef _MOUNT_HELPERS_H_
+#define _MOUNT_HELPERS_H_
+
+/* General utility functions. */
+size_t get_sectors(const char *device);
+int remove_tree(const char *tree);
+int runcmd(const gchar *argv[], gchar **output);
+int same_vfs(const char *mnt_a, const char *mnt_b);
+char *stringify_hex(uint8_t *binary, size_t length);
+uint8_t *hexify_string(char *string, uint8_t *binary, size_t length);
+
+/* Loopback device attach/detach helpers. */
+gchar *loop_attach(int fd, const char *name);
+int loop_detach(const gchar *loopback);
+
+/* Encrypted device mapper setup/teardown. */
+int dm_setup(size_t sectors, const gchar *encryption_key, const char *name,
+ const gchar *device, const char *path);
+void dm_teardown(const gchar *device);
+char *dm_get_key(const gchar *device);
+
+/* Sparse file creation. */
+int sparse_create(const char *path, size_t size);
+
+/* Filesystem creation. */
+int filesystem_build(const char *device, size_t block_bytes, size_t blocks_min,
+ size_t blocks_max);
+void filesystem_resizer(const char *device, size_t blocks, size_t blocks_max);
+
+/* Encrypted keyfile handling. */
+char *keyfile_read(const char *keyfile, uint8_t *system_key);
+int keyfile_write(const char *keyfile, uint8_t *system_key, char *plain);
+
+#endif /* _MOUNT_HELPERS_H_ */