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 #include "core/frame/SubresourceIntegrity.h" | 5 #include "core/frame/SubresourceIntegrity.h" |
6 | 6 |
7 #include "core/HTMLNames.h" | 7 #include "core/HTMLNames.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
10 #include "core/dom/ExecutionContext.h" | 10 #include "core/dom/ExecutionContext.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 break; | 83 break; |
84 case kHashAlgorithmSha384: | 84 case kHashAlgorithmSha384: |
85 weaker_algorithms = kWeakerThanSha384; | 85 weaker_algorithms = kWeakerThanSha384; |
86 length = WTF_ARRAY_LENGTH(kWeakerThanSha384); | 86 length = WTF_ARRAY_LENGTH(kWeakerThanSha384); |
87 break; | 87 break; |
88 case kHashAlgorithmSha512: | 88 case kHashAlgorithmSha512: |
89 weaker_algorithms = kWeakerThanSha512; | 89 weaker_algorithms = kWeakerThanSha512; |
90 length = WTF_ARRAY_LENGTH(kWeakerThanSha512); | 90 length = WTF_ARRAY_LENGTH(kWeakerThanSha512); |
91 break; | 91 break; |
92 default: | 92 default: |
93 ASSERT_NOT_REACHED(); | 93 NOTREACHED(); |
94 }; | 94 }; |
95 | 95 |
96 for (size_t i = 0; i < length; i++) { | 96 for (size_t i = 0; i < length; i++) { |
97 if (weaker_algorithms[i] == algorithm2) | 97 if (weaker_algorithms[i] == algorithm2) |
98 return algorithm1; | 98 return algorithm1; |
99 } | 99 } |
100 | 100 |
101 return algorithm2; | 101 return algorithm2; |
102 } | 102 } |
103 | 103 |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 metadata_set.insert(integrity_metadata.ToPair()); | 417 metadata_set.insert(integrity_metadata.ToPair()); |
418 } | 418 } |
419 | 419 |
420 if (metadata_set.size() == 0 && error) | 420 if (metadata_set.size() == 0 && error) |
421 return kIntegrityParseNoValidResult; | 421 return kIntegrityParseNoValidResult; |
422 | 422 |
423 return kIntegrityParseValidResult; | 423 return kIntegrityParseValidResult; |
424 } | 424 } |
425 | 425 |
426 } // namespace blink | 426 } // namespace blink |
OLD | NEW |