#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/platform/loader/subresource_integrity.h"
#include "services/network/public/mojom/fetch_api.mojom-blink.h"
#include "third_party/blink/public/platform/web_crypto.h"
#include "third_party/blink/public/platform/web_crypto_algorithm.h"
#include "third_party/blink/renderer/platform/crypto.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/text/ascii_ctype.h"
#include "third_party/blink/renderer/platform/wtf/text/base64.h"
#include "third_party/blink/renderer/platform/wtf/text/parsing_utilities.h"
#include "third_party/blink/renderer/platform/wtf/text/string_utf8_adaptor.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink {
static bool IsIntegrityCharacter(UChar c) { … }
static bool IsValueCharacter(UChar c) { … }
static bool DigestsEqual(const DigestValue& digest1,
const DigestValue& digest2) { … }
void SubresourceIntegrity::ReportInfo::AddUseCount(UseCounterFeature feature) { … }
void SubresourceIntegrity::ReportInfo::AddConsoleErrorMessage(
const String& message) { … }
void SubresourceIntegrity::ReportInfo::Clear() { … }
bool SubresourceIntegrity::CheckSubresourceIntegrity(
const IntegrityMetadataSet& metadata_set,
const SegmentedBuffer* buffer,
const KURL& resource_url,
const Resource& resource,
ReportInfo& report_info) { … }
bool SubresourceIntegrity::CheckSubresourceIntegrity(
const String& integrity_metadata,
IntegrityFeatures features,
const SegmentedBuffer* buffer,
const KURL& resource_url,
ReportInfo& report_info) { … }
String IntegrityAlgorithmToString(IntegrityAlgorithm algorithm) { … }
blink::HashAlgorithm IntegrityAlgorithmToHashAlgorithm(
IntegrityAlgorithm algorithm) { … }
bool SubresourceIntegrity::CheckSubresourceIntegrityImpl(
const IntegrityMetadataSet& metadata_set,
const SegmentedBuffer* buffer,
const KURL& resource_url,
ReportInfo& report_info) { … }
IntegrityAlgorithm SubresourceIntegrity::FindBestAlgorithm(
const IntegrityMetadataSet& metadata_set) { … }
bool SubresourceIntegrity::CheckSubresourceIntegrityDigest(
const IntegrityMetadata& metadata,
const SegmentedBuffer* buffer) { … }
SubresourceIntegrity::AlgorithmParseResult
SubresourceIntegrity::ParseAttributeAlgorithm(const UChar*& begin,
const UChar* end,
IntegrityFeatures features,
IntegrityAlgorithm& algorithm) { … }
SubresourceIntegrity::AlgorithmParseResult
SubresourceIntegrity::ParseAlgorithmPrefix(
const UChar*& string_position,
const UChar* string_end,
const AlgorithmPrefixPair* prefix_table,
size_t prefix_table_size,
IntegrityAlgorithm& algorithm) { … }
bool SubresourceIntegrity::ParseDigest(const UChar*& position,
const UChar* end,
String& digest) { … }
void SubresourceIntegrity::ParseIntegrityAttribute(
const WTF::String& attribute,
IntegrityFeatures features,
IntegrityMetadataSet& metadata_set) { … }
void SubresourceIntegrity::ParseIntegrityAttribute(
const WTF::String& attribute,
IntegrityFeatures features,
IntegrityMetadataSet& metadata_set,
ReportInfo* report_info) { … }
}