#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <algorithm>
#include <limits>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include <gtest/gtest.h>
#include <openssl/bytestring.h>
#include <openssl/curve25519.h>
#include <openssl/evp.h>
#include <openssl/mem.h>
#include <openssl/rand.h>
#include <openssl/sha.h>
#include <openssl/trust_token.h>
#include "../ec_extra/internal.h"
#include "../fipsmodule/ec/internal.h"
#include "../internal.h"
#include "../test/test_util.h"
#include "internal.h"
BSSL_NAMESPACE_BEGIN
namespace {
const uint8_t kMessage[] = …;
TEST(TrustTokenTest, KeyGenExp1) { … }
TEST(TrustTokenTest, KeyGenExp2VOPRF) { … }
TEST(TrustTokenTest, KeyGenExp2PMB) { … }
TEST(TrustTokenTest, HExp1) { … }
TEST(TrustTokenTest, HExp2) { … }
TEST(TrustTokenTest, HPST1) { … }
static int ec_point_uncompressed_from_compressed(
const EC_GROUP *group, uint8_t out[EC_MAX_UNCOMPRESSED], size_t *out_len,
const uint8_t *in, size_t len) { … }
static bool setup_voprf_test_key(const EC_GROUP *group,
TRUST_TOKEN_ISSUER_KEY *out) { … }
TEST(TrustTokenTest, PSTV1VOPRFTestVector1) { … }
TEST(TrustTokenTest, PSTV1VOPRFTestVector2) { … }
TEST(TrustTokenTest, PSTV1VOPRFTestVector3) { … }
static std::vector<const TRUST_TOKEN_METHOD *> AllMethods() { … }
class TrustTokenProtocolTestBase : public ::testing::Test { … };
class TrustTokenProtocolTest
: public TrustTokenProtocolTestBase,
public testing::WithParamInterface<
std::tuple<const TRUST_TOKEN_METHOD *, bool>> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(TrustTokenProtocolTest, InvalidToken) { … }
TEST_P(TrustTokenProtocolTest, TruncatedIssuanceRequest) { … }
TEST_P(TrustTokenProtocolTest, TruncatedIssuanceResponse) { … }
TEST_P(TrustTokenProtocolTest, ExtraDataIssuanceResponse) { … }
TEST_P(TrustTokenProtocolTest, TruncatedRedemptionRequest) { … }
TEST_P(TrustTokenProtocolTest, IssuedWithBadKeyID) { … }
class TrustTokenMetadataTest
: public TrustTokenProtocolTestBase,
public testing::WithParamInterface<
std::tuple<const TRUST_TOKEN_METHOD *, bool, int, bool>> { … };
TEST_P(TrustTokenMetadataTest, SetAndGetMetadata) { … }
TEST_P(TrustTokenMetadataTest, TooManyRequests) { … }
TEST_P(TrustTokenMetadataTest, TruncatedProof) { … }
TEST_P(TrustTokenMetadataTest, ExcessDataProof) { … }
INSTANTIATE_TEST_SUITE_P(…);
class TrustTokenBadKeyTest
: public TrustTokenProtocolTestBase,
public testing::WithParamInterface<
std::tuple<const TRUST_TOKEN_METHOD *, bool, bool, int>> { … };
TEST_P(TrustTokenBadKeyTest, BadKey) { … }
INSTANTIATE_TEST_SUITE_P(…);
}
BSSL_NAMESPACE_END