aboutsummaryrefslogtreecommitdiff
path: root/src/curve.h
diff options
context:
space:
mode:
authorJ08nY2017-02-07 04:06:09 +0100
committerJ08nY2017-02-07 04:12:04 +0100
commit06d927c9737589ed76b516c54ee74c8e6e44702b (patch)
tree8e7560f66a96e5bf5bb391907c3678f65581631a /src/curve.h
parent96bf13d11b595aabf514c706adcf57aefc660a1f (diff)
downloadecgen-06d927c9737589ed76b516c54ee74c8e6e44702b.tar.gz
ecgen-06d927c9737589ed76b516c54ee74c8e6e44702b.tar.zst
ecgen-06d927c9737589ed76b516c54ee74c8e6e44702b.zip
Moved to a more modular generation process
Curves are now generated in a loop through a func. pointer array, built from cli args. - Allows complex behavior from simple funcs - a func can "rewind" previous generation steps, if it can not succesfuly guarantee that it will generate a curve/param/point with property requested. - e.g. curve_nonzero rewinds [b, a, field] (returns -3) if the curve specified by [field, a, b] has a zero discriminant. This way, [field, a, b] can be generated/produced/input again and a curve might get constructed that will be nonzero.
Diffstat (limited to 'src/curve.h')
-rw-r--r--src/curve.h87
1 files changed, 21 insertions, 66 deletions
diff --git a/src/curve.h b/src/curve.h
index 5002f45..e4e973c 100644
--- a/src/curve.h
+++ b/src/curve.h
@@ -6,110 +6,65 @@
#define ECGEN_CURVE_H
#include <pari/pari.h>
-#include "field.h"
-#include "point.h"
-
-typedef struct curve_t {
- GEN seed;
- GEN field;
- GEN a;
- GEN b;
- GEN curve;
- GEN order;
- point_t **points;
- size_t npoints;
-} curve_t;
-
-/**
- *
- * @param field
- * @return
- */
-curve_t *curve_random(GEN field);
-
-/**
- *
- * @param t
- * @param bits
- * @return
- */
-curve_t *curve_randomf(enum field_e t, long bits);
-
-/**
- *
- * @param field
- * @return
- */
-curve_t *curve_nonzero(GEN field);
+#include "cli.h"
+#include "types.h"
/**
*
- * @param t
- * @param bits
- * @return
- */
-curve_t *curve_nonzerof(enum field_e t, long bits);
-
-/**
- *
- * @param field
+ * @param curve
+ * @param config
* @return
*/
-curve_t *curve_prime(GEN field);
+int curve_init(curve_t *curve, config_t *config);
/**
*
- * @param t
- * @param bits
+ * @param curve
+ * @param config
* @return
*/
-curve_t *curve_primef(enum field_e t, long bits);
+int curve_nonzero(curve_t *curve, config_t *config);
/**
- * ANSI X9.62 Verifiable random curve over field with seed.
*
- * @param field
- * @param seed
+ * @param curve
+ * @param config
* @return
*/
-curve_t *curve_seed(GEN field, GEN seed);
+int curve_prime(curve_t *curve, config_t *config);
/**
*
- * @param field
+ * @param curve
+ * @param config
* @return
*/
-curve_t *curve_seedr(GEN field);
+int curve_seed(curve_t *curve, config_t *config);
/**
*
- * @param seed
- * @param t
- * @param bits
+ * @param curve
+ * @param config
* @return
*/
-curve_t *curve_seedf(GEN seed, enum field_e t, long bits);
+int curve_g(curve_t *curve, config_t *config);
/**
- *
- * @param t
- * @param bits
+ * @param curve
* @return
*/
-curve_t *curve_seedrf(enum field_e t, long bits);
+GEN curve_params(curve_t *curve);
/**
*
- * @param curve
* @return
*/
-GEN curve_params(curve_t *curve);
+curve_t *curve_new();
/**
*
* @param curve
*/
-void free_curve(curve_t **curve);
-
+void curve_free(curve_t **curve);
#endif // ECGEN_CURVE_H