diff options
Diffstat (limited to 'src/math/order.c')
| -rw-r--r-- | src/math/order.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/math/order.c b/src/math/order.c new file mode 100644 index 0000000..5e15279 --- /dev/null +++ b/src/math/order.c @@ -0,0 +1,21 @@ +/* + * ecgen, tool for generating Elliptic curve domain parameters + * Copyright (C) 2017 J08nY + */ +#include "order.h" + +int order_init(curve_t *curve, config_t *cfg, ...) { + curve->order = ellff_get_card(curve->curve); + return 1; +} + +int order_prime(curve_t *curve, config_t *cfg, ...) { + pari_sp ltop = avma; + curve->order = ellsea(curve->curve, 1); + if (gequal0(curve->order) || !(isprime(curve->order))) { + avma = ltop; + return -4; + } else { + return 1; + } +}
\ No newline at end of file |
