| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/frame/SubresourceIntegrity.h" | 6 #include "core/frame/SubresourceIntegrity.h" |
| 7 | 7 |
| 8 #include "core/HTMLNames.h" | 8 #include "core/HTMLNames.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/dom/Element.h" | 10 #include "core/dom/Element.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 if (algorithm1 == algorithm2) | 76 if (algorithm1 == algorithm2) |
| 77 return algorithm1; | 77 return algorithm1; |
| 78 | 78 |
| 79 const HashAlgorithm* weakerAlgorithms = 0; | 79 const HashAlgorithm* weakerAlgorithms = 0; |
| 80 size_t length = 0; | 80 size_t length = 0; |
| 81 switch (algorithm1) { | 81 switch (algorithm1) { |
| 82 case HashAlgorithmSha256: | 82 case HashAlgorithmSha256: |
| 83 break; | 83 break; |
| 84 case HashAlgorithmSha384: | 84 case HashAlgorithmSha384: |
| 85 weakerAlgorithms = weakerThanSha384; | 85 weakerAlgorithms = weakerThanSha384; |
| 86 length = ARRAY_SIZE(weakerThanSha384); | 86 length = WTF_ARRAY_LENGTH(weakerThanSha384); |
| 87 break; | 87 break; |
| 88 case HashAlgorithmSha512: | 88 case HashAlgorithmSha512: |
| 89 weakerAlgorithms = weakerThanSha512; | 89 weakerAlgorithms = weakerThanSha512; |
| 90 length = ARRAY_SIZE(weakerThanSha512); | 90 length = WTF_ARRAY_LENGTH(weakerThanSha512); |
| 91 break; | 91 break; |
| 92 default: | 92 default: |
| 93 ASSERT_NOT_REACHED(); | 93 ASSERT_NOT_REACHED(); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 for (size_t i = 0; i < length; i++) { | 96 for (size_t i = 0; i < length; i++) { |
| 97 if (weakerAlgorithms[i] == algorithm2) | 97 if (weakerAlgorithms[i] == algorithm2) |
| 98 return algorithm1; | 98 return algorithm1; |
| 99 } | 99 } |
| 100 | 100 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 metadataSet.add(integrityMetadata.toPair()); | 352 metadataSet.add(integrityMetadata.toPair()); |
| 353 } | 353 } |
| 354 | 354 |
| 355 if (metadataSet.size() == 0 && error) | 355 if (metadataSet.size() == 0 && error) |
| 356 return IntegrityParseNoValidResult; | 356 return IntegrityParseNoValidResult; |
| 357 | 357 |
| 358 return IntegrityParseValidResult; | 358 return IntegrityParseValidResult; |
| 359 } | 359 } |
| 360 | 360 |
| 361 } // namespace blink | 361 } // namespace blink |
| OLD | NEW |