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

Unified Diff: Source/core/frame/SubresourceIntegrity.h

Issue 1156413005: Implement hash function prioritization for SRI. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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: Source/core/frame/SubresourceIntegrity.h
diff --git a/Source/core/frame/SubresourceIntegrity.h b/Source/core/frame/SubresourceIntegrity.h
index 6fdf17f710bd508b859e721140a8709bc3d6e6f6..d81363ec729f37202f01586963c3188bd2926f1d 100644
--- a/Source/core/frame/SubresourceIntegrity.h
+++ b/Source/core/frame/SubresourceIntegrity.h
@@ -34,6 +34,7 @@ private:
friend class SubresourceIntegrityTest;
friend class SubresourceIntegrityTest_Parsing_Test;
friend class SubresourceIntegrityTest_ParseAlgorithm_Test;
+ friend class SubresourceIntegrityTest_Prioritization_Test;
enum AlgorithmParseResult {
AlgorithmValid,
@@ -41,11 +42,18 @@ private:
AlgorithmUnknown
};
+ enum PrioritizationResult {
+ SameStrength,
+ FirstAlgorithmIsStronger,
+ SecondAlgorithmIsStronger
+ };
+
struct IntegrityMetadata {
WTF::String digest;
HashAlgorithm algorithm;
};
+ static PrioritizationResult getPrioritizedHashFunction(HashAlgorithm, HashAlgorithm);
Mike West 2015/06/03 09:13:33 Why not return the stronger `HashAlgorithm`? The "
jww 2015/06/03 19:26:56 See other comments for details, but I've changed i
static AlgorithmParseResult parseAlgorithm(const UChar*& begin, const UChar* end, HashAlgorithm&);
static bool parseDigest(const UChar*& begin, const UChar* end, String& digest);

Powered by Google App Engine
This is Rietveld 408576698