diff options
author | 2015-09-04 07:35:06 +0000 | |
---|---|---|
committer | 2015-09-04 07:35:06 +0000 | |
commit | ca6aa8198d2335f8c326c3dd4d26bf5899064214 (patch) | |
tree | 6274a2d971fc0cac0896efe8583927d0190e3d20 /moon-abe/pbc-0.5.14/gen/gengparam.c | |
parent | 92fd2dbfb672d7b2b1cdfd5dd5cf89f7716b3e12 (diff) | |
parent | 3baeb11a8fbcfcdbc31976d421f17b85503b3ecd (diff) |
Merge "init attribute-based encryption"
Diffstat (limited to 'moon-abe/pbc-0.5.14/gen/gengparam.c')
-rw-r--r-- | moon-abe/pbc-0.5.14/gen/gengparam.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/moon-abe/pbc-0.5.14/gen/gengparam.c b/moon-abe/pbc-0.5.14/gen/gengparam.c new file mode 100644 index 00000000..064f2b76 --- /dev/null +++ b/moon-abe/pbc-0.5.14/gen/gengparam.c @@ -0,0 +1,33 @@ +// Generate Freeman curves with a given discriminant. +#include "pbc.h" + +int generate(pbc_cm_t cm, void *data) { + UNUSED_VAR(data); + pbc_param_t param; + + pbc_info("gengparam: computing Hilbert polynomial and finding roots..."); + pbc_param_init_g_gen(param, cm); + pbc_info("gengparam: bits in q = %zu", mpz_sizeinbase(cm->q, 2)); + pbc_param_out_str(stdout, param); + pbc_param_clear(param); + return 1; +} + +int main(int argc, char **argv) { + int D = 35707; + + if (argc > 1) { + int m; + D = atoi(argv[1]); + m = D % 120; + if (D <= 0 || (m != 43 && m != 67)) { + pbc_die("D must be 43 or 67 mod 120 and positive"); + } + } + pbc_info("Using D = %d", D); + + if (!pbc_cm_search_g(generate, NULL, D, 500)) { + pbc_die("No suitable curves for this D"); + } + return 0; +} |