1 // Copyright 2015 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef SYSTEM_API_DBUS_CRYPTOHOME_DBUS_CONSTANTS_H_
6 #define SYSTEM_API_DBUS_CRYPTOHOME_DBUS_CONSTANTS_H_
7 
8 namespace cryptohome {
9 
10 // Interface exposed by the cryptohome daemon.
11 
12 const char kCryptohomeInterface[] = "org.chromium.CryptohomeInterface";
13 const char kCryptohomeServicePath[] = "/org/chromium/Cryptohome";
14 const char kCryptohomeServiceName[] = "org.chromium.Cryptohome";
15 
16 // Methods of the |kCryptohomeInterface| interface:
17 const char kCryptohomeMigrateKey[] = "MigrateKey";
18 const char kCryptohomeMigrateKeyEx[] = "MigrateKeyEx";
19 const char kCryptohomeRemoveEx[] = "RemoveEx";
20 const char kCryptohomeGetSystemSalt[] = "GetSystemSalt";
21 const char kCryptohomeGetSanitizedUsername[] = "GetSanitizedUsername";
22 const char kCryptohomeIsMounted[] = "IsMounted";
23 const char kCryptohomeMount[] = "Mount";
24 const char kCryptohomeMountGuest[] = "MountGuest";
25 const char kCryptohomeMountGuestEx[] = "MountGuestEx";
26 const char kCryptohomeUnmount[] = "Unmount";
27 const char kCryptohomeTpmIsReady[] = "TpmIsReady";
28 const char kCryptohomeTpmIsEnabled[] = "TpmIsEnabled";
29 const char kCryptohomeTpmIsOwned[] = "TpmIsOwned";
30 const char kCryptohomeTpmIsBeingOwned[] = "TpmIsBeingOwned";
31 const char kCryptohomeTpmGetPassword[] = "TpmGetPassword";
32 const char kCryptohomeTpmCanAttemptOwnership[] = "TpmCanAttemptOwnership";
33 const char kCryptohomeTpmClearStoredPassword[] = "TpmClearStoredPassword";
34 const char kCryptohomePkcs11GetTpmTokenInfo[] = "Pkcs11GetTpmTokenInfo";
35 const char kCryptohomePkcs11GetTpmTokenInfoForUser[] =
36     "Pkcs11GetTpmTokenInfoForUser";
37 const char kCryptohomePkcs11IsTpmTokenReady[] = "Pkcs11IsTpmTokenReady";
38 const char kCryptohomePkcs11IsTpmTokenReadyForUser[] =
39     "Pkcs11IsTpmTokenReadyForUser";
40 const char kCryptohomeAsyncMigrateKey[] = "AsyncMigrateKey";
41 const char kCryptohomeAsyncMount[] = "AsyncMount";
42 const char kCryptohomeAsyncMountGuest[] = "AsyncMountGuest";
43 const char kCryptohomeAsyncRemove[] = "AsyncRemove";
44 const char kCryptohomeGetStatusString[] = "GetStatusString";
45 const char kCryptohomeRemoveTrackedSubdirectories[] =
46     "RemoveTrackedSubdirectories";
47 const char kCryptohomeAsyncRemoveTrackedSubdirectories[] =
48     "AsyncRemoveTrackedSubdirectories";
49 const char kCryptohomeAsyncDoesUsersExist[] = "AsyncDoesUsersExist";
50 const char kCryptohomeInstallAttributesGet[] = "InstallAttributesGet";
51 const char kCryptohomeInstallAttributesSet[] = "InstallAttributesSet";
52 const char kCryptohomeInstallAttributesCount[] = "InstallAttributesCount";
53 const char kCryptohomeInstallAttributesFinalize[] =
54     "InstallAttributesFinalize";
55 const char kCryptohomeInstallAttributesIsReady[] = "InstallAttributesIsReady";
56 const char kCryptohomeInstallAttributesIsSecure[] =
57     "InstallAttributesIsSecure";
58 const char kCryptohomeInstallAttributesIsInvalid[] =
59     "InstallAttributesIsInvalid";
60 const char kCryptohomeInstallAttributesIsFirstInstall[] =
61     "InstallAttributesIsFirstInstall";
62 const char kCryptohomeTpmIsAttestationPrepared[] = "TpmIsAttestationPrepared";
63 const char kCryptohomeTpmIsAttestationEnrolled[] = "TpmIsAttestationEnrolled";
64 const char kCryptohomeTpmAttestationCreateEnrollRequest[] =
65     "TpmAttestationCreateEnrollRequest";
66 const char kCryptohomeAsyncTpmAttestationCreateEnrollRequest[] =
67     "AsyncTpmAttestationCreateEnrollRequest";
68 const char kCryptohomeAsyncTpmAttestationCreateEnrollRequestNew[] =
69     "AsyncTpmAttestationCreateEnrollRequestNew";
70 const char kCryptohomeTpmAttestationEnroll[] = "TpmAttestationEnroll";
71 const char kCryptohomeAsyncTpmAttestationEnroll[] = "AsyncTpmAttestationEnroll";
72 const char kCryptohomeAsyncTpmAttestationEnrollNew[] =
73     "AsyncTpmAttestationEnrollNew";
74 const char kCryptohomeTpmAttestationCreateCertRequest[] =
75     "TpmAttestationCreateCertRequest";
76 const char kCryptohomeAsyncTpmAttestationCreateCertRequest[] =
77     "AsyncTpmAttestationCreateCertRequest";
78 const char kCryptohomeAsyncTpmAttestationCreateCertRequestByProfile[] =
79     "AsyncTpmAttestationCreateCertRequestByProfile";
80 const char kCryptohomeTpmAttestationFinishCertRequest[] =
81     "TpmAttestationFinishCertRequest";
82 const char kCryptohomeAsyncTpmAttestationFinishCertRequest[] =
83     "AsyncTpmAttestationFinishCertRequest";
84 const char kCryptohomeTpmAttestationDoesKeyExist[] =
85     "TpmAttestationDoesKeyExist";
86 const char kCryptohomeTpmAttestationGetCertificate[] =
87     "TpmAttestationGetCertificate";
88 const char kCryptohomeTpmAttestationGetPublicKey[] =
89     "TpmAttestationGetPublicKey";
90 const char kCryptohomeTpmAttestationRegisterKey[] = "TpmAttestationRegisterKey";
91 // TODO(crbug.com/789419): Remove this deprecated API.
92 const char kCryptohomeTpmAttestationSignEnterpriseChallenge[] =
93     "TpmAttestationSignEnterpriseChallenge";
94 const char kCryptohomeTpmAttestationSignEnterpriseVaChallenge[] =
95     "TpmAttestationSignEnterpriseVaChallenge";
96 const char kCryptohomeTpmAttestationSignSimpleChallenge[] =
97     "TpmAttestationSignSimpleChallenge";
98 const char kCryptohomeTpmAttestationGetKeyPayload[] =
99     "TpmAttestationGetKeyPayload";
100 const char kCryptohomeTpmAttestationSetKeyPayload[] =
101     "TpmAttestationSetKeyPayload";
102 const char kCryptohomeTpmAttestationDeleteKeys[] =
103     "TpmAttestationDeleteKeys";
104 const char kCryptohomeTpmAttestationGetEnrollmentId[] =
105     "TpmAttestationGetEnrollmentId";
106 // TODO(isandrk): Deprecated, remove on (or before) 2017/09/21 - after the
107 // Chromium side has been changed to use the new TpmGetVersionStructured.
108 const char kCryptohomeTpmGetVersion[] = "TpmGetVersion";
109 const char kCryptohomeTpmGetVersionStructured[] = "TpmGetVersionStructured";
110 const char kCryptohomeGetKeyDataEx[] = "GetKeyDataEx";
111 const char kCryptohomeCheckKeyEx[] = "CheckKeyEx";
112 const char kCryptohomeMountEx[] = "MountEx";
113 const char kCryptohomeAddKeyEx[] = "AddKeyEx";
114 const char kCryptohomeUpdateKeyEx[] = "UpdateKeyEx";
115 const char kCryptohomeRemoveKeyEx[] = "RemoveKeyEx";
116 const char kCryptohomeSignBootLockbox[] = "SignBootLockbox";
117 const char kCryptohomeVerifyBootLockbox[] = "VerifyBootLockbox";
118 const char kCryptohomeFinalizeBootLockbox[] = "FinalizeBootLockbox";
119 const char kCryptohomeGetBootAttribute[] = "GetBootAttribute";
120 const char kCryptohomeSetBootAttribute[] = "SetBootAttribute";
121 const char kCryptohomeFlushAndSignBootAttributes[] =
122     "FlushAndSignBootAttributes";
123 const char kCryptohomeGetLoginStatus[] = "GetLoginStatus";
124 const char kCryptohomeGetTpmStatus[] = "GetTpmStatus";
125 const char kCryptohomeGetEndorsementInfo[] = "GetEndorsementInfo";
126 const char kCryptohomeRenameCryptohome[] = "RenameCryptohome";
127 const char kCryptohomeGetAccountDiskUsage[] = "GetAccountDiskUsage";
128 const char kCryptohomeGetFirmwareManagementParameters[] =
129     "GetFirmwareManagementParameters";
130 const char kCryptohomeSetFirmwareManagementParameters[] =
131     "SetFirmwareManagementParameters";
132 const char kCryptohomeRemoveFirmwareManagementParameters[] =
133     "RemoveFirmwareManagementParameters";
134 const char kCryptohomeMigrateToDircrypto[] = "MigrateToDircrypto";
135 const char kCryptohomeNeedsDircryptoMigration[] = "NeedsDircryptoMigration";
136 const char kCryptohomeGetSupportedKeyPolicies[] = "GetSupportedKeyPolicies";
137 const char kCryptohomeIsQuotaSupported[] = "IsQuotaSupported";
138 const char kCryptohomeGetCurrentSpaceForUid[] = "GetCurrentSpaceForUid";
139 const char kCryptohomeGetCurrentSpaceForGid[] = "GetCurrentSpaceForGid";
140 
141 // Signals of the |kCryptohomeInterface| interface:
142 const char kSignalAsyncCallStatus[] = "AsyncCallStatus";
143 const char kSignalAsyncCallStatusWithData[] = "AsyncCallStatusWithData";
144 const char kSignalTpmInitStatus[] = "TpmInitStatus";
145 const char kSignalCleanupUsersRemoved[] = "CleanupUsersRemoved";
146 const char kSignalLowDiskSpace[] = "LowDiskSpace";
147 const char kSignalDircryptoMigrationProgress[] = "DircryptoMigrationProgress";
148 
149 // Error code
150 enum MountError {
151   MOUNT_ERROR_NONE = 0,
152   MOUNT_ERROR_FATAL = 1 << 0,
153   MOUNT_ERROR_KEY_FAILURE = 1 << 1,
154   MOUNT_ERROR_MOUNT_POINT_BUSY = 1 << 2,
155   MOUNT_ERROR_TPM_COMM_ERROR = 1 << 3,
156   MOUNT_ERROR_TPM_DEFEND_LOCK = 1 << 4,
157   MOUNT_ERROR_USER_DOES_NOT_EXIST = 1 << 5,
158   MOUNT_ERROR_TPM_NEEDS_REBOOT = 1 << 6,
159   // Encrypted in old method, need migration before mounting.
160   MOUNT_ERROR_OLD_ENCRYPTION = 1 << 7,
161   // Previous migration attempt was aborted in the middle. Must resume it first.
162   MOUNT_ERROR_PREVIOUS_MIGRATION_INCOMPLETE = 1 << 8,
163   // The operation to remove a key failed.
164   MOUNT_ERROR_REMOVE_FAILED = 1 << 9,
165   MOUNT_ERROR_RECREATED = 1 << 31,
166 };
167 // Status code signaled from MigrateToDircrypto().
168 enum DircryptoMigrationStatus {
169   // 0 means a successful completion.
170   DIRCRYPTO_MIGRATION_SUCCESS = 0,
171   // Negative values mean failing completion.
172   // TODO(kinaba,dspaid): Add error codes as needed here.
173   DIRCRYPTO_MIGRATION_FAILED = -1,
174   // Positive values mean intermediate state report for the running migration.
175   // TODO(kinaba,dspaid): Add state codes as needed.
176   DIRCRYPTO_MIGRATION_INITIALIZING = 1,
177   DIRCRYPTO_MIGRATION_IN_PROGRESS = 2,
178 };
179 
180 // Interface for key delegate service to be used by the cryptohome daemon.
181 
182 const char kCryptohomeKeyDelegateInterface[] =
183     "org.chromium.CryptohomeKeyDelegateInterface";
184 
185 // Methods of the |kCryptohomeKeyDelegateInterface| interface:
186 const char kCryptohomeKeyDelegateChallengeKey[] = "ChallengeKey";
187 
188 }  // namespace cryptohome
189 
190 #endif  // SYSTEM_API_DBUS_CRYPTOHOME_DBUS_CONSTANTS_H_
191