#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "net/cert/ct_objects_extractor.h"
#include <string.h>
#include <string_view>
#include "base/hash/sha1.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "crypto/sha2.h"
#include "net/cert/asn1_util.h"
#include "net/cert/signed_certificate_timestamp.h"
#include "net/cert/x509_util.h"
#include "third_party/boringssl/src/include/openssl/bytestring.h"
#include "third_party/boringssl/src/include/openssl/mem.h"
namespace net::ct {
namespace {
const uint8_t kOCSPExtensionOid[] = …;
const uint8_t kOCSPBasicResponseOid[] = …;
const uint8_t kSHA1Oid[] = …;
const uint8_t kSHA256Oid[] = …;
bool StringEqualToCBS(const std::string& value1, const CBS* value2) { … }
bool SkipElements(CBS* cbs, int count) { … }
bool SkipOptionalElement(CBS* cbs, unsigned tag) { … }
bool CopyBefore(const CBS& outer, const CBS& inner, CBB* out) { … }
bool CopyAfter(const CBS& outer, const CBS& inner, CBB* out) { … }
bool SkipTBSCertificateToExtensions(CBS* tbs_cert) { … }
bool FindExtensionElement(const CBS& extensions,
const uint8_t* oid,
size_t oid_len,
CBS* out) { … }
bool ParseSCTListFromExtensions(const CBS& extensions,
const uint8_t* oid,
size_t oid_len,
std::string* out_sct_list) { … }
bool FindMatchingSingleResponse(CBS* responses,
const CRYPTO_BUFFER* issuer,
const std::string& cert_serial_number,
CBS* out_single_response) { … }
}
bool ExtractEmbeddedSCTList(const CRYPTO_BUFFER* cert, std::string* sct_list) { … }
bool GetPrecertSignedEntry(const CRYPTO_BUFFER* leaf,
const CRYPTO_BUFFER* issuer,
SignedEntryData* result) { … }
bool GetX509SignedEntry(const CRYPTO_BUFFER* leaf, SignedEntryData* result) { … }
bool ExtractSCTListFromOCSPResponse(const CRYPTO_BUFFER* issuer,
const std::string& cert_serial_number,
std::string_view ocsp_response,
std::string* sct_list) { … }
}