|
@@ -169,7 +169,15 @@ static int p_dl(const ZZ_p &target, const ZZ_p &base, ZZ &exp,
|
|
|
}
|
|
}
|
|
|
gettimeofday(&st, NULL);
|
|
gettimeofday(&st, NULL);
|
|
|
unsigned int launch_count = 0;
|
|
unsigned int launch_count = 0;
|
|
|
- cuda_dl(subgroup_base, subgroup_target, fvec[i], md, dpfreq, &cbdata, &launch_count);
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+#ifdef DERANDOMIZE
|
|
|
|
|
+ RandomStreamPush push_seed;
|
|
|
|
|
+ // the seed will be reset to its original value
|
|
|
|
|
+ // once we exit this scope
|
|
|
|
|
+ SetSeed(rep(subgroup_base)*rep(subgroup_target)*fvec[i]*md);
|
|
|
|
|
+#endif
|
|
|
|
|
+ cuda_dl(subgroup_base, subgroup_target, fvec[i], md, dpfreq, &cbdata, &launch_count);
|
|
|
|
|
+ }
|
|
|
ZZ subgroup_dl = cbdata.expon;
|
|
ZZ subgroup_dl = cbdata.expon;
|
|
|
gettimeofday(&et, NULL);
|
|
gettimeofday(&et, NULL);
|
|
|
unsigned long us_elapsed = (et.tv_sec-st.tv_sec)*1000000 +
|
|
unsigned long us_elapsed = (et.tv_sec-st.tv_sec)*1000000 +
|
|
@@ -307,8 +315,18 @@ int main(int argc, char **argv)
|
|
|
|
|
|
|
|
// Generate a DLP mod rho (in the large odd-order subgroup)
|
|
// Generate a DLP mod rho (in the large odd-order subgroup)
|
|
|
ZZ_p::init(rho);
|
|
ZZ_p::init(rho);
|
|
|
- ZZ_p base = power(random_ZZ_p(), 2);
|
|
|
|
|
- ZZ_p target = power(random_ZZ_p(), 2);
|
|
|
|
|
|
|
+ ZZ_p base;
|
|
|
|
|
+ ZZ_p target;
|
|
|
|
|
+ {
|
|
|
|
|
+#ifdef DERANDOMIZE
|
|
|
|
|
+ RandomStreamPush push_seed;
|
|
|
|
|
+ // the seed will be reset to its original value
|
|
|
|
|
+ // once we exit this scope
|
|
|
|
|
+ SetSeed(rho*p*q);
|
|
|
|
|
+#endif
|
|
|
|
|
+ base = power(random_ZZ_p(), 2);
|
|
|
|
|
+ target = power(random_ZZ_p(), 2);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
cout << "base = " << base << "\n";
|
|
cout << "base = " << base << "\n";
|
|
|
cout << "target = " << target << "\n";
|
|
cout << "target = " << target << "\n";
|