| OLD | NEW |
| 1 // Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CRYPTOHOME_COMMON_H_ | 5 #ifndef CRYPTOHOME_CRYPTOHOME_COMMON_H_ |
| 6 #define CRYPTOHOME_COMMON_H_ | 6 #define CRYPTOHOME_CRYPTOHOME_COMMON_H_ |
| 7 | |
| 8 extern "C" { | |
| 9 #include <ecryptfs.h> | |
| 10 } | |
| 11 | 7 |
| 12 namespace cryptohome { | 8 namespace cryptohome { |
| 13 | 9 |
| 14 // The default symmetric key size for cryptohome is the ecryptfs default | 10 // The default symmetric key size for cryptohome is the ecryptfs default |
| 15 #define CRYPTOHOME_DEFAULT_KEY_SIZE ECRYPTFS_MAX_KEY_BYTES | 11 #define CRYPTOHOME_DEFAULT_KEY_SIZE 64 // ECRYPTFS_MAX_KEY_BYTES |
| 16 #define CRYPTOHOME_DEFAULT_KEY_SIGNATURE_SIZE ECRYPTFS_SIG_SIZE | 12 #define CRYPTOHOME_DEFAULT_KEY_SIGNATURE_SIZE 8 // ECRYPTFS_SIG_SIZE |
| 17 #define CRYPTOHOME_DEFAULT_KEY_SALT_SIZE ECRYPTFS_SALT_SIZE | 13 #define CRYPTOHOME_DEFAULT_KEY_SALT_SIZE 8 // ECRYPTFS_SALT_SIZE |
| 18 #define CRYPTOHOME_AES_KEY_BYTES ECRYPTFS_AES_KEY_BYTES | 14 #define CRYPTOHOME_AES_KEY_BYTES 16 // ECRYPTFS_AES_KEY_BYTES |
| 19 // The default salt length for the user salt | 15 // The default salt length for the user salt |
| 20 #define CRYPTOHOME_DEFAULT_SALT_LENGTH 16 | 16 #define CRYPTOHOME_DEFAULT_SALT_LENGTH 16 |
| 21 // Macros for min and max | 17 #define CRYPTOHOME_PWNAME_BUF_LENGTH 1024 |
| 22 #define CRYPTOHOME_MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) | |
| 23 #define CRYPTOHOME_MAX(X, Y) (((X) > (Y)) ? (X) : (Y)) | |
| 24 | 18 |
| 25 struct VaultKeysetHeader { | 19 struct VaultKeysetHeader { |
| 26 char signature[2]; | 20 char signature[2]; |
| 27 unsigned char major_version; | 21 unsigned char major_version; |
| 28 unsigned char minor_version; | 22 unsigned char minor_version; |
| 29 } __attribute__((__packed__)); | 23 } __attribute__((__packed__)); |
| 30 typedef struct VaultKeysetHeader VaultKeysetHeader; | 24 typedef struct VaultKeysetHeader VaultKeysetHeader; |
| 31 | 25 |
| 32 struct VaultKeysetKeys { | 26 struct VaultKeysetKeys { |
| 33 unsigned char fek[CRYPTOHOME_DEFAULT_KEY_SIZE]; | 27 unsigned char fek[CRYPTOHOME_DEFAULT_KEY_SIZE]; |
| 34 unsigned char fek_sig[CRYPTOHOME_DEFAULT_KEY_SIGNATURE_SIZE]; | 28 unsigned char fek_sig[CRYPTOHOME_DEFAULT_KEY_SIGNATURE_SIZE]; |
| 35 unsigned char fek_salt[CRYPTOHOME_DEFAULT_KEY_SALT_SIZE]; | 29 unsigned char fek_salt[CRYPTOHOME_DEFAULT_KEY_SALT_SIZE]; |
| 36 unsigned char fnek[CRYPTOHOME_DEFAULT_KEY_SIZE]; | 30 unsigned char fnek[CRYPTOHOME_DEFAULT_KEY_SIZE]; |
| 37 unsigned char fnek_sig[CRYPTOHOME_DEFAULT_KEY_SIGNATURE_SIZE]; | 31 unsigned char fnek_sig[CRYPTOHOME_DEFAULT_KEY_SIGNATURE_SIZE]; |
| 38 unsigned char fnek_salt[CRYPTOHOME_DEFAULT_KEY_SALT_SIZE]; | 32 unsigned char fnek_salt[CRYPTOHOME_DEFAULT_KEY_SALT_SIZE]; |
| 39 } __attribute__((__packed__)); | 33 } __attribute__((__packed__)); |
| 40 typedef struct VaultKeysetKeys VaultKeysetKeys; | 34 typedef struct VaultKeysetKeys VaultKeysetKeys; |
| 41 | 35 |
| 42 } // cryptohome | 36 } // namespace cryptohome |
| 43 | 37 |
| 44 #endif // CRYPTOHOME_COMMON_H_ | 38 #endif // CRYPTOHOME_CRYPTOHOME_COMMON_H_ |
| OLD | NEW |