Skip to content

Commit

Permalink
feat: iterate through subkeys using BFS for decaps
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Rosenkranz-Costa committed Nov 20, 2023
1 parent 775d064 commit 7d75c1a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ pub fn decaps(
) -> Result<SymmetricKey<SYM_KEY_LENGTH>, Error> {
let precomp = &(&encapsulation.c1 * &usk.a) + &(&encapsulation.c2 * &usk.b);
for encapsulation_i in &encapsulation.encs {
for (_, (sk_j, x_j)) in usk.subkeys.iter() {
// BFS search user subkeys to first try the most recent rotations of each
// partitions.
for (_, (sk_j, x_j)) in usk.subkeys.bfs() {
let e_j = match encapsulation_i {
KeyEncapsulation::HybridEncapsulation(epq_i) => {
if let Some(sk_j) = sk_j {
Expand Down

0 comments on commit 7d75c1a

Please sign in to comment.