Skip to content

Commit

Permalink
Prep ech types for python::boost binding
Browse files Browse the repository at this point in the history
Summary: Adds copy contructors to HpkeConfig and ECHContentConfigDraft for binding with python::boost

Reviewed By: mingtaoy

Differential Revision: D45656861

fbshipit-source-id: 0bcfd36196e952b78dc39ab2d572f6dfbbde70b9
  • Loading branch information
Nick Richardson authored and facebook-github-bot committed May 17, 2023
1 parent 64c6aca commit 8696781
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions third-party/fizz/src/fizz/protocol/ech/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,74 @@ struct HpkeKeyConfig {
hpke::KEMId kem_id;
HpkePublicKey public_key;
std::vector<HpkeSymmetricCipherSuite> cipher_suites;

HpkeKeyConfig() {}
HpkeKeyConfig(const HpkeKeyConfig& other) {
config_id = other.config_id;
kem_id = other.kem_id;
public_key = other.public_key->clone();
cipher_suites = other.cipher_suites;
}
HpkeKeyConfig(HpkeKeyConfig&& other) = default;
HpkeKeyConfig& operator=(const HpkeKeyConfig&& other) {
if (this != &other) {
config_id = other.config_id;
kem_id = other.kem_id;
public_key = other.public_key->clone();
cipher_suites = other.cipher_suites;
}
return *this;
}
HpkeKeyConfig& operator=(const HpkeKeyConfig& other) {
if (this != &other) {
config_id = other.config_id;
kem_id = other.kem_id;
public_key = other.public_key->clone();
cipher_suites = other.cipher_suites;
}
return *this;
}
};

struct ECHConfigContentDraft {
HpkeKeyConfig key_config;
uint8_t maximum_name_length;
Buf public_name;
std::vector<Extension> extensions;

ECHConfigContentDraft() {}
ECHConfigContentDraft(const ECHConfigContentDraft& other) {
key_config = other.key_config;
maximum_name_length = other.maximum_name_length;
public_name = other.public_name->clone();
extensions = std::vector<Extension>();
for (const auto& extension : other.extensions)
extensions.push_back(extension.clone());
}
ECHConfigContentDraft(ECHConfigContentDraft&& other) = default;
ECHConfigContentDraft& operator=(ECHConfigContentDraft&& other) {
if (this != &other) {
key_config = other.key_config;
maximum_name_length = other.maximum_name_length;
public_name = std::move(other.public_name);
extensions = std::vector<Extension>();
for (const auto& extension : other.extensions)
extensions.push_back(extension.clone());
}
return *this;
}

ECHConfigContentDraft& operator=(const ECHConfigContentDraft& other) {
if (this != &other) {
key_config = other.key_config;
maximum_name_length = other.maximum_name_length;
public_name = other.public_name->clone();
extensions = std::vector<Extension>();
for (const auto& extension : other.extensions)
extensions.push_back(extension.clone());
}
return *this;
}
};

struct ECHConfig {
Expand Down

0 comments on commit 8696781

Please sign in to comment.