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

Unified Diff: chrome/browser/policy/cloud/cloud_policy_validator.h

Issue 19733003: Implement cloud policy invalidations using the invalidation service framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 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: chrome/browser/policy/cloud/cloud_policy_validator.h
diff --git a/chrome/browser/policy/cloud/cloud_policy_validator.h b/chrome/browser/policy/cloud/cloud_policy_validator.h
index d53a0c6f91327664d10a157818a61085a7a542e0..9907dac9305fb66ca071e6b38c6c55f01c241432 100644
--- a/chrome/browser/policy/cloud/cloud_policy_validator.h
+++ b/chrome/browser/policy/cloud/cloud_policy_validator.h
@@ -101,6 +101,12 @@ class CloudPolicyValidatorBase {
return policy_data_;
}
+ // If ValidateHashValue() is called, the hash value of the policy value can
+ // be read with this method after completion has been signaled.
+ uint32 hash_value() const {
+ return hash_value_;
+ }
+
// Instructs the validator to check that the policy timestamp is not before
// |not_before| and not after |now| + grace interval. If
// |timestamp_option| is set to TIMESTAMP_REQUIRED, then the policy will fail
@@ -145,6 +151,10 @@ class CloudPolicyValidatorBase {
// check against.
void ValidateInitialKey();
+ // Causes the validator to calculate the hash value of the policy value.
+ // This can be used to determine if two policies are different.
+ void ValidateHashValue();
+
// Convenience helper that configures timestamp and token validation based on
// the current policy blob. |policy_data| may be NULL, in which case the
// timestamp validation will drop the lower bound. |dm_token_option|
@@ -182,6 +192,7 @@ class CloudPolicyValidatorBase {
VALIDATE_PAYLOAD = 1 << 6,
VALIDATE_SIGNATURE = 1 << 7,
VALIDATE_INITIAL_KEY = 1 << 8,
+ VALIDATE_HASH_VALUE = 1 << 9,
};
// Performs validation, called on a background thread.
@@ -207,6 +218,7 @@ class CloudPolicyValidatorBase {
Status CheckPayload();
Status CheckSignature();
Status CheckInitialKey();
+ Status CheckHashValue();
// Verifies the SHA1/RSA |signature| on |data| against |key|.
static bool VerifySignature(const std::string& data,
@@ -217,6 +229,7 @@ class CloudPolicyValidatorBase {
scoped_ptr<enterprise_management::PolicyFetchResponse> policy_;
scoped_ptr<enterprise_management::PolicyData> policy_data_;
google::protobuf::MessageLite* payload_;
+ uint32 hash_value_;
int validation_flags_;
int64 timestamp_not_before_;

Powered by Google App Engine
This is Rietveld 408576698