| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium 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 CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ | 5 #ifndef CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ |
| 6 #define CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ | 6 #define CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/scoped_vector.h" |
| 12 #include "chromeos/chromeos_export.h" | 14 #include "chromeos/chromeos_export.h" |
| 13 | 15 |
| 14 namespace cryptohome { | 16 namespace cryptohome { |
| 15 | 17 |
| 16 enum AuthKeyPrivileges { | 18 enum AuthKeyPrivileges { |
| 17 PRIV_MOUNT = 1 << 0, // Can mount with this key. | 19 PRIV_MOUNT = 1 << 0, // Can mount with this key. |
| 18 PRIV_ADD = 1 << 1, // Can add new keys. | 20 PRIV_ADD = 1 << 1, // Can add new keys. |
| 19 PRIV_REMOVE = 1 << 2, // Can remove other keys. | 21 PRIV_REMOVE = 1 << 2, // Can remove other keys. |
| 20 PRIV_MIGRATE = 1 << 3, // Destroy all keys and replace with new. | 22 PRIV_MIGRATE = 1 << 3, // Destroy all keys and replace with new. |
| 21 PRIV_AUTHORIZED_UPDATE = 1 << 4, // Key can be updated in place. | 23 PRIV_AUTHORIZED_UPDATE = 1 << 4, // Key can be updated in place. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 struct CHROMEOS_EXPORT Authorization { | 59 struct CHROMEOS_EXPORT Authorization { |
| 58 Authorization(const std::string& key, const std::string& label); | 60 Authorization(const std::string& key, const std::string& label); |
| 59 explicit Authorization(const KeyDefinition& key); | 61 explicit Authorization(const KeyDefinition& key); |
| 60 | 62 |
| 61 bool operator==(const Authorization& other) const; | 63 bool operator==(const Authorization& other) const; |
| 62 | 64 |
| 63 std::string key; | 65 std::string key; |
| 64 std::string label; | 66 std::string label; |
| 65 }; | 67 }; |
| 66 | 68 |
| 69 // Information about keys returned by GetKeyDataEx(). |
| 70 struct CHROMEOS_EXPORT RetrievedKeyData { |
| 71 enum Type { |
| 72 TYPE_PASSWORD = 0 |
| 73 }; |
| 74 |
| 75 enum AuthorizationType { |
| 76 AUTHORIZATION_TYPE_HMACSHA256 = 0, |
| 77 AUTHORIZATION_TYPE_AES256CBC_HMACSHA256 |
| 78 }; |
| 79 |
| 80 struct ProviderData { |
| 81 explicit ProviderData(const std::string& name); |
| 82 ~ProviderData(); |
| 83 |
| 84 std::string name; |
| 85 scoped_ptr<int64> number; |
| 86 scoped_ptr<std::string> bytes; |
| 87 }; |
| 88 |
| 89 RetrievedKeyData(Type type, const std::string& label, int64 revision); |
| 90 ~RetrievedKeyData(); |
| 91 |
| 92 Type type; |
| 93 std::string label; |
| 94 // Privileges associated with key. Combination of |AuthKeyPrivileges| values. |
| 95 int privileges; |
| 96 int64 revision; |
| 97 std::vector<AuthorizationType> authorization_types; |
| 98 ScopedVector<ProviderData> provider_data; |
| 99 }; |
| 100 |
| 67 // Parameters for Mount call. | 101 // Parameters for Mount call. |
| 68 class CHROMEOS_EXPORT MountParameters { | 102 class CHROMEOS_EXPORT MountParameters { |
| 69 public: | 103 public: |
| 70 explicit MountParameters(bool ephemeral); | 104 explicit MountParameters(bool ephemeral); |
| 71 ~MountParameters(); | 105 ~MountParameters(); |
| 72 | 106 |
| 73 bool operator==(const MountParameters& other) const; | 107 bool operator==(const MountParameters& other) const; |
| 74 | 108 |
| 75 // If |true|, the mounted home dir will be backed by tmpfs. If |false|, the | 109 // If |true|, the mounted home dir will be backed by tmpfs. If |false|, the |
| 76 // ephemeral users policy decides whether tmpfs or an encrypted directory is | 110 // ephemeral users policy decides whether tmpfs or an encrypted directory is |
| 77 // used as the backend. | 111 // used as the backend. |
| 78 bool ephemeral; | 112 bool ephemeral; |
| 79 | 113 |
| 80 // If not empty, home dir will be created with these keys if it exist. | 114 // If not empty, home dir will be created with these keys if it exist. |
| 81 std::vector<KeyDefinition> create_keys; | 115 std::vector<KeyDefinition> create_keys; |
| 82 }; | 116 }; |
| 83 | 117 |
| 84 } // namespace cryptohome | 118 } // namespace cryptohome |
| 85 | 119 |
| 86 #endif // CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ | 120 #endif // CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ |
| OLD | NEW |