Debian Codegraph @

mlspp/include/mls/state.h

raw symbols SCIP
1 #cxx . . $ `<file>/mlspp/include/mls/state.h`/pragma once
2
3 #include "mls/crypto.h"cxx . . $ `<file>/mlspp/include/mls/crypto.h`/
4 #include "mls/key_schedule.h"cxx . . $ `<file>/mlspp/include/mls/key_schedule.h`/
5 #include "mls/messages.h"cxx . . $ `<file>/mlspp/include/mls/messages.h`/
6 #include "mls/treekem.h"cxx . . $ `<file>/mlspp/include/mls/treekem.h`/
7 #include <list>
8 #include <optional>
9 #include <vector>
10
11 namespace mlsppcxx . . $ mlspp/ {
12
13 // Index into the session roster
14 struct RosterIndexcxx . . $ mlspp/RosterIndex# : public UInt32cxx . . $ mlspp/UInt32#
15 {
16 using UInt32cxx . . $ mlspp/UInt32#::UInt32cxx . . $ mlspp/UInt32#;
17 };
18
19 struct CommitOptscxx . . $ mlspp/CommitOpts#
20 {
21 stdcxx . . $ std/::vectorcxx . . $ std/vector#<Proposalcxx . . $ mlspp/Proposal#> extra_proposalscxx . . $ mlspp/CommitOpts#extra_proposals.;
22 bool inline_treecxx . . $ mlspp/CommitOpts#inline_tree.;
23 bool force_pathcxx . . $ mlspp/CommitOpts#force_path.;
24 LeafNodeOptionscxx . . $ mlspp/LeafNodeOptions# leaf_node_optscxx . . $ mlspp/CommitOpts#leaf_node_opts.;
25 };
26
27 struct MessageOptscxx . . $ mlspp/MessageOpts#
28 {
29 bool encryptcxx . . $ mlspp/MessageOpts#encrypt. = false;
30 bytescxx . . $ mlspp/bytes_ns/bytes# authenticated_datacxx . . $ mlspp/MessageOpts#authenticated_data.;
31 size_t padding_sizecxx . . $ mlspp/MessageOpts#padding_size. = 0;
32 };
33
34 class Statecxx . . $ mlspp/State#
35 {
36 public:
37 ///
38 /// Constructors
39 ///
40
41 // Initialize an empty group
42 Statecxx . . $ mlspp/State#State(5c99977e15e97b35).(bytescxx . . $ mlspp/bytes_ns/bytes# group_id,
43 CipherSuitecxx . . $ mlspp/CipherSuite# suite,
44 HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey# enc_priv,
45 SignaturePrivateKeycxx . . $ mlspp/SignaturePrivateKey# sig_priv,
46 const LeafNodecxx . . $ mlspp/LeafNode#& leaf_node,
47 ExtensionListcxx . . $ mlspp/ExtensionList# extensions);
48
49 // Initialize a group from a Welcome
50 Statecxx . . $ mlspp/State#State(b37a46165eb9ffa8).(const HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey#& init_priv,
51 HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey# leaf_priv,
52 SignaturePrivateKeycxx . . $ mlspp/SignaturePrivateKey# sig_priv,
53 const KeyPackagecxx . . $ mlspp/KeyPackage#& key_package,
54 const Welcomecxx . . $ mlspp/Welcome#& welcome,
55 const stdcxx . . $ std/::optionalcxx . . $ std/optional#<TreeKEMPublicKeycxx . . $ mlspp/TreeKEMPublicKey#>& tree,
56 stdcxx . . $ std/::mapcxx . . $ std/map#<bytescxx . . $ mlspp/bytes_ns/bytes#, bytescxx . . $ mlspp/bytes_ns/bytes#> psks);
57
58 // Join a group from outside
59 // XXX(RLB) To be fully general, we would need a few more options here, e.g.,
60 // whether to include PSKs or evict our prior appearance.
61 static stdcxx . . $ std/::tuplecxx . . $ std/tuple#<MLSMessagecxx . . $ mlspp/MLSMessage#, Statecxx . . $ mlspp/State#> external_joincxx . . $ mlspp/State#external_join(143e8da8d52ca271).(
62 const bytescxx . . $ mlspp/bytes_ns/bytes#& leaf_secret,
63 SignaturePrivateKeycxx . . $ mlspp/SignaturePrivateKey# sig_priv,
64 const KeyPackagecxx . . $ mlspp/KeyPackage#& key_package,
65 const GroupInfocxx . . $ mlspp/GroupInfo#& group_info,
66 const stdcxx . . $ std/::optionalcxx . . $ std/optional#<TreeKEMPublicKeycxx . . $ mlspp/TreeKEMPublicKey#>& tree,
67 const MessageOptscxx . . $ mlspp/MessageOpts#& msg_opts,
68 stdcxx . . $ std/::optionalcxx . . $ std/optional#<LeafIndexcxx . . $ mlspp/LeafIndex#> remove_prior,
69 const stdcxx . . $ std/::mapcxx . . $ std/map#<bytescxx . . $ mlspp/bytes_ns/bytes#, bytescxx . . $ mlspp/bytes_ns/bytes#>& psks);
70
71 // Propose that a new member be added a group
72 static MLSMessagecxx . . $ mlspp/MLSMessage# new_member_addcxx . . $ mlspp/State#new_member_add(edcdd2b1eae1b9c0).(const bytescxx . . $ mlspp/bytes_ns/bytes#& group_id,
73 epoch_tcxx . . $ mlspp/epoch_t# epoch,
74 const KeyPackagecxx . . $ mlspp/KeyPackage#& new_member,
75 const SignaturePrivateKeycxx . . $ mlspp/SignaturePrivateKey#& sig_priv);
76
77 ///
78 /// Message factories
79 ///
80
81 Proposalcxx . . $ mlspp/Proposal# add_proposalcxx . . $ mlspp/State#add_proposal(e4fd0120844a75d9).(const KeyPackagecxx . . $ mlspp/KeyPackage#& key_package) const;
82 Proposalcxx . . $ mlspp/Proposal# update_proposalcxx . . $ mlspp/State#update_proposal(6da03f4c1f0a7f2f).(HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey# leaf_priv,
83 const LeafNodeOptionscxx . . $ mlspp/LeafNodeOptions#& opts);
84 Proposalcxx . . $ mlspp/Proposal# remove_proposalcxx . . $ mlspp/State#remove_proposal(c2ef5639e2e3f0d6).(RosterIndexcxx . . $ mlspp/RosterIndex# index) const;
85 Proposalcxx . . $ mlspp/Proposal# remove_proposalcxx . . $ mlspp/State#remove_proposal(edc3c171b293f4e4).(LeafIndexcxx . . $ mlspp/LeafIndex# removed) const;
86 Proposalcxx . . $ mlspp/Proposal# group_context_extensions_proposalcxx . . $ mlspp/State#group_context_extensions_proposal(ce238ee285b81a55).(ExtensionListcxx . . $ mlspp/ExtensionList# exts) const;
87 Proposalcxx . . $ mlspp/Proposal# pre_shared_key_proposalcxx . . $ mlspp/State#pre_shared_key_proposal(e132d434992eff30).(const bytescxx . . $ mlspp/bytes_ns/bytes#& external_psk_id) const;
88 Proposalcxx . . $ mlspp/Proposal# pre_shared_key_proposalcxx . . $ mlspp/State#pre_shared_key_proposal(bde2bcef59e4f9b9).(const bytescxx . . $ mlspp/bytes_ns/bytes#& group_id, epoch_tcxx . . $ mlspp/epoch_t# epoch) const;
89 static Proposalcxx . . $ mlspp/Proposal# reinit_proposalcxx . . $ mlspp/State#reinit_proposal(136e15f530ff81c1).(bytescxx . . $ mlspp/bytes_ns/bytes# group_id,
90 ProtocolVersioncxx . . $ mlspp/ProtocolVersion# version,
91 CipherSuitecxx . . $ mlspp/CipherSuite# cipher_suite,
92 ExtensionListcxx . . $ mlspp/ExtensionList# extensions);
93
94 MLSMessagecxx . . $ mlspp/MLSMessage# addcxx . . $ mlspp/State#add(42c8642ea0f153d7).(const KeyPackagecxx . . $ mlspp/KeyPackage#& key_package, const MessageOptscxx . . $ mlspp/MessageOpts#& msg_opts);
95 MLSMessagecxx . . $ mlspp/MLSMessage# updatecxx . . $ mlspp/State#update(be9350ea97adfaa1).(HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey# leaf_priv,
96 const LeafNodeOptionscxx . . $ mlspp/LeafNodeOptions#& opts,
97 const MessageOptscxx . . $ mlspp/MessageOpts#& msg_opts);
98 MLSMessagecxx . . $ mlspp/MLSMessage# removecxx . . $ mlspp/State#remove(2ba6878df04e464).(RosterIndexcxx . . $ mlspp/RosterIndex# index, const MessageOptscxx . . $ mlspp/MessageOpts#& msg_opts);
99 MLSMessagecxx . . $ mlspp/MLSMessage# removecxx . . $ mlspp/State#remove(eb7319eafc4af471).(LeafIndexcxx . . $ mlspp/LeafIndex# removed, const MessageOptscxx . . $ mlspp/MessageOpts#& msg_opts);
100 MLSMessagecxx . . $ mlspp/MLSMessage# group_context_extensionscxx . . $ mlspp/State#group_context_extensions(77d403aa03adcbdd).(ExtensionListcxx . . $ mlspp/ExtensionList# exts,
101 const MessageOptscxx . . $ mlspp/MessageOpts#& msg_opts);
102 MLSMessagecxx . . $ mlspp/MLSMessage# pre_shared_keycxx . . $ mlspp/State#pre_shared_key(1fde39c3978cd5c1).(const bytescxx . . $ mlspp/bytes_ns/bytes#& external_psk_id,
103 const MessageOptscxx . . $ mlspp/MessageOpts#& msg_opts);
104 MLSMessagecxx . . $ mlspp/MLSMessage# pre_shared_keycxx . . $ mlspp/State#pre_shared_key(5a2841574fe3fe67).(const bytescxx . . $ mlspp/bytes_ns/bytes#& group_id,
105 epoch_tcxx . . $ mlspp/epoch_t# epoch,
106 const MessageOptscxx . . $ mlspp/MessageOpts#& msg_opts);
107 MLSMessagecxx . . $ mlspp/MLSMessage# reinitcxx . . $ mlspp/State#reinit(797eea9a9c26af95).(bytescxx . . $ mlspp/bytes_ns/bytes# group_id,
108 ProtocolVersioncxx . . $ mlspp/ProtocolVersion# version,
109 CipherSuitecxx . . $ mlspp/CipherSuite# cipher_suite,
110 ExtensionListcxx . . $ mlspp/ExtensionList# extensions,
111 const MessageOptscxx . . $ mlspp/MessageOpts#& msg_opts);
112
113 stdcxx . . $ std/::tuplecxx . . $ std/tuple#<MLSMessagecxx . . $ mlspp/MLSMessage#, Welcomecxx . . $ mlspp/Welcome#, Statecxx . . $ mlspp/State#> commitcxx . . $ mlspp/State#commit(79c4e4ce2bdb005c).(
114 const bytescxx . . $ mlspp/bytes_ns/bytes#& leaf_secret,
115 const stdcxx . . $ std/::optionalcxx . . $ std/optional#<CommitOptscxx . . $ mlspp/CommitOpts#>& opts,
116 const MessageOptscxx . . $ mlspp/MessageOpts#& msg_opts);
117
118 ///
119 /// Generic handshake message handlers
120 ///
121 stdcxx . . $ std/::optionalcxx . . $ std/optional#<Statecxx . . $ mlspp/State#> handlecxx . . $ mlspp/State#handle(2758c2375a1dbd3).(const MLSMessagecxx . . $ mlspp/MLSMessage#& msg);
122 stdcxx . . $ std/::optionalcxx . . $ std/optional#<Statecxx . . $ mlspp/State#> handlecxx . . $ mlspp/State#handle(2377cf03b043af66).(const MLSMessagecxx . . $ mlspp/MLSMessage#& msg,
123 stdcxx . . $ std/::optionalcxx . . $ std/optional#<Statecxx . . $ mlspp/State#> cached_state);
124
125 stdcxx . . $ std/::optionalcxx . . $ std/optional#<Statecxx . . $ mlspp/State#> handlecxx . . $ mlspp/State#handle(e951bd52be32ec5).(const ValidatedContentcxx . . $ mlspp/ValidatedContent#& content_auth);
126 stdcxx . . $ std/::optionalcxx . . $ std/optional#<Statecxx . . $ mlspp/State#> handlecxx . . $ mlspp/State#handle(71cce857922e66be).(const ValidatedContentcxx . . $ mlspp/ValidatedContent#& content_auth,
127 stdcxx . . $ std/::optionalcxx . . $ std/optional#<Statecxx . . $ mlspp/State#> cached_state);
128
129 ///
130 /// PSK management
131 ///
132 void add_resumption_pskcxx . . $ mlspp/State#add_resumption_psk(1af26b66f871bc85).(const bytescxx . . $ mlspp/bytes_ns/bytes#& group_id, epoch_tcxx . . $ mlspp/epoch_t# epoch, bytescxx . . $ mlspp/bytes_ns/bytes# secret);
133 void remove_resumption_pskcxx . . $ mlspp/State#remove_resumption_psk(3383564e9931e9d2).(const bytescxx . . $ mlspp/bytes_ns/bytes#& group_id, epoch_tcxx . . $ mlspp/epoch_t# epoch);
134 void add_external_pskcxx . . $ mlspp/State#add_external_psk(84c68846ffcb487b).(const bytescxx . . $ mlspp/bytes_ns/bytes#& id, const bytescxx . . $ mlspp/bytes_ns/bytes#& secret);
135 void remove_external_pskcxx . . $ mlspp/State#remove_external_psk(68ca607eebb5be3e).(const bytescxx . . $ mlspp/bytes_ns/bytes#& id);
136
137 ///
138 /// Accessors
139 ///
140 const bytescxx . . $ mlspp/bytes_ns/bytes#& group_idcxx . . $ mlspp/State#group_id(96dca66c419ecbf3).() const { return _group_idcxx . . $ mlspp/State#_group_id.; }
141 epoch_tcxx . . $ mlspp/epoch_t# epochcxx . . $ mlspp/State#epoch(fe4d2d262d4164a8).() const { return _epochcxx . . $ mlspp/State#_epoch.; }
142 LeafIndexcxx . . $ mlspp/LeafIndex# indexcxx . . $ mlspp/State#index(80d08586c54e2b43).() const { return _indexcxx . . $ mlspp/State#_index.; }
143 CipherSuitecxx . . $ mlspp/CipherSuite# cipher_suitecxx . . $ mlspp/State#cipher_suite(17658033c3289662).() const { return _suitecxx . . $ mlspp/State#_suite.; }
144 const ExtensionListcxx . . $ mlspp/ExtensionList#& extensionscxx . . $ mlspp/State#extensions(c8bb7beb367464e2).() const { return _extensionscxx . . $ mlspp/State#_extensions.; }
145 const TreeKEMPublicKeycxx . . $ mlspp/TreeKEMPublicKey#& treecxx . . $ mlspp/State#tree(c9f2b9505afa0dfa).() const { return _treecxx . . $ mlspp/State#_tree.; }
146 const bytescxx . . $ mlspp/bytes_ns/bytes#& resumption_pskcxx . . $ mlspp/State#resumption_psk(96dca66c419ecbf3).() const { return _key_schedulecxx . . $ mlspp/State#_key_schedule..resumption_pskcxx . . $ mlspp/KeyScheduleEpoch#resumption_psk.; }
147
148 bytescxx . . $ mlspp/bytes_ns/bytes# do_exportcxx . . $ mlspp/State#do_export(7012e37337977242).(const stdcxx . . $ std/::stringcxx . . $ std/string#& label,
149 const bytescxx . . $ mlspp/bytes_ns/bytes#& context,
150 size_t size) const;
151 GroupInfocxx . . $ mlspp/GroupInfo# group_infocxx . . $ mlspp/State#group_info(c29763f177bca0e).(bool inline_tree) const;
152
153 // Ordered list of credentials from non-blank leaves
154 stdcxx . . $ std/::vectorcxx . . $ std/vector#<LeafNodecxx . . $ mlspp/LeafNode#> rostercxx . . $ mlspp/State#roster(e6c5b5c0a1adb3b2).() const;
155
156 bytescxx . . $ mlspp/bytes_ns/bytes# epoch_authenticatorcxx . . $ mlspp/State#epoch_authenticator(d7392ba79aa35767).() const;
157
158 ///
159 /// Unwrap messages so that applications can inspect them
160 ///
161 ValidatedContentcxx . . $ mlspp/ValidatedContent# unwrapcxx . . $ mlspp/State#unwrap(250da7eac3b4c99).(const MLSMessagecxx . . $ mlspp/MLSMessage#& msg);
162
163 ///
164 /// Application encryption and decryption
165 ///
166 MLSMessagecxx . . $ mlspp/MLSMessage# protectcxx . . $ mlspp/State#protect(ae39f86e951371d3).(const bytescxx . . $ mlspp/bytes_ns/bytes#& authenticated_data,
167 const bytescxx . . $ mlspp/bytes_ns/bytes#& pt,
168 size_t padding_size);
169 stdcxx . . $ std/::tuplecxx . . $ std/tuple#<bytescxx . . $ mlspp/bytes_ns/bytes#, bytescxx . . $ mlspp/bytes_ns/bytes#> unprotectcxx . . $ mlspp/State#unprotect(2711fe3526d2deb9).(const MLSMessagecxx . . $ mlspp/MLSMessage#& ct);
170
171 // Assemble a group context for this state
172 GroupContextcxx . . $ mlspp/GroupContext# group_contextcxx . . $ mlspp/State#group_context(da187bf767f0d89d).() const;
173
174 // Subgroup branching
175 stdcxx . . $ std/::tuplecxx . . $ std/tuple#<Statecxx . . $ mlspp/State#, Welcomecxx . . $ mlspp/Welcome#> create_branchcxx . . $ mlspp/State#create_branch(ab7084bb38813f17).(
176 bytescxx . . $ mlspp/bytes_ns/bytes# group_id,
177 HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey# enc_priv,
178 SignaturePrivateKeycxx . . $ mlspp/SignaturePrivateKey# sig_priv,
179 const LeafNodecxx . . $ mlspp/LeafNode#& leaf_node,
180 ExtensionListcxx . . $ mlspp/ExtensionList# extensions,
181 const stdcxx . . $ std/::vectorcxx . . $ std/vector#<KeyPackagecxx . . $ mlspp/KeyPackage#>& key_packages,
182 const bytescxx . . $ mlspp/bytes_ns/bytes#& leaf_secret,
183 const CommitOptscxx . . $ mlspp/CommitOpts#& commit_opts) const;
184 Statecxx . . $ mlspp/State# handle_branchcxx . . $ mlspp/State#handle_branch(4ba8b9a80237b0d5).(const HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey#& init_priv,
185 HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey# enc_priv,
186 SignaturePrivateKeycxx . . $ mlspp/SignaturePrivateKey# sig_priv,
187 const KeyPackagecxx . . $ mlspp/KeyPackage#& key_package,
188 const Welcomecxx . . $ mlspp/Welcome#& welcome,
189 const stdcxx . . $ std/::optionalcxx . . $ std/optional#<TreeKEMPublicKeycxx . . $ mlspp/TreeKEMPublicKey#>& tree) const;
190
191 // Reinitialization
192 struct Tombstonecxx . . $ mlspp/State#Tombstone#
193 {
194 stdcxx . . $ std/::tuplecxx . . $ std/tuple#<Statecxx . . $ mlspp/State#, Welcomecxx . . $ mlspp/Welcome#> create_welcomecxx . . $ mlspp/State#Tombstone#create_welcome(da9bd202aa9ebf49).(
195 HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey# enc_priv,
196 SignaturePrivateKeycxx . . $ mlspp/SignaturePrivateKey# sig_priv,
197 const LeafNodecxx . . $ mlspp/LeafNode#& leaf_node,
198 const stdcxx . . $ std/::vectorcxx . . $ std/vector#<KeyPackagecxx . . $ mlspp/KeyPackage#>& key_packages,
199 const bytescxx . . $ mlspp/bytes_ns/bytes#& leaf_secret,
200 const CommitOptscxx . . $ mlspp/CommitOpts#& commit_opts) const;
201 Statecxx . . $ mlspp/State# handle_welcomecxx . . $ mlspp/State#Tombstone#handle_welcome(4ba8b9a80237b0d5).(const HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey#& init_priv,
202 HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey# enc_priv,
203 SignaturePrivateKeycxx . . $ mlspp/SignaturePrivateKey# sig_priv,
204 const KeyPackagecxx . . $ mlspp/KeyPackage#& key_package,
205 const Welcomecxx . . $ mlspp/Welcome#& welcome,
206 const stdcxx . . $ std/::optionalcxx . . $ std/optional#<TreeKEMPublicKeycxx . . $ mlspp/TreeKEMPublicKey#>& tree) const;
207
208 TLS_SERIALIZABLEcxx . . $ mlspp/State#Tombstone#_tls_fields_r(da732d0f20bb6146).(prior_group_id, prior_epoch, resumption_psk, reinit);
209
210 const bytescxx . . $ mlspp/bytes_ns/bytes# epoch_authenticatorcxx . . $ mlspp/State#Tombstone#epoch_authenticator.;
211 const ReInitcxx . . $ mlspp/ReInit# reinitcxx . . $ mlspp/State#Tombstone#reinit.;
212
213 private:
214 Tombstonecxx . . $ mlspp/State#Tombstone#Tombstone(bd3e5c3ab7d6b604).(const Statecxx . . $ mlspp/State#& state_in, ReInitcxx . . $ mlspp/ReInit# reinit_in);
215
216 bytescxx . . $ mlspp/bytes_ns/bytes# prior_group_idcxx . . $ mlspp/State#Tombstone#prior_group_id.;
217 epoch_tcxx . . $ mlspp/epoch_t# prior_epochcxx . . $ mlspp/State#Tombstone#prior_epoch.;
218 bytescxx . . $ mlspp/bytes_ns/bytes# resumption_pskcxx . . $ mlspp/State#Tombstone#resumption_psk.;
219
220 friend class Statecxx . . $ mlspp/State#;
221 };
222
223 stdcxx . . $ std/::tuplecxx . . $ std/tuple#<Tombstonecxx . . $ mlspp/State#Tombstone#, MLSMessagecxx . . $ mlspp/MLSMessage#> reinit_commitcxx . . $ mlspp/State#reinit_commit(208a70250eab2009).(
224 const bytescxx . . $ mlspp/bytes_ns/bytes#& leaf_secret,
225 const stdcxx . . $ std/::optionalcxx . . $ std/optional#<CommitOptscxx . . $ mlspp/CommitOpts#>& opts,
226 const MessageOptscxx . . $ mlspp/MessageOpts#& msg_opts);
227 Tombstonecxx . . $ mlspp/State#Tombstone# handle_reinit_commitcxx . . $ mlspp/State#handle_reinit_commit(a89b469b6df7f29d).(const MLSMessagecxx . . $ mlspp/MLSMessage#& commit);
228
229 protected:
230 // Shared confirmed state
231 // XXX([email protected]): Can these be made const?
232 CipherSuitecxx . . $ mlspp/CipherSuite# _suitecxx . . $ mlspp/State#_suite.;
233 bytescxx . . $ mlspp/bytes_ns/bytes# _group_idcxx . . $ mlspp/State#_group_id.;
234 epoch_tcxx . . $ mlspp/epoch_t# _epochcxx . . $ mlspp/State#_epoch.;
235 TreeKEMPublicKeycxx . . $ mlspp/TreeKEMPublicKey# _treecxx . . $ mlspp/State#_tree.;
236 TreeKEMPrivateKeycxx . . $ mlspp/TreeKEMPrivateKey# _tree_privcxx . . $ mlspp/State#_tree_priv.;
237 TranscriptHashcxx . . $ mlspp/TranscriptHash# _transcript_hashcxx . . $ mlspp/State#_transcript_hash.;
238 ExtensionListcxx . . $ mlspp/ExtensionList# _extensionscxx . . $ mlspp/State#_extensions.;
239
240 // Shared secret state
241 KeyScheduleEpochcxx . . $ mlspp/KeyScheduleEpoch# _key_schedulecxx . . $ mlspp/State#_key_schedule.;
242 GroupKeySourcecxx . . $ mlspp/GroupKeySource# _keyscxx . . $ mlspp/State#_keys.;
243
244 // Per-participant state
245 LeafIndexcxx . . $ mlspp/LeafIndex# _indexcxx . . $ mlspp/State#_index.;
246 SignaturePrivateKeycxx . . $ mlspp/SignaturePrivateKey# _identity_privcxx . . $ mlspp/State#_identity_priv.;
247
248 // Storage for PSKs
249 stdcxx . . $ std/::mapcxx . . $ std/map#<bytescxx . . $ mlspp/bytes_ns/bytes#, bytescxx . . $ mlspp/bytes_ns/bytes#> _external_pskscxx . . $ mlspp/State#_external_psks.;
250
251 using EpochRefcxx . . $ mlspp/State#EpochRef# = stdcxx . . $ std/::tuplecxx . . $ std/tuple#<bytescxx . . $ mlspp/bytes_ns/bytes#, epoch_tcxx . . $ mlspp/epoch_t#>;
252 stdcxx . . $ std/::mapcxx . . $ std/map#<EpochRefcxx . . $ mlspp/State#EpochRef#, bytescxx . . $ mlspp/bytes_ns/bytes#> _resumption_pskscxx . . $ mlspp/State#_resumption_psks.;
253
254 // Cache of Proposals and update secrets
255 struct CachedProposalcxx . . $ mlspp/State#CachedProposal#
256 {
257 ProposalRefcxx . . $ mlspp/ProposalRef# refcxx . . $ mlspp/State#CachedProposal#ref.;
258 Proposalcxx . . $ mlspp/Proposal# proposalcxx . . $ mlspp/State#CachedProposal#proposal.;
259 stdcxx . . $ std/::optionalcxx . . $ std/optional#<LeafIndexcxx . . $ mlspp/LeafIndex#> sendercxx . . $ mlspp/State#CachedProposal#sender.;
260 };
261 stdcxx . . $ std/::listcxx . . $ std/__cxx11/list#<CachedProposalcxx . . $ mlspp/State#CachedProposal#> _pending_proposalscxx . . $ mlspp/State#_pending_proposals.;
262
263 struct CachedUpdatecxx . . $ mlspp/State#CachedUpdate#
264 {
265 HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey# update_privcxx . . $ mlspp/State#CachedUpdate#update_priv.;
266 Updatecxx . . $ mlspp/Update# proposalcxx . . $ mlspp/State#CachedUpdate#proposal.;
267 };
268 stdcxx . . $ std/::optionalcxx . . $ std/optional#<CachedUpdatecxx . . $ mlspp/State#CachedUpdate#> _cached_updatecxx . . $ mlspp/State#_cached_update.;
269
270 // Assemble a preliminary, unjoined group state
271 Statecxx . . $ mlspp/State#State(98680997732888de).(SignaturePrivateKeycxx . . $ mlspp/SignaturePrivateKey# sig_priv,
272 const GroupInfocxx . . $ mlspp/GroupInfo#& group_info,
273 const stdcxx . . $ std/::optionalcxx . . $ std/optional#<TreeKEMPublicKeycxx . . $ mlspp/TreeKEMPublicKey#>& tree);
274
275 // Assemble a group from a Welcome, allowing for resumption PSKs
276 Statecxx . . $ mlspp/State#State(e41efc7a5f03af4b).(const HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey#& init_priv,
277 HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey# leaf_priv,
278 SignaturePrivateKeycxx . . $ mlspp/SignaturePrivateKey# sig_priv,
279 const KeyPackagecxx . . $ mlspp/KeyPackage#& key_package,
280 const Welcomecxx . . $ mlspp/Welcome#& welcome,
281 const stdcxx . . $ std/::optionalcxx . . $ std/optional#<TreeKEMPublicKeycxx . . $ mlspp/TreeKEMPublicKey#>& tree,
282 stdcxx . . $ std/::mapcxx . . $ std/map#<bytescxx . . $ mlspp/bytes_ns/bytes#, bytescxx . . $ mlspp/bytes_ns/bytes#> external_psks,
283 stdcxx . . $ std/::mapcxx . . $ std/map#<EpochRefcxx . . $ mlspp/State#EpochRef#, bytescxx . . $ mlspp/bytes_ns/bytes#> resumption_psks);
284
285 // Import a tree from an externally-provided tree or an extension
286 TreeKEMPublicKeycxx . . $ mlspp/TreeKEMPublicKey# import_treecxx . . $ mlspp/State#import_tree(485acda75e27d34f).(const bytescxx . . $ mlspp/bytes_ns/bytes#& tree_hash,
287 const stdcxx . . $ std/::optionalcxx . . $ std/optional#<TreeKEMPublicKeycxx . . $ mlspp/TreeKEMPublicKey#>& external,
288 const ExtensionListcxx . . $ mlspp/ExtensionList#& extensions);
289 bool validate_treecxx . . $ mlspp/State#validate_tree(50ce9a9e25b4a850).() const;
290
291 // Form a commit, covering all the cases with slightly different validation
292 // rules:
293 // * Normal
294 // * External
295 // * Branch
296 // * Reinit
297 struct NormalCommitParamscxx . . $ mlspp/State#NormalCommitParams#
298 {};
299
300 struct ExternalCommitParamscxx . . $ mlspp/State#ExternalCommitParams#
301 {
302 KeyPackagecxx . . $ mlspp/KeyPackage# joiner_key_packagecxx . . $ mlspp/State#ExternalCommitParams#joiner_key_package.;
303 bytescxx . . $ mlspp/bytes_ns/bytes# force_init_secretcxx . . $ mlspp/State#ExternalCommitParams#force_init_secret.;
304 };
305
306 struct RestartCommitParamscxx . . $ mlspp/State#RestartCommitParams#
307 {
308 ResumptionPSKUsagecxx . . $ mlspp/ResumptionPSKUsage# allowed_usagecxx . . $ mlspp/State#RestartCommitParams#allowed_usage.;
309 };
310
311 struct ReInitCommitParamscxx . . $ mlspp/State#ReInitCommitParams#
312 {};
313
314 using CommitParamscxx . . $ mlspp/State#CommitParams# = var::variantcxx . . $ std/variant#<NormalCommitParamscxx . . $ mlspp/State#NormalCommitParams#,
315 ExternalCommitParamscxx . . $ mlspp/State#ExternalCommitParams#,
316 RestartCommitParamscxx . . $ mlspp/State#RestartCommitParams#,
317 ReInitCommitParamscxx . . $ mlspp/State#ReInitCommitParams#>;
318
319 stdcxx . . $ std/::tuplecxx . . $ std/tuple#<MLSMessagecxx . . $ mlspp/MLSMessage#, Welcomecxx . . $ mlspp/Welcome#, Statecxx . . $ mlspp/State#> commitcxx . . $ mlspp/State#commit(c6dfec9d8a60f28e).(
320 const bytescxx . . $ mlspp/bytes_ns/bytes#& leaf_secret,
321 const stdcxx . . $ std/::optionalcxx . . $ std/optional#<CommitOptscxx . . $ mlspp/CommitOpts#>& opts,
322 const MessageOptscxx . . $ mlspp/MessageOpts#& msg_opts,
323 CommitParamscxx . . $ mlspp/State#CommitParams# params);
324
325 stdcxx . . $ std/::optionalcxx . . $ std/optional#<Statecxx . . $ mlspp/State#> handlecxx . . $ mlspp/State#handle(3843c3f51eb90619).(
326 const MLSMessagecxx . . $ mlspp/MLSMessage#& msg,
327 stdcxx . . $ std/::optionalcxx . . $ std/optional#<Statecxx . . $ mlspp/State#> cached_state,
328 const stdcxx . . $ std/::optionalcxx . . $ std/optional#<CommitParamscxx . . $ mlspp/State#CommitParams#>& expected_params);
329 stdcxx . . $ std/::optionalcxx . . $ std/optional#<Statecxx . . $ mlspp/State#> handlecxx . . $ mlspp/State#handle(3d54451646908156).(
330 const ValidatedContentcxx . . $ mlspp/ValidatedContent#& val_content,
331 stdcxx . . $ std/::optionalcxx . . $ std/optional#<Statecxx . . $ mlspp/State#> cached_state,
332 const stdcxx . . $ std/::optionalcxx . . $ std/optional#<CommitParamscxx . . $ mlspp/State#CommitParams#>& expected_params);
333
334 // Create an MLSMessage encapsulating some content
335 template<typename Inner>
336 AuthenticatedContentcxx . . $ mlspp/AuthenticatedContent# signcxx . . $ mlspp/State#sign(ba0a57b5461d940d).(const Sendercxx . . $ mlspp/Sender#& sender,
337 Inner&& content,
338 const bytescxx . . $ mlspp/bytes_ns/bytes#& authenticated_data,
339 bool encrypt) const;
340
341 MLSMessagecxx . . $ mlspp/MLSMessage# protectcxx . . $ mlspp/State#protect(cc9bcfec8b65775d).(AuthenticatedContentcxx . . $ mlspp/AuthenticatedContent#&& content_auth, size_t padding_size);
342
343 template<typename Inner>
344 MLSMessagecxx . . $ mlspp/MLSMessage# protect_fullcxx . . $ mlspp/State#protect_full(1f2559e3f896eeae).(Inner&& content, const MessageOptscxx . . $ mlspp/MessageOpts#& msg_opts);
345
346 // Apply the changes requested by various messages
347 LeafIndexcxx . . $ mlspp/LeafIndex# applycxx . . $ mlspp/State#apply(817d13f772d2b94f).(const Addcxx . . $ mlspp/Add#& add);
348 void applycxx . . $ mlspp/State#apply(bbabe14ce4ba551a).(LeafIndexcxx . . $ mlspp/LeafIndex# target, const Updatecxx . . $ mlspp/Update#& update);
349 void applycxx . . $ mlspp/State#apply(9773a327894cdb3).(LeafIndexcxx . . $ mlspp/LeafIndex# target,
350 const Updatecxx . . $ mlspp/Update#& update,
351 const HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey#& leaf_priv);
352 LeafIndexcxx . . $ mlspp/LeafIndex# applycxx . . $ mlspp/State#apply(a2de76d9299b6d75).(const Removecxx . . $ mlspp/Remove#& remove);
353 void applycxx . . $ mlspp/State#apply(53e06667aef065e3).(const GroupContextExtensionscxx . . $ mlspp/GroupContextExtensions#& gce);
354 stdcxx . . $ std/::vectorcxx . . $ std/vector#<LeafIndexcxx . . $ mlspp/LeafIndex#> applycxx . . $ mlspp/State#apply(96903485d10560d).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<CachedProposalcxx . . $ mlspp/State#CachedProposal#>& proposals,
355 Proposalcxx . . $ mlspp/Proposal#::Typecxx . . $ mlspp/Proposal#Type# required_type);
356 stdcxx . . $ std/::tuplecxx . . $ std/tuple#<stdcxx . . $ std/::vectorcxx . . $ std/vector#<LeafIndexcxx . . $ mlspp/LeafIndex#>, stdcxx . . $ std/::vectorcxx . . $ std/vector#<PSKWithSecretcxx . . $ mlspp/PSKWithSecret#>> applycxx . . $ mlspp/State#apply(8b7878ad0f8bc547).(
357 const stdcxx . . $ std/::vectorcxx . . $ std/vector#<CachedProposalcxx . . $ mlspp/State#CachedProposal#>& proposals);
358
359 // Verify that a specific key package or all members support a given set of
360 // extensions
361 bool extensions_supportedcxx . . $ mlspp/State#extensions_supported(b1d6012e28b23e89).(const ExtensionListcxx . . $ mlspp/ExtensionList#& exts) const;
362
363 // Extract proposals and PSKs from cache
364 void cache_proposalcxx . . $ mlspp/State#cache_proposal(4cb5f50ea8a1da54).(AuthenticatedContentcxx . . $ mlspp/AuthenticatedContent# content_auth);
365 stdcxx . . $ std/::optionalcxx . . $ std/optional#<CachedProposalcxx . . $ mlspp/State#CachedProposal#> resolvecxx . . $ mlspp/State#resolve(8b4a89bcc9579b5f).(
366 const ProposalOrRefcxx . . $ mlspp/ProposalOrRef#& id,
367 stdcxx . . $ std/::optionalcxx . . $ std/optional#<LeafIndexcxx . . $ mlspp/LeafIndex#> sender_index) const;
368 stdcxx . . $ std/::vectorcxx . . $ std/vector#<CachedProposalcxx . . $ mlspp/State#CachedProposal#> must_resolvecxx . . $ mlspp/State#must_resolve(5bc28b2fad777aa5).(
369 const stdcxx . . $ std/::vectorcxx . . $ std/vector#<ProposalOrRefcxx . . $ mlspp/ProposalOrRef#>& ids,
370 stdcxx . . $ std/::optionalcxx . . $ std/optional#<LeafIndexcxx . . $ mlspp/LeafIndex#> sender_index) const;
371
372 stdcxx . . $ std/::vectorcxx . . $ std/vector#<PSKWithSecretcxx . . $ mlspp/PSKWithSecret#> resolvecxx . . $ mlspp/State#resolve(93c5d9b7116d7785).(
373 const stdcxx . . $ std/::vectorcxx . . $ std/vector#<PreSharedKeyIDcxx . . $ mlspp/PreSharedKeyID#>& psks) const;
374
375 // Check properties of proposals
376 bool validcxx . . $ mlspp/State#valid(7686b21a80015e7b).(const LeafNodecxx . . $ mlspp/LeafNode#& leaf_node,
377 LeafNodeSourcecxx . . $ mlspp/LeafNodeSource# required_source,
378 stdcxx . . $ std/::optionalcxx . . $ std/optional#<LeafIndexcxx . . $ mlspp/LeafIndex#> index) const;
379 bool validcxx . . $ mlspp/State#valid(631cf8aff067838e).(const KeyPackagecxx . . $ mlspp/KeyPackage#& key_package) const;
380 bool validcxx . . $ mlspp/State#valid(93270e26fed03509).(const Addcxx . . $ mlspp/Add#& add) const;
381 bool validcxx . . $ mlspp/State#valid(f8526462f5e1c3fa).(LeafIndexcxx . . $ mlspp/LeafIndex# sender, const Updatecxx . . $ mlspp/Update#& update) const;
382 bool validcxx . . $ mlspp/State#valid(d182833d0433cb04).(const Removecxx . . $ mlspp/Remove#& remove) const;
383 bool validcxx . . $ mlspp/State#valid(16425a0d68d68158).(const PreSharedKeycxx . . $ mlspp/PreSharedKey#& psk) const;
384 static bool validcxx . . $ mlspp/State#valid(78776dccf133dbdb).(const ReInitcxx . . $ mlspp/ReInit#& reinit);
385 bool validcxx . . $ mlspp/State#valid(6117d87957a79960).(const ExternalInitcxx . . $ mlspp/ExternalInit#& external_init) const;
386 bool validcxx . . $ mlspp/State#valid(c638b1b939771a6f).(const GroupContextExtensionscxx . . $ mlspp/GroupContextExtensions#& gce) const;
387 bool validcxx . . $ mlspp/State#valid(1cfcf2061f410bee).(stdcxx . . $ std/::optionalcxx . . $ std/optional#<LeafIndexcxx . . $ mlspp/LeafIndex#> sender, const Proposalcxx . . $ mlspp/Proposal#& proposal) const;
388
389 bool validcxx . . $ mlspp/State#valid(5b837f842e0476dd).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<CachedProposalcxx . . $ mlspp/State#CachedProposal#>& proposals,
390 LeafIndexcxx . . $ mlspp/LeafIndex# commit_sender,
391 const CommitParamscxx . . $ mlspp/State#CommitParams#& params) const;
392 bool valid_normalcxx . . $ mlspp/State#valid_normal(a3e4f4503fe1bf58).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<CachedProposalcxx . . $ mlspp/State#CachedProposal#>& proposals,
393 LeafIndexcxx . . $ mlspp/LeafIndex# commit_sender) const;
394 bool valid_externalcxx . . $ mlspp/State#valid_external(2e14fbd53494efe4).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<CachedProposalcxx . . $ mlspp/State#CachedProposal#>& proposals) const;
395 static bool valid_reinitcxx . . $ mlspp/State#valid_reinit(10e28906c0b85113).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<CachedProposalcxx . . $ mlspp/State#CachedProposal#>& proposals);
396 static bool valid_restartcxx . . $ mlspp/State#valid_restart(459c8a53464c5055).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<CachedProposalcxx . . $ mlspp/State#CachedProposal#>& proposals,
397 ResumptionPSKUsagecxx . . $ mlspp/ResumptionPSKUsage# allowed_usage);
398
399 static bool valid_external_proposal_typecxx . . $ mlspp/State#valid_external_proposal_type(3c978dac0e5ee2ad).(const Proposalcxx . . $ mlspp/Proposal#::Typecxx . . $ mlspp/Proposal#Type# proposal_type);
400
401 CommitParamscxx . . $ mlspp/State#CommitParams# infer_commit_typecxx . . $ mlspp/State#infer_commit_type(1740ce9eaeaed3ae).(
402 const stdcxx . . $ std/::optionalcxx . . $ std/optional#<LeafIndexcxx . . $ mlspp/LeafIndex#>& sender,
403 const stdcxx . . $ std/::vectorcxx . . $ std/vector#<CachedProposalcxx . . $ mlspp/State#CachedProposal#>& proposals,
404 const stdcxx . . $ std/::optionalcxx . . $ std/optional#<CommitParamscxx . . $ mlspp/State#CommitParams#>& expected_params) const;
405 static bool path_requiredcxx . . $ mlspp/State#path_required(10e28906c0b85113).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<CachedProposalcxx . . $ mlspp/State#CachedProposal#>& proposals);
406
407 // Compare the **shared** attributes of the states
408 friend bool operatorcxx . . $ mlspp/`operator==`(f7ea92d64b4f5a4f).==(const Statecxx . . $ mlspp/State#& lhs, const Statecxx . . $ mlspp/State#& rhs);
409 friend bool operatorcxx . . $ mlspp/`operator!=`(f7ea92d64b4f5a4f).!=(const Statecxx . . $ mlspp/State#& lhs, const Statecxx . . $ mlspp/State#& rhs);
410
411 // Derive and set the secrets for an epoch, given some new entropy
412 void update_epoch_secretscxx . . $ mlspp/State#update_epoch_secrets(34e1f8f66a1cf646).(const bytescxx . . $ mlspp/bytes_ns/bytes#& commit_secret,
413 const stdcxx . . $ std/::vectorcxx . . $ std/vector#<PSKWithSecretcxx . . $ mlspp/PSKWithSecret#>& psks,
414 const stdcxx . . $ std/::optionalcxx . . $ std/optional#<bytescxx . . $ mlspp/bytes_ns/bytes#>& force_init_secret);
415
416 // Signature verification over a handshake message
417 bool verify_internalcxx . . $ mlspp/State#verify_internal(891fdc29165d76d0).(const AuthenticatedContentcxx . . $ mlspp/AuthenticatedContent#& content_auth) const;
418 bool verify_externalcxx . . $ mlspp/State#verify_external(891fdc29165d76d0).(const AuthenticatedContentcxx . . $ mlspp/AuthenticatedContent#& content_auth) const;
419 bool verify_new_member_proposalcxx . . $ mlspp/State#verify_new_member_proposal(891fdc29165d76d0).(
420 const AuthenticatedContentcxx . . $ mlspp/AuthenticatedContent#& content_auth) const;
421 bool verify_new_member_commitcxx . . $ mlspp/State#verify_new_member_commit(891fdc29165d76d0).(const AuthenticatedContentcxx . . $ mlspp/AuthenticatedContent#& content_auth) const;
422 bool verifycxx . . $ mlspp/State#verify(891fdc29165d76d0).(const AuthenticatedContentcxx . . $ mlspp/AuthenticatedContent#& content_auth) const;
423
424 // Convert a Roster entry into LeafIndex
425 LeafIndexcxx . . $ mlspp/LeafIndex# leaf_for_roster_entrycxx . . $ mlspp/State#leaf_for_roster_entry(fb567b77ce7f3086).(RosterIndexcxx . . $ mlspp/RosterIndex# index) const;
426
427 // Create a draft successor state
428 Statecxx . . $ mlspp/State# successorcxx . . $ mlspp/State#successor(c5801eb416f519eb).() const;
429 };
430
431 } // namespace mlspp