Skip to content

Commit

Permalink
Fixing construct_aad() bug (facebook#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinlewi committed Jan 8, 2021
1 parent fa6752c commit ba53089
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,11 @@ impl<D: Hash> Envelope<D> {
// Helper functions

fn construct_aad(server_s_pk: &[u8], optional_ids: &Option<(Vec<u8>, Vec<u8>)>) -> Vec<u8> {
optional_ids
let ids = optional_ids
.iter()
.flat_map(|(l, r)| [serialize(server_s_pk, 2), serialize(l, 2), serialize(r, 2)].concat())
.collect()
.flat_map(|(l, r)| [serialize(l, 2), serialize(r, 2)].concat())
.collect();
[serialize(server_s_pk, 2), ids].concat()
}

pub(crate) fn mode_from_ids(optional_ids: &Option<(Vec<u8>, Vec<u8>)>) -> InnerEnvelopeMode {
Expand Down

0 comments on commit ba53089

Please sign in to comment.