@@ -88,51 +88,49 @@ BOOST_DATA_TEST_CASE(vole_commit_verify, all_parameters, param_id) {
8888 }
8989}
9090
91- #if 0
9291BOOST_DATA_TEST_CASE (convert_to_vole, all_parameters, param_id) {
92+ std::mt19937_64 rd;
9393 BOOST_TEST_CONTEXT (" Parameter set: " << faest_get_param_name (param_id)) {
94- const faest_paramset_t params = faest_get_paramset(param_id);
95- const unsigned int lambda = params.faest_param.lambda;
96- const unsigned int lambdaBytes = lambda / 8;
94+ const faest_paramset_t params = faest_get_paramset (param_id);
95+ const unsigned int lambda = params.faest_param .lambda ;
96+ const unsigned int lambda_bytes = lambda / 8 ;
9797 const unsigned int ell_hat =
9898 params.faest_param .l + params.faest_param .lambda * 2 + UNIVERSAL_HASH_B_BITS;
9999 const unsigned int ell_hat_bytes = (ell_hat + 7 ) / 8 ;
100- const unsigned int max_depth = std::max( params.faest_param.k0, params.faest_param.k1) ;
100+ const unsigned int max_depth = params.faest_param .k ;
101101 const unsigned int max_nodes = 1 << max_depth;
102+ const unsigned int tau = params.faest_param .tau ;
102103
103- std::vector<uint8_t> sd, u, v, q, chal_out, chal ;
104- sd.resize(max_nodes * lambdaBytes );
104+ std::vector<uint8_t > sd, u, v, q;
105+ sd.resize (max_nodes * lambda_bytes );
105106 rand_bytes (sd.data (), sd.size ());
106- chal_out.resize(max_depth);
107107 u.resize (ell_hat_bytes);
108108 v.resize (ell_hat_bytes * max_depth);
109109 q.resize (ell_hat_bytes * max_depth);
110- chal.resize(lambdaBytes);
111- rand_bytes(chal.data(), chal.size());
112110
113- for (unsigned int i = 0; i != params.faest_param.tau; ++i) {
114- unsigned int depth =
115- i < params.faest_param.t0 ? params.faest_param.k0 : params.faest_param.k1;
111+ for (unsigned int i = 0 ; i != tau; ++i) {
112+ std::uniform_int_distribution<> distribution{
113+ 0 ,
114+ static_cast <int >(bavc_max_node_index (i, params.faest_param .tau1 , params.faest_param .k )) -
115+ 1 };
116+ const unsigned int idx = distribution (rd);
117+
118+ unsigned int depth = bavc_max_node_depth (i, params.faest_param .tau1 , max_depth);
116119 unsigned int nodes = 1 << depth;
117120
118- ConvertToVole(iv.data(), sd.data(), false, lambda, depth, ell_hat_bytes, u.data(), v.data());
121+ ConvertToVole (iv.data (), sd.data (), false , i, ell_hat_bytes, u.data (), v.data (), ¶ms );
119122
120- ChalDec(chal.data(), i, params.faest_param.k0, params.faest_param.t0, params.faest_param.k1,
121- params.faest_param.t1, chal_out.data());
122- const auto idx = NumRec(depth, chal_out.data());
123123 std::vector<uint8_t > sdprime;
124- sdprime.resize(max_nodes * lambdaBytes , 0);
124+ sdprime.resize (max_nodes * lambda_bytes , 0 );
125125 for (unsigned int j = 1 ; j != nodes; ++j) {
126- std::copy(&sd[(j ^ idx) * lambdaBytes ], &sd[((j ^ idx) + 1) * lambdaBytes ],
127- &sdprime[j * lambdaBytes ]);
126+ std::copy (&sd[(j ^ idx) * lambda_bytes ], &sd[((j ^ idx) + 1 ) * lambda_bytes ],
127+ &sdprime[j * lambda_bytes ]);
128128 }
129129
130- ConvertToVole(iv.data(), sdprime.data(), true, lambda, depth, ell_hat_bytes, nullptr,
131- q.data());
130+ ConvertToVole (iv.data (), sdprime.data (), true , i, ell_hat_bytes, nullptr , q.data (), ¶ms);
132131
133132 for (unsigned int j = 0 ; j != depth; ++j) {
134- BOOST_TEST((chal_out[j] == 0 || chal_out[j] == 1));
135- if (chal_out[j]) {
133+ if (idx & (1 << j)) {
136134 for (unsigned int inner = 0 ; inner != ell_hat_bytes; ++inner) {
137135 q[j * ell_hat_bytes + inner] ^= u[inner];
138136 }
@@ -142,6 +140,5 @@ BOOST_DATA_TEST_CASE(convert_to_vole, all_parameters, param_id) {
142140 }
143141 }
144142}
145- #endif
146143
147144BOOST_AUTO_TEST_SUITE_END ()
0 commit comments