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

Unified Diff: chromeos/cryptohome/cryptohome_parameters.h

Issue 526353002: Merge cryptohome::RetrievedKeyData with cryptohome::KeyDefinition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@d_2_367847_add_get_key_data_ex_to_mount_flow
Patch Set: Created 6 years, 3 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: chromeos/cryptohome/cryptohome_parameters.h
diff --git a/chromeos/cryptohome/cryptohome_parameters.h b/chromeos/cryptohome/cryptohome_parameters.h
index fe43f2c21a8d05969c87c3d60db0348d512d6e55..18ca32a7a62cdad01b9e489df46302f8fddf519f 100644
--- a/chromeos/cryptohome/cryptohome_parameters.h
+++ b/chromeos/cryptohome/cryptohome_parameters.h
@@ -10,7 +10,6 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
-#include "base/memory/scoped_vector.h"
#include "chromeos/chromeos_export.h"
namespace cryptohome {
@@ -37,65 +36,85 @@ struct CHROMEOS_EXPORT Identification {
// It contains authorization data along with extra parameters like perimissions
Darren Krahn 2014/09/02 18:21:53 old code nit: perimissions -> permissions
bartfab (slow) 2014/09/04 10:14:18 Done.
// associated with this key.
struct CHROMEOS_EXPORT KeyDefinition {
- KeyDefinition(const std::string& key,
- const std::string& label,
- int /*AuthKeyPrivileges*/ privileges);
- ~KeyDefinition();
-
- bool operator==(const KeyDefinition& other) const;
-
- std::string label;
+ enum Type {
+ TYPE_PASSWORD = 0
+ };
- int revision;
- std::string key;
+ struct AuthorizationData {
Darren Krahn 2014/09/02 18:21:53 IMO, this is under-documented in the protobuf and
bartfab (slow) 2014/09/04 10:14:18 Unfortunately, I do not understand it either. I se
Darren Krahn 2014/09/04 23:13:23 I shared the closest doc I could find. My understa
bartfab (slow) 2014/09/15 12:04:44 I cannot find any doc shared with me on that day.
+ enum Type {
+ TYPE_HMACSHA256 = 0,
+ TYPE_AES256CBC_HMACSHA256
+ };
- std::string encryption_key;
- std::string signature_key;
- // Privileges associated with key. Combination of |AuthKeyPrivileges| values.
- int privileges;
-};
+ struct Secret {
+ Secret(bool encrypt,
Darren Krahn 2014/09/02 18:21:53 A constructor for the way we typically use this wo
bartfab (slow) 2014/09/04 10:14:18 Our typical use actuall always needs at least |enc
+ bool sign,
+ const std::string& symmetric_key,
+ const std::string& public_key,
+ bool wrapped);
-// Authorization attempt data for user.
-struct CHROMEOS_EXPORT Authorization {
- Authorization(const std::string& key, const std::string& label);
- explicit Authorization(const KeyDefinition& key);
+ bool operator==(const Secret& other) const;
- bool operator==(const Authorization& other) const;
+ bool encrypt;
+ bool sign;
+ std::string symmetric_key;
+ std::string public_key;
+ bool wrapped;
+ };
- std::string key;
- std::string label;
-};
+ AuthorizationData();
Darren Krahn 2014/09/02 18:21:53 Same here, a typical usage constructor would be ni
bartfab (slow) 2014/09/04 10:14:18 Done.
+ ~AuthorizationData();
-// Information about keys returned by GetKeyDataEx().
-struct CHROMEOS_EXPORT RetrievedKeyData {
- enum Type {
- TYPE_PASSWORD = 0
- };
+ bool operator==(const AuthorizationData& other) const;
- enum AuthorizationType {
- AUTHORIZATION_TYPE_HMACSHA256 = 0,
- AUTHORIZATION_TYPE_AES256CBC_HMACSHA256
+ Type type;
+ std::vector<Secret> secrets;
};
struct ProviderData {
Darren Krahn 2014/09/02 18:21:53 Same here -- a bit of documentation would be great
bartfab (slow) 2014/09/04 10:14:18 Done.
explicit ProviderData(const std::string& name);
+ explicit ProviderData(const ProviderData& other);
+ void operator=(const ProviderData& other);
~ProviderData();
+ bool operator==(const ProviderData& other) const;
+
std::string name;
scoped_ptr<int64> number;
scoped_ptr<std::string> bytes;
};
- RetrievedKeyData(Type type, const std::string& label, int64 revision);
- ~RetrievedKeyData();
+ KeyDefinition(const std::string& secret,
+ const std::string& label,
+ int privileges);
Darren Krahn 2014/09/02 18:21:53 [optional] Default constructor here too? It just s
bartfab (slow) 2014/09/04 10:14:18 Done.
+ ~KeyDefinition();
+
+ bool operator==(const KeyDefinition& other) const;
+
+ void AddSymmetricKey(bool encrypt,
Darren Krahn 2014/09/02 18:21:53 It's not clear what this method does -- would it b
bartfab (slow) 2014/09/04 10:14:18 I removed the method as AuthorizationData() has a
Darren Krahn 2014/09/04 23:13:23 Ok, I guess they are just future-proofing, current
+ bool sign,
+ const std::string& symmetric_key);
Type type;
std::string label;
// Privileges associated with key. Combination of |AuthKeyPrivileges| values.
int privileges;
- int64 revision;
- std::vector<AuthorizationType> authorization_types;
- ScopedVector<ProviderData> provider_data;
+ int revision;
+ std::string secret;
+
+ std::vector<AuthorizationData> authorization_data;
+ std::vector<ProviderData> provider_data;
+};
+
+// Authorization attempt data for user.
+struct CHROMEOS_EXPORT Authorization {
+ Authorization(const std::string& key, const std::string& label);
+ explicit Authorization(const KeyDefinition& key);
+
+ bool operator==(const Authorization& other) const;
+
+ std::string key;
+ std::string label;
};
// Parameters for Mount call.

Powered by Google App Engine
This is Rietveld 408576698