| 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 <stdint.h> |
| 9 |
| 8 #include <string> | 10 #include <string> |
| 9 #include <vector> | 11 #include <vector> |
| 10 | 12 |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "chromeos/chromeos_export.h" | 14 #include "chromeos/chromeos_export.h" |
| 14 | 15 |
| 15 namespace cryptohome { | 16 namespace cryptohome { |
| 16 | 17 |
| 17 enum AuthKeyPrivileges { | 18 enum AuthKeyPrivileges { |
| 18 PRIV_MOUNT = 1 << 0, // Can mount with this key. | 19 PRIV_MOUNT = 1 << 0, // Can mount with this key. |
| 19 PRIV_ADD = 1 << 1, // Can add new keys. | 20 PRIV_ADD = 1 << 1, // Can add new keys. |
| 20 PRIV_REMOVE = 1 << 2, // Can remove other keys. | 21 PRIV_REMOVE = 1 << 2, // Can remove other keys. |
| 21 PRIV_MIGRATE = 1 << 3, // Destroy all keys and replace with new. | 22 PRIV_MIGRATE = 1 << 3, // Destroy all keys and replace with new. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // This struct holds metadata that will be stored alongside the key. Each | 79 // This struct holds metadata that will be stored alongside the key. Each |
| 79 // |ProviderData| entry must have a |name| and may hold either a |number| or a | 80 // |ProviderData| entry must have a |name| and may hold either a |number| or a |
| 80 // sequence of |bytes|. The metadata is entirely opaque to cryptohome. It is | 81 // sequence of |bytes|. The metadata is entirely opaque to cryptohome. It is |
| 81 // stored with the key and returned when requested but is never interpreted by | 82 // stored with the key and returned when requested but is never interpreted by |
| 82 // cryptohome in any way. The metadata can be used to store information such | 83 // cryptohome in any way. The metadata can be used to store information such |
| 83 // as the hashing algorithm and the salt used to create the key. | 84 // as the hashing algorithm and the salt used to create the key. |
| 84 struct ProviderData { | 85 struct ProviderData { |
| 85 ProviderData(); | 86 ProviderData(); |
| 86 explicit ProviderData(const std::string& name); | 87 explicit ProviderData(const std::string& name); |
| 87 explicit ProviderData(const ProviderData& other); | 88 explicit ProviderData(const ProviderData& other); |
| 88 ProviderData(const std::string& name, int64 number); | 89 ProviderData(const std::string& name, int64_t number); |
| 89 ProviderData(const std::string& name, const std::string& bytes); | 90 ProviderData(const std::string& name, const std::string& bytes); |
| 90 void operator=(const ProviderData& other); | 91 void operator=(const ProviderData& other); |
| 91 ~ProviderData(); | 92 ~ProviderData(); |
| 92 | 93 |
| 93 bool operator==(const ProviderData& other) const; | 94 bool operator==(const ProviderData& other) const; |
| 94 | 95 |
| 95 std::string name; | 96 std::string name; |
| 96 scoped_ptr<int64> number; | 97 scoped_ptr<int64_t> number; |
| 97 scoped_ptr<std::string> bytes; | 98 scoped_ptr<std::string> bytes; |
| 98 }; | 99 }; |
| 99 | 100 |
| 100 KeyDefinition(); | 101 KeyDefinition(); |
| 101 KeyDefinition(const std::string& secret, | 102 KeyDefinition(const std::string& secret, |
| 102 const std::string& label, | 103 const std::string& label, |
| 103 int privileges); | 104 int privileges); |
| 104 ~KeyDefinition(); | 105 ~KeyDefinition(); |
| 105 | 106 |
| 106 bool operator==(const KeyDefinition& other) const; | 107 bool operator==(const KeyDefinition& other) const; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // used as the backend. | 141 // used as the backend. |
| 141 bool ephemeral; | 142 bool ephemeral; |
| 142 | 143 |
| 143 // If not empty, home dir will be created with these keys if it exist. | 144 // If not empty, home dir will be created with these keys if it exist. |
| 144 std::vector<KeyDefinition> create_keys; | 145 std::vector<KeyDefinition> create_keys; |
| 145 }; | 146 }; |
| 146 | 147 |
| 147 } // namespace cryptohome | 148 } // namespace cryptohome |
| 148 | 149 |
| 149 #endif // CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ | 150 #endif // CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ |
| OLD | NEW |