Skip to content

Commit

Permalink
vc: avoid two memcpys
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastinas committed Jul 11, 2023
1 parent 620bf99 commit 22f817d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions vc.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,9 @@ static void expand_seeds(tree_t* tree, const uint8_t* iv, const faest_paramset_t
assert(2 * lastNonLeaf + 2 < tree->numNodes);

for (size_t i = 0; i <= lastNonLeaf; i++) {
uint8_t out[2 * MAX_LAMBDA_BYTES];
prg(NODE(*tree, i, lambda_bytes), iv, out, params->faest_param.lambda, lambda_bytes * 2);

memcpy(NODE(*tree, 2 * i + 1, lambda_bytes), out, lambda_bytes);
memcpy(NODE(*tree, 2 * i + 2, lambda_bytes), out + lambda_bytes, lambda_bytes);
// the nodes are located other in memory consecutively
prg(NODE(*tree, i, lambda_bytes), iv, NODE(*tree, 2 * i + 1, lambda_bytes),
params->faest_param.lambda, lambda_bytes * 2);
}
}

Expand Down

0 comments on commit 22f817d

Please sign in to comment.