Skip to content

Commit

Permalink
fix consistency pass
Browse files Browse the repository at this point in the history
  • Loading branch information
ludamad0 committed Feb 12, 2024
1 parent 4313e8b commit 637c531
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions barretenberg/cpp/src/barretenberg/ecc/groups/element_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,10 +906,9 @@ std::vector<affine_element<Fq, Fr, T>> element<Fq, Fr, T>::batch_mul_with_endomo
return results;
}

constexpr size_t lookup_size = 8;
constexpr size_t num_rounds = 32;
constexpr size_t num_wnaf_bits = 4;
std::array<std::vector<affine_element>, lookup_size> lookup_table;
constexpr size_t LOOKUP_SIZE = 8;
constexpr size_t NUM_ROUNDS = 32;
std::array<std::vector<affine_element>, LOOKUP_SIZE> lookup_table;
for (auto& table : lookup_table) {
table.resize(num_points);
}
Expand All @@ -935,7 +934,7 @@ std::vector<affine_element<Fq, Fr, T>> element<Fq, Fr, T>::batch_mul_with_endomo

// Construct lookup table
batch_affine_double(&temp_point_vector[0]);
for (size_t j = 1; j < lookup_size; ++j) {
for (size_t j = 1; j < LOOKUP_SIZE; ++j) {
run_loop_in_parallel_if_effective(
num_points,
[j, &lookup_table](size_t start, size_t end) {
Expand Down Expand Up @@ -997,7 +996,7 @@ std::vector<affine_element<Fq, Fr, T>> element<Fq, Fr, T>::batch_mul_with_endomo
// First cycle of addition
batch_affine_add_internal(&temp_point_vector[0], &work_elements[0]);
// Run through SM logic in wnaf form (excluding the skew)
for (size_t j = 2; j < num_rounds * 2; ++j) {
for (size_t j = 2; j < NUM_ROUNDS * 2; ++j) {
wnaf_entry = wnaf.table[j];
index = wnaf_entry & 0x0fffffffU;
sign = static_cast<bool>((wnaf_entry >> 31) & 1);
Expand Down Expand Up @@ -1031,7 +1030,7 @@ std::vector<affine_element<Fq, Fr, T>> element<Fq, Fr, T>::batch_mul_with_endomo
}

// Apply skew for the first endo scalar
if (skew) {
if (wnaf.skew) {
run_loop_in_parallel_if_effective(
num_points,
[&lookup_table, &temp_point_vector](size_t start, size_t end) {
Expand All @@ -1050,7 +1049,7 @@ std::vector<affine_element<Fq, Fr, T>> element<Fq, Fr, T>::batch_mul_with_endomo
batch_affine_add_internal(&temp_point_vector[0], &work_elements[0]);
}
// Apply skew for the second endo scalar
if (endo_skew) {
if (wnaf.endo_skew) {
run_loop_in_parallel_if_effective(
num_points,
[beta, &lookup_table, &temp_point_vector](size_t start, size_t end) {
Expand Down

0 comments on commit 637c531

Please sign in to comment.