aboutsummaryrefslogtreecommitdiff
path: root/src/gen
diff options
context:
space:
mode:
authorJ08nY2017-09-19 12:47:45 +0200
committerJ08nY2017-09-19 12:47:45 +0200
commit3e8c233f7aa720608bf6b82744948eb1709e1d84 (patch)
treeb05187c9dc01caa0fa6e3ec99240ac232aaceffe /src/gen
parent3fad579c3cbcbce457f36af6c1ceff37ec04ee54 (diff)
downloadecgen-3e8c233f7aa720608bf6b82744948eb1709e1d84.tar.gz
ecgen-3e8c233f7aa720608bf6b82744948eb1709e1d84.tar.zst
ecgen-3e8c233f7aa720608bf6b82744948eb1709e1d84.zip
Diffstat (limited to 'src/gen')
-rw-r--r--src/gen/curve.c2
-rw-r--r--src/gen/curve.h2
-rw-r--r--src/gen/equation.h2
-rw-r--r--src/gen/field.h2
-rw-r--r--src/gen/gens.h2
-rw-r--r--src/gen/order.h2
-rw-r--r--src/gen/point.h2
-rw-r--r--src/gen/seed.c4
-rw-r--r--src/gen/seed.h2
-rw-r--r--src/gen/types.c9
-rw-r--r--src/gen/types.h156
11 files changed, 10 insertions, 175 deletions
diff --git a/src/gen/curve.c b/src/gen/curve.c
index 80483a6..3a8d00d 100644
--- a/src/gen/curve.c
+++ b/src/gen/curve.c
@@ -2,7 +2,7 @@
* ecgen, tool for generating Elliptic curve domain parameters
* Copyright (C) 2017 J08nY
*/
-#include <io/config.h>
+#include <misc/config.h>
#include "curve.h"
#include "point.h"
#include "seed.h"
diff --git a/src/gen/curve.h b/src/gen/curve.h
index 384c8ca..f5e6553 100644
--- a/src/gen/curve.h
+++ b/src/gen/curve.h
@@ -9,7 +9,7 @@
#define ECGEN_CURVE_H
#include <pari/pari.h>
-#include "types.h"
+#include "misc/types.h"
/**
* GENERATOR(gen_t)
diff --git a/src/gen/equation.h b/src/gen/equation.h
index 58e2e6e..665c153 100644
--- a/src/gen/equation.h
+++ b/src/gen/equation.h
@@ -8,7 +8,7 @@
#ifndef ECGEN_EQUATION_H
#define ECGEN_EQUATION_H
-#include "types.h"
+#include "misc/types.h"
/**
* GENERATOR(gen_t)
diff --git a/src/gen/field.h b/src/gen/field.h
index 04af2c6..da31298 100644
--- a/src/gen/field.h
+++ b/src/gen/field.h
@@ -8,7 +8,7 @@
#ifndef ECGEN_FIELD_H
#define ECGEN_FIELD_H
-#include "types.h"
+#include "misc/types.h"
/**
* GENERATOR(gen_t)
diff --git a/src/gen/gens.h b/src/gen/gens.h
index f46efbf..c9e8169 100644
--- a/src/gen/gens.h
+++ b/src/gen/gens.h
@@ -9,7 +9,7 @@
#ifndef ECGEN_GENS_H
#define ECGEN_GENS_H
-#include "types.h"
+#include "misc/types.h"
/**
* GENERATOR(gen_t)
diff --git a/src/gen/order.h b/src/gen/order.h
index da62c4d..e798012 100644
--- a/src/gen/order.h
+++ b/src/gen/order.h
@@ -8,7 +8,7 @@
#ifndef ECGEN_ORDER_H
#define ECGEN_ORDER_H
-#include "types.h"
+#include "misc/types.h"
/**
* GENERATOR(gen_t)
diff --git a/src/gen/point.h b/src/gen/point.h
index c8cae17..fdca6f7 100644
--- a/src/gen/point.h
+++ b/src/gen/point.h
@@ -8,7 +8,7 @@
#ifndef ECGEN_POINT_H
#define ECGEN_POINT_H
-#include "types.h"
+#include "misc/types.h"
/**
*
diff --git a/src/gen/seed.c b/src/gen/seed.c
index a962d03..1653a50 100644
--- a/src/gen/seed.c
+++ b/src/gen/seed.c
@@ -4,9 +4,9 @@
*/
#include "seed.h"
-#include <io/config.h>
+#include <misc/config.h>
#include "io/output.h"
-#include "types.h"
+#include "misc/types.h"
#include "util/bits.h"
#include "util/memory.h"
diff --git a/src/gen/seed.h b/src/gen/seed.h
index e6499b8..c89fc1d 100644
--- a/src/gen/seed.h
+++ b/src/gen/seed.h
@@ -9,7 +9,7 @@
#define ECGEN_SEED_H
#include "io/input.h"
-#include "types.h"
+#include "misc/types.h"
/**
* @brief
diff --git a/src/gen/types.c b/src/gen/types.c
deleted file mode 100644
index 63d5401..0000000
--- a/src/gen/types.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * ecgen, tool for generating Elliptic curve domain parameters
- * Copyright (C) 2017 J08nY
- */
-#include "types.h"
-
-GENERATOR(gen_skip) { return 1; }
-
-UNROLL(unroll_skip) { return -1; }
diff --git a/src/gen/types.h b/src/gen/types.h
deleted file mode 100644
index 38d8a64..0000000
--- a/src/gen/types.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * ecgen, tool for generating Elliptic curve domain parameters
- * Copyright (C) 2017 J08nY
- */
-/**
- * @file types.h
- */
-#ifndef ECGEN_TYPES_H
-#define ECGEN_TYPES_H
-
-#include <limits.h>
-#include <pari/pari.h>
-#include "io/config.h"
-
-/**
- * @brief
- * @param bits
- * @param bitlen
- * @param allocated
- */
-typedef struct {
- unsigned char *bits;
- size_t bitlen;
- size_t allocated;
-} bits_t;
-
-/**
- * @brief
- */
-typedef struct seed_t {
- bits_t *seed;
- unsigned char *hash20;
- union {
- struct {
- GEN t;
- GEN s;
- GEN h;
- GEN r;
- } ansi;
- struct {
- bits_t *f;
- } brainpool;
- };
-} seed_t;
-
-/**
- * @brief A point type.
- * @param point a t_VEC with t_INTMOD or t_FFELT components [x,y]
- * @param order a t_INT
- * @param cofactor a t_INT
- */
-typedef struct {
- GEN point;
- GEN order;
- GEN cofactor;
-} point_t;
-
-/**
- * @brief A curve type.
- * @param seed a seed_t
- * @param field a t_INT or t_FFELT
- * @param a a t_INTMOD or t_FFELT a parameter
- * @param b a t_INTMOD or t_FFELT b parameter
- * @param curve a t_ELL, curve object
- * @param order a t_INT, curve order
- * @param generators generators saved
- * @param ngens numver of generators saved in the curve type
- * @param points points saved
- * @param npoints number of points saved in the curve type
- */
-typedef struct {
- seed_t *seed;
- GEN field;
- GEN a;
- GEN b;
- GEN curve;
- GEN order;
- point_t **generators;
- size_t ngens;
- point_t **points;
- size_t npoints;
-} curve_t;
-
-/**
- * @brief
- */
-typedef enum {
- OFFSET_SEED = 0,
- OFFSET_FIELD,
- OFFSET_A,
- OFFSET_B,
- OFFSET_CURVE,
- OFFSET_ORDER,
- OFFSET_GENERATORS,
- OFFSET_POINTS,
- OFFSET_END
-} offset_e;
-
-/**
- * @brief
- */
-typedef struct {
- const void *args;
- size_t nargs;
- void *allocd;
-} arg_t;
-
-/**
- * @brief A generator function type.
- * @param curve A curve_t being generated
- * @param cfg An application config
- * @param args Current optional generator argument
- * @return state diff
- */
-#define GENERATOR(gen_name) \
- int gen_name(curve_t *curve, const config_t *cfg, arg_t *args)
-
-typedef GENERATOR((*gen_t));
-
-/**
- * @brief An unroll function type
- * @param curve
- * @param cfg
- * @param from
- * @param to
- * @return
- */
-#define UNROLL(unroll_name) \
- int unroll_name(curve_t *curve, const config_t *cfg, pari_sp from, \
- pari_sp to)
-
-typedef UNROLL((*unroll_t));
-
-/**
- * GENERATOR(gen_t)
- *
- *
- * @param curve A curve_t being generated
- * @param cfg An application config
- * @param args unused
- * @return state diff
- */
-GENERATOR(gen_skip);
-
-/**
- * UNROLL(unroll_t)
- *
- * @param curve
- * @param cfg
- * @param from
- * @param to
- * @return
- */
-UNROLL(unroll_skip);
-
-#endif // ECGEN_TYPES_H