aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gp.c22
-rw-r--r--src/gp.h4
-rw-r--r--src/gp/gp.gp6
-rw-r--r--src/invalid/invalid.c1
-rw-r--r--src/io/output.c9
-rw-r--r--src/io/output.h3
-rw-r--r--src/math/curve.c1
-rw-r--r--src/math/point.c2
8 files changed, 13 insertions, 35 deletions
diff --git a/src/gp.c b/src/gp.c
index 5f51cd9..59cb11a 100644
--- a/src/gp.c
+++ b/src/gp.c
@@ -6,25 +6,3 @@ void init_gp(void) /* void */
avma = ltop;
return;
}
-
-/*
-* ecgen, tool for generating Elliptic curve domain parameters
-* Copyright (C) 2017 J08nY
-*/
-
-/*
-\r gp/utils
-\r gp/invalid
-*/
-
-GEN test(void) /* int */
-{
- pari_sp ltop = avma;
- GEN e = gen_0; /* ell */
- GEN p = gen_0;
- GEN i = gen_0, p1 = gen_0; /* int */
- p = genrand(e);
- p1 = i = gcopy(gel(p, 1));
- p1 = gerepilecopy(ltop, p1);
- return p1;
-}
diff --git a/src/gp.h b/src/gp.h
index b164c82..f066dec 100644
--- a/src/gp.h
+++ b/src/gp.h
@@ -8,9 +8,7 @@
#include <pari/pari.h>
/*
GP;install("init_gp","v","init_gp","./gp/gp.gp.so");
-GP;install("test","","test","./gp/gp.gp.so");
*/
void init_gp(void);
-GEN test(void);
/*End of prototype*/
-#endif // GP_H
+#endif //GP_H
diff --git a/src/gp/gp.gp b/src/gp/gp.gp
index 8c245a9..c6f9494 100644
--- a/src/gp/gp.gp
+++ b/src/gp/gp.gp
@@ -7,9 +7,3 @@
\r gp/utils
\r gp/invalid
*/
-
-test() = {
- local(e:ell, p, i:int);
- p = random(e);
- i = p[1];
-} \ No newline at end of file
diff --git a/src/invalid/invalid.c b/src/invalid/invalid.c
index 54aa7c1..1c21f89 100644
--- a/src/invalid/invalid.c
+++ b/src/invalid/invalid.c
@@ -136,6 +136,7 @@ int invalid_do(config_t *cfg) {
curve_free(&curve);
return 1;
}
+ output_csv(out, "%P#x", ',', curve_params(curve));
// now, generate primes upto order^2
pari_ulong *primes;
diff --git a/src/io/output.c b/src/io/output.c
index 27cdcf4..2e4d82d 100644
--- a/src/io/output.c
+++ b/src/io/output.c
@@ -20,7 +20,7 @@ char *output_scsv(const char *format, char delim, GEN vector) {
total += lengths[i];
}
- char *result = (char *)malloc(total + len);
+ char *result = (char *) malloc(total + len);
if (!result) {
perror("Couldn't malloc.");
exit(1);
@@ -48,7 +48,12 @@ void output_csv(FILE *out, const char *format, char delim, GEN vector) {
free(string);
}
-char *output_sjson(GEN vector) {}
+
+char *output_sjson(curve_t *curve) {
+ JSON_Value *root_value = json_value_init_object();
+ JSON_Object *root_object = json_value_get_object(root_value);
+ char *result = NULL;
+}
void output_json(FILE *out, GEN vector) {}
diff --git a/src/io/output.h b/src/io/output.h
index 0a2f91d..3adafce 100644
--- a/src/io/output.h
+++ b/src/io/output.h
@@ -7,6 +7,7 @@
#include <pari/pari.h>
#include <stdbool.h>
+#include "math/types.h"
/**
*
@@ -31,7 +32,7 @@ void output_csv(FILE *out, const char *format, char delim, GEN vector);
* @param vector
* @return
*/
-char *output_sjson(GEN vector);
+char *output_sjson(curve_t *curve);
/**
*
diff --git a/src/math/curve.c b/src/math/curve.c
index 2ff3d8f..8c8b514 100644
--- a/src/math/curve.c
+++ b/src/math/curve.c
@@ -29,6 +29,7 @@ curve_t *curve_copy(curve_t *src, curve_t *dest) {
dest->points = points_copy(src->points, dest->points, src->npoints);
dest->npoints = src->npoints;
}
+ return dest;
}
void curve_free(curve_t **curve) {
diff --git a/src/math/point.c b/src/math/point.c
index 2cf1042..0bedc11 100644
--- a/src/math/point.c
+++ b/src/math/point.c
@@ -102,7 +102,7 @@ int points_prime(curve_t *curve, config_t *config, ...) {
point_t *p = point_new();
p->point = point;
- p->order = ord;
+ p->order = gel(primes, i);
curve->points[i - 1] = p;
npoints++;
}