#include <stddef.h>
#include <stdint.h>
#include "base/test/gmock_expected_support.h"
#include "base/types/expected.h"
#include "components/webcrypto/algorithm_dispatch.h"
#include "components/webcrypto/algorithms/test_helpers.h"
#include "components/webcrypto/status.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/web_crypto_algorithm_params.h"
#include "third_party/blink/public/platform/web_crypto_key_algorithm.h"
namespace webcrypto {
namespace {
blink::WebCryptoAlgorithm CreateAesGcmAlgorithm(
const std::vector<uint8_t>& iv,
const std::vector<uint8_t>& additional_data,
unsigned int tag_length_bits) { … }
blink::WebCryptoAlgorithm CreateAesGcmKeyGenAlgorithm(
uint16_t key_length_bits) { … }
base::expected<std::vector<uint8_t>, Status> AesGcmEncrypt(
const blink::WebCryptoKey& key,
const std::vector<uint8_t>& iv,
const std::vector<uint8_t>& additional_data,
size_t tag_length_bits,
const std::vector<uint8_t>& plain_text) { … }
base::expected<std::vector<uint8_t>, Status> AesGcmDecrypt(
const blink::WebCryptoKey& key,
const std::vector<uint8_t>& iv,
const std::vector<uint8_t>& additional_data,
unsigned int tag_length_bits,
const std::vector<uint8_t>& ciphertext) { … }
class WebCryptoAesGcmTest : public WebCryptoTestBase { … };
TEST_F(WebCryptoAesGcmTest, GenerateKeyBadLength) { … }
TEST_F(WebCryptoAesGcmTest, GenerateKeyEmptyUsage) { … }
TEST_F(WebCryptoAesGcmTest, ImportExportJwk) { … }
struct AesGcmKnownAnswer { … };
const AesGcmKnownAnswer kAesGcmKnownAnswers[] = …;
TEST_F(WebCryptoAesGcmTest, KnownAnswers) { … }
}
}