Skip to content

Commit

Permalink
Generate passive client tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bifurcation committed Aug 1, 2023
1 parent 53bb7ea commit 8bfc3e6
Show file tree
Hide file tree
Showing 3 changed files with 470 additions and 2 deletions.
28 changes: 28 additions & 0 deletions lib/mls_vectors/include/mls_vectors/mls_vectors.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,22 @@ struct PseudoRandom
bytes secret(const std::string& label) const;
bytes generate(const std::string& label, size_t size) const;

bool boolean(const std::string& label) const;
uint16_t uint16(const std::string& label) const;
uint32_t uint32(const std::string& label) const;
uint64_t uint64(const std::string& label) const;

uint32_t rand(const std::string& label, uint32_t max) const;

mls::SignaturePrivateKey signature_key(const std::string& label) const;
mls::HPKEPrivateKey hpke_key(const std::string& label) const;

std::tuple<mls::HPKEPrivateKey,
mls::HPKEPrivateKey,
mls::SignaturePrivateKey,
mls::KeyPackage>
key_package(const std::string& label) const;

size_t output_length() const;

private:
Expand Down Expand Up @@ -530,6 +539,19 @@ struct MessagesTestVector : PseudoRandom

struct PassiveClientTestVector : PseudoRandom
{
enum struct Scenario : uint32_t
{
join_via_welcome,
join_via_welcome_external_tree,
handle_commit_public,
handle_commit_private,
handle_commit_by_reference,
handle_external_commit,
handle_100_random_commits,
};

static const std::vector<Scenario> all_scenarios;

struct PSK
{
bytes psk_id;
Expand All @@ -541,6 +563,8 @@ struct PassiveClientTestVector : PseudoRandom
std::vector<mls::MLSMessage> proposals;
mls::MLSMessage commit;
bytes epoch_authenticator;
bytes application_data;
mls::MLSMessage application_message;
};

mls::CipherSuite cipher_suite;
Expand All @@ -554,10 +578,14 @@ struct PassiveClientTestVector : PseudoRandom

mls::MLSMessage welcome;
std::optional<mls::TreeKEMPublicKey> ratchet_tree;

bytes initial_epoch_authenticator;
bytes initial_epoch_application_data;
mls::MLSMessage initial_epoch_application_message;

std::vector<Epoch> epochs;

PassiveClientTestVector(mls::CipherSuite suite, Scenario scenario);
PassiveClientTestVector() = default;
std::optional<std::string> verify();
};
Expand Down
Loading

0 comments on commit 8bfc3e6

Please sign in to comment.