Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Unified Diff: src/platform/cryptohome/cryptohome_common.h

Issue 2051003: Initial patch from Will. (Closed) Base URL: ssh://git@chromiumos-git/chromiumos
Patch Set: Address style nits. Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/platform/cryptohome/cryptohome_common.h
diff --git a/src/platform/cryptohome/cryptohome_common.h b/src/platform/cryptohome/cryptohome_common.h
new file mode 100644
index 0000000000000000000000000000000000000000..d6e0d37ab49007d3649492091bbab8b44f153e4d
--- /dev/null
+++ b/src/platform/cryptohome/cryptohome_common.h
@@ -0,0 +1,44 @@
+// Copyright (c) 2009-2010 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.
+
+#ifndef CRYPTOHOME_COMMON_H_
+#define CRYPTOHOME_COMMON_H_
+
+extern "C" {
+#include <ecryptfs.h>
+}
+
+namespace cryptohome {
+
+// The default symmetric key size for cryptohome is the ecryptfs default
+#define CRYPTOHOME_DEFAULT_KEY_SIZE ECRYPTFS_MAX_KEY_BYTES
+#define CRYPTOHOME_DEFAULT_KEY_SIGNATURE_SIZE ECRYPTFS_SIG_SIZE
+#define CRYPTOHOME_DEFAULT_KEY_SALT_SIZE ECRYPTFS_SALT_SIZE
+#define CRYPTOHOME_AES_KEY_BYTES ECRYPTFS_AES_KEY_BYTES
+// The default salt length for the user salt
+#define CRYPTOHOME_DEFAULT_SALT_LENGTH 16
+// Macros for min and max
+#define CRYPTOHOME_MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
mschilder 2010/05/27 04:20:18 These are scary of course, double eval of argument
+#define CRYPTOHOME_MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
+
+struct VaultKeysetHeader {
+ char signature[2];
+ unsigned char major_version;
+ unsigned char minor_version;
+} __attribute__((__packed__));
+typedef struct VaultKeysetHeader VaultKeysetHeader;
+
+struct VaultKeysetKeys {
+ unsigned char fek[CRYPTOHOME_DEFAULT_KEY_SIZE];
+ unsigned char fek_sig[CRYPTOHOME_DEFAULT_KEY_SIGNATURE_SIZE];
+ unsigned char fek_salt[CRYPTOHOME_DEFAULT_KEY_SALT_SIZE];
+ unsigned char fnek[CRYPTOHOME_DEFAULT_KEY_SIZE];
+ unsigned char fnek_sig[CRYPTOHOME_DEFAULT_KEY_SIGNATURE_SIZE];
+ unsigned char fnek_salt[CRYPTOHOME_DEFAULT_KEY_SALT_SIZE];
+} __attribute__((__packed__));
+typedef struct VaultKeysetKeys VaultKeysetKeys;
+
+} // cryptohome
+
+#endif // CRYPTOHOME_COMMON_H_

Powered by Google App Engine
This is Rietveld 408576698