#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "crypto/hmac.h"
#include <stddef.h>
#include <algorithm>
#include <string>
#include "base/check.h"
#include "base/check_op.h"
#include "base/notreached.h"
#include "base/stl_util.h"
#include "crypto/openssl_util.h"
#include "crypto/secure_util.h"
#include "crypto/symmetric_key.h"
#include "third_party/boringssl/src/include/openssl/hmac.h"
namespace crypto {
HMAC::HMAC(HashAlgorithm hash_alg) : … { … }
HMAC::~HMAC() { … }
size_t HMAC::DigestLength() const { … }
bool HMAC::Init(const unsigned char* key, size_t key_length) { … }
bool HMAC::Init(const SymmetricKey* key) { … }
bool HMAC::Sign(std::string_view data,
unsigned char* digest,
size_t digest_length) const { … }
bool HMAC::Sign(base::span<const uint8_t> data,
base::span<uint8_t> digest) const { … }
bool HMAC::Verify(std::string_view data, std::string_view digest) const { … }
bool HMAC::Verify(base::span<const uint8_t> data,
base::span<const uint8_t> digest) const { … }
bool HMAC::VerifyTruncated(std::string_view data,
std::string_view digest) const { … }
bool HMAC::VerifyTruncated(base::span<const uint8_t> data,
base::span<const uint8_t> digest) const { … }
}