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

Side by Side 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: Rebase on ToT Created 5 years, 6 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 unified diff | Download patch
OLDNEW
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 SubresourceIntegrity_h 5 #ifndef SubresourceIntegrity_h
6 #define SubresourceIntegrity_h 6 #define SubresourceIntegrity_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "platform/Crypto.h" 9 #include "platform/Crypto.h"
10 10
(...skipping 16 matching lines...) Expand all
27 }; 27 };
28 28
29 static bool CheckSubresourceIntegrity(const Element&, const WTF::String& con tent, const KURL& resourceUrl, const Resource&); 29 static bool CheckSubresourceIntegrity(const Element&, const WTF::String& con tent, const KURL& resourceUrl, const Resource&);
30 30
31 private: 31 private:
32 // FIXME: After the merge with the Chromium repo, this should be refactored 32 // FIXME: After the merge with the Chromium repo, this should be refactored
33 // to use FRIEND_TEST in base/gtest_prod_util.h. 33 // to use FRIEND_TEST in base/gtest_prod_util.h.
34 friend class SubresourceIntegrityTest; 34 friend class SubresourceIntegrityTest;
35 friend class SubresourceIntegrityTest_Parsing_Test; 35 friend class SubresourceIntegrityTest_Parsing_Test;
36 friend class SubresourceIntegrityTest_ParseAlgorithm_Test; 36 friend class SubresourceIntegrityTest_ParseAlgorithm_Test;
37 friend class SubresourceIntegrityTest_Prioritization_Test;
37 38
38 enum AlgorithmParseResult { 39 enum AlgorithmParseResult {
39 AlgorithmValid, 40 AlgorithmValid,
40 AlgorithmUnparsable, 41 AlgorithmUnparsable,
41 AlgorithmUnknown 42 AlgorithmUnknown
42 }; 43 };
43 44
44 struct IntegrityMetadata { 45 struct IntegrityMetadata {
45 WTF::String digest; 46 WTF::String digest;
46 HashAlgorithm algorithm; 47 HashAlgorithm algorithm;
47 }; 48 };
48 49
50 static HashAlgorithm getPrioritizedHashFunction(HashAlgorithm, HashAlgorithm );
49 static AlgorithmParseResult parseAlgorithm(const UChar*& begin, const UChar* end, HashAlgorithm&); 51 static AlgorithmParseResult parseAlgorithm(const UChar*& begin, const UChar* end, HashAlgorithm&);
50 static bool parseDigest(const UChar*& begin, const UChar* end, String& diges t); 52 static bool parseDigest(const UChar*& begin, const UChar* end, String& diges t);
51 53
52 static IntegrityParseResult parseIntegrityAttribute(const WTF::String& attri bute, WTF::Vector<IntegrityMetadata>& metadataList, Document&); 54 static IntegrityParseResult parseIntegrityAttribute(const WTF::String& attri bute, WTF::Vector<IntegrityMetadata>& metadataList, Document&);
53 }; 55 };
54 56
55 } // namespace blink 57 } // namespace blink
56 58
57 #endif 59 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698