aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gen/field.c1
-rw-r--r--src/misc/compat.h21
2 files changed, 22 insertions, 0 deletions
diff --git a/src/gen/field.c b/src/gen/field.c
index 7780406..3c93880 100644
--- a/src/gen/field.c
+++ b/src/gen/field.c
@@ -6,6 +6,7 @@
#include "io/input.h"
#include "io/output.h"
#include "math/poly.h"
+#include "misc/compat.h"
static GEN field_primer(unsigned long bits) { return random_prime(bits); }
diff --git a/src/misc/compat.h b/src/misc/compat.h
new file mode 100644
index 0000000..624d13f
--- /dev/null
+++ b/src/misc/compat.h
@@ -0,0 +1,21 @@
+/*
+ * ecgen, tool for generating Elliptic curve domain parameters
+ * Copyright (C) 2021 J08nY
+ */
+/**
+ * @file compat.h
+ */
+#ifndef ECGEN_MISC_COMPAT_H
+#define ECGEN_MISC_COMPAT_H
+
+#define PARI_VERSION_PATCH (PARI_VERSION_CODE & 0xff)
+#define PARI_VERSION_MINOR (((PARI_VERSION_CODE) >> 8) & 0xff)
+#define PARI_VERSION_MAJOR (PARI_VERSION_CODE >> 16)
+
+#if !(((PARI_VERSION_MAJOR == 2) && (PARI_VERSION_MINOR == 12) && (PARI_VERSION_PATCH >= 2)) || ((PARI_VERSION_MAJOR >= 2) && (PARI_VERSION_MINOR >= 12)))
+// pari < 2.12.2
+#define polisirreducible isirreducible
+#endif
+
+
+#endif // ECGEN_MISC_COMPAT_H