Normal basis support (translates to poly basis internally). Rewrite
[u/mdw/catacomb] / ec-gentab.sh
diff --git a/ec-gentab.sh b/ec-gentab.sh
deleted file mode 100755 (executable)
index 40fd853..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-#! /bin/sh
-
-set -e
-
-cat <<EOF
-/* -*-c-*-
- *
- * Table of standard elliptic curves [generated]
- */
-
-#include "ectab.h"
-
-#define N(x) (sizeof(x)/sizeof(*x))
-#define MP(x) { x, x + N(x), N(x), 0, MP_CONST, 0 }
-
-/*----- Curve data --------------------------------------------------------*/
-
-EOF
-
-names=""
-while read t n f; do
-
-  case $t in
-    curve) ;;
-    alias) names="$names $n=$f" continue;;
-    \#* | "") continue;;
-    *) echo >&2 "$0: unknown keyword $t"; exit 1;;
-  esac
-
-  names="$names $n=$n"
-  cat <<EOF
-/* --- Curve $n --- */
-
-EOF
-
-  n=`echo $n | sed 's/[^a-zA-Z0-9_][^a-zA-Z0-9_]*/_/g'`
-  case $f in
-    prime | niceprime | binpoly)
-      read t p;
-      if [ $t != p ]; then echo >&2 "$0: wanted p; found $t"; exit 1; fi
-      read t a
-      if [ $t != a ]; then echo >&2 "$0: wanted a; found $t"; exit 1; fi
-      read t b
-      if [ $t != b ]; then echo >&2 "$0: wanted b; found $t"; exit 1; fi
-
-      cat <<EOF
-static mpw c_${n}_p[] = {
-EOF
-      ./mpdump $p
-      cat <<EOF
-};
-
-static mpw c_${n}_a[] = {
-EOF
-      ./mpdump $a
-      cat <<EOF
-};
-
-static mpw c_${n}_b[] = {
-EOF
-      ./mpdump $b
-      cat <<EOF
-};
-
-EOF
-      ;;
-    *) echo >&2 "$0: unknown field type $f"; exit 1;;
-  esac
-
-  read t r
-  if [ $t != r ]; then echo >&2 "$0: wanted r; found $t"; exit 1; fi
-  read t h
-  if [ $t != h ]; then echo >&2 "$0: wanted h; found $t"; exit 1; fi
-  read t gx
-  if [ $t != gx ]; then echo >&2 "$0: wanted gx; found $t"; exit 1; fi
-  read t gy
-  if [ $t != gy ]; then echo >&2 "$0: wanted gy; found $t"; exit 1; fi
-
-  cat <<EOF
-static mpw c_${n}_r[] = {
-EOF
-  ./mpdump $r
-  cat <<EOF
-};
-
-static mpw c_${n}_h[] = {
-EOF
-  ./mpdump $h
-  cat <<EOF
-};
-
-static mpw c_${n}_gx[] = {
-EOF
-  ./mpdump $gx
-  cat <<EOF
-};
-
-static mpw c_${n}_gy[] = {
-EOF
-  ./mpdump $gy
-  cat <<EOF
-};
-
-EOF
-
-  case $f in
-    prime) ftag=FTAG_PRIME;;
-    niceprime) ftag=FTAG_NICEPRIME;;
-    binpoly) ftag=FTAG_BINPOLY;;
-  esac
-  cat <<EOF
-static ecdata c_$n = {
-  $ftag,
-  MP(c_${n}_p),
-  MP(c_${n}_a),
-  MP(c_${n}_b),
-  MP(c_${n}_r),
-  MP(c_${n}_h),
-  MP(c_${n}_gx),
-  MP(c_${n}_gy)
-};
-
-EOF
-
-done
-
-cat <<EOF
-/*----- Main table --------------------------------------------------------*/
-
-const ecentry ectab[] = {
-EOF
-for i in $names; do
-  a=`echo $i | sed 's/=.*$//'`
-  n=`echo $i | sed 's/^.*=//; s/[^a-zA-Z0-9_][^a-zA-Z0-9_]*/_/g'`
-  cat <<EOF
-  { "$a", &c_$n },
-EOF
-done
-cat <<EOF
-  { 0, 0 }
-};
-
-/*----- That's all, folks -------------------------------------------------*/
-EOF