Simplify |EC_METHOD| by removing invariant methods.

None of these methods vary per group. Factoring these out of
|EC_METHOD| should help some toolchains to do a better job optimizing
the code for size.

Change-Id: Ibd22a52992b4d549f12a8d22bddfdb3051aaa891
Reviewed-on: https://boringssl-review.googlesource.com/6172
Reviewed-by: Adam Langley <alangley@gmail.com>
diff --git a/crypto/ec/ec.c b/crypto/ec/ec.c
index a73044e..f2d5167 100644
--- a/crypto/ec/ec.c
+++ b/crypto/ec/ec.c
@@ -559,21 +559,13 @@
 
 int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *out_p, BIGNUM *out_a,
                            BIGNUM *out_b, BN_CTX *ctx) {
-  if (group->meth->group_get_curve == 0) {
-    OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-    return 0;
-  }
-  return group->meth->group_get_curve(group, out_p, out_a, out_b, ctx);
+  return ec_GFp_simple_group_get_curve(group, out_p, out_a, out_b, ctx);
 }
 
 int EC_GROUP_get_curve_name(const EC_GROUP *group) { return group->curve_name; }
 
 int EC_GROUP_get_degree(const EC_GROUP *group) {
-  if (group->meth->group_get_degree == 0) {
-    OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-    return 0;
-  }
-  return group->meth->group_get_degree(group);
+  return ec_GFp_simple_group_get_degree(group);
 }
 
 int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx) {
@@ -609,10 +601,6 @@
     OPENSSL_PUT_ERROR(EC, ERR_R_PASSED_NULL_PARAMETER);
     return NULL;
   }
-  if (group->meth->point_init == 0) {
-    OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-    return NULL;
-  }
 
   ret = OPENSSL_malloc(sizeof *ret);
   if (ret == NULL) {
@@ -622,7 +610,7 @@
 
   ret->meth = group->meth;
 
-  if (!ret->meth->point_init(ret)) {
+  if (!ec_GFp_simple_point_init(ret)) {
     OPENSSL_free(ret);
     return NULL;
   }
@@ -635,9 +623,8 @@
     return;
   }
 
-  if (point->meth->point_finish != 0) {
-    point->meth->point_finish(point);
-  }
+  ec_GFp_simple_point_finish(point);
+
   OPENSSL_free(point);
 }
 
@@ -646,20 +633,13 @@
     return;
   }
 
-  if (point->meth->point_clear_finish != 0) {
-    point->meth->point_clear_finish(point);
-  } else if (point->meth->point_finish != 0) {
-    point->meth->point_finish(point);
-  }
+  ec_GFp_simple_point_clear_finish(point);
+
   OPENSSL_cleanse(point, sizeof *point);
   OPENSSL_free(point);
 }
 
 int EC_POINT_copy(EC_POINT *dest, const EC_POINT *src) {
-  if (dest->meth->point_copy == 0) {
-    OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-    return 0;
-  }
   if (dest->meth != src->meth) {
     OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
     return 0;
@@ -667,7 +647,7 @@
   if (dest == src) {
     return 1;
   }
-  return dest->meth->point_copy(dest, src);
+  return ec_GFp_simple_point_copy(dest, src);
 }
 
 EC_POINT *EC_POINT_dup(const EC_POINT *a, const EC_GROUP *group) {
@@ -693,82 +673,58 @@
 }
 
 int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point) {
-  if (group->meth->point_set_to_infinity == 0) {
-    OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-    return 0;
-  }
   if (group->meth != point->meth) {
     OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
     return 0;
   }
-  return group->meth->point_set_to_infinity(group, point);
+  return ec_GFp_simple_point_set_to_infinity(group, point);
 }
 
 int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) {
-  if (group->meth->is_at_infinity == 0) {
-    OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-    return 0;
-  }
   if (group->meth != point->meth) {
     OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
     return 0;
   }
-  return group->meth->is_at_infinity(group, point);
+  return ec_GFp_simple_is_at_infinity(group, point);
 }
 
 int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
                          BN_CTX *ctx) {
-  if (group->meth->is_on_curve == 0) {
-    OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-    return 0;
-  }
   if (group->meth != point->meth) {
     OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
     return 0;
   }
-  return group->meth->is_on_curve(group, point, ctx);
+  return ec_GFp_simple_is_on_curve(group, point, ctx);
 }
 
 int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b,
                  BN_CTX *ctx) {
-  if (group->meth->point_cmp == 0) {
-    OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-    return -1;
-  }
   if ((group->meth != a->meth) || (a->meth != b->meth)) {
     OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
     return -1;
   }
-  return group->meth->point_cmp(group, a, b, ctx);
+  return ec_GFp_simple_cmp(group, a, b, ctx);
 }
 
 int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) {
-  if (group->meth->make_affine == 0) {
-    OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-    return 0;
-  }
   if (group->meth != point->meth) {
     OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
     return 0;
   }
-  return group->meth->make_affine(group, point, ctx);
+  return ec_GFp_simple_make_affine(group, point, ctx);
 }
 
 int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[],
                           BN_CTX *ctx) {
   size_t i;
 
-  if (group->meth->points_make_affine == 0) {
-    OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-    return 0;
-  }
   for (i = 0; i < num; i++) {
     if (group->meth != points[i]->meth) {
       OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
       return 0;
     }
   }
-  return group->meth->points_make_affine(group, num, points, ctx);
+  return ec_GFp_simple_points_make_affine(group, num, points, ctx);
 }
 
 int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
@@ -788,56 +744,40 @@
 int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *point,
                                         const BIGNUM *x, const BIGNUM *y,
                                         BN_CTX *ctx) {
-  if (group->meth->point_set_affine_coordinates == 0) {
-    OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-    return 0;
-  }
   if (group->meth != point->meth) {
     OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
     return 0;
   }
-  return group->meth->point_set_affine_coordinates(group, point, x, y, ctx);
+  return ec_GFp_simple_point_set_affine_coordinates(group, point, x, y, ctx);
 }
 
 int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
                  const EC_POINT *b, BN_CTX *ctx) {
-  if (group->meth->add == 0) {
-    OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-    return 0;
-  }
   if ((group->meth != r->meth) || (r->meth != a->meth) ||
       (a->meth != b->meth)) {
     OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
     return 0;
   }
-  return group->meth->add(group, r, a, b, ctx);
+  return ec_GFp_simple_add(group, r, a, b, ctx);
 }
 
 
 int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
                  BN_CTX *ctx) {
-  if (group->meth->dbl == 0) {
-    OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-    return 0;
-  }
   if ((group->meth != r->meth) || (r->meth != a->meth)) {
     OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
     return 0;
   }
-  return group->meth->dbl(group, r, a, ctx);
+  return ec_GFp_simple_dbl(group, r, a, ctx);
 }
 
 
 int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx) {
-  if (group->meth->invert == 0) {
-    OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-    return 0;
-  }
   if (group->meth != a->meth) {
     OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
     return 0;
   }
-  return group->meth->invert(group, a, ctx);
+  return ec_GFp_simple_invert(group, a, ctx);
 }
 
 int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar,
@@ -868,16 +808,12 @@
 int ec_point_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *point,
                                              const BIGNUM *x, const BIGNUM *y,
                                              const BIGNUM *z, BN_CTX *ctx) {
-  if (group->meth->point_set_Jprojective_coordinates_GFp == 0) {
-    OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-    return 0;
-  }
   if (group->meth != point->meth) {
     OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
     return 0;
   }
-  return group->meth->point_set_Jprojective_coordinates_GFp(group, point, x, y,
-                                                            z, ctx);
+  return ec_GFp_simple_set_Jprojective_coordinates_GFp(group, point, x, y, z,
+                                                       ctx);
 }
 
 void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag) {}
diff --git a/crypto/ec/ec_montgomery.c b/crypto/ec/ec_montgomery.c
index b897000..fde9844 100644
--- a/crypto/ec/ec_montgomery.c
+++ b/crypto/ec/ec_montgomery.c
@@ -75,41 +75,17 @@
 
 
 const EC_METHOD *EC_GFp_mont_method(void) {
-  static const EC_METHOD ret = {EC_FLAGS_DEFAULT_OCT,
-                                ec_GFp_mont_group_init,
+  static const EC_METHOD ret = {ec_GFp_mont_group_init,
                                 ec_GFp_mont_group_finish,
                                 ec_GFp_mont_group_clear_finish,
                                 ec_GFp_mont_group_copy,
                                 ec_GFp_mont_group_set_curve,
-                                ec_GFp_simple_group_get_curve,
-                                ec_GFp_simple_group_get_degree,
-                                ec_GFp_simple_group_check_discriminant,
-                                ec_GFp_simple_point_init,
-                                ec_GFp_simple_point_finish,
-                                ec_GFp_simple_point_clear_finish,
-                                ec_GFp_simple_point_copy,
-                                ec_GFp_simple_point_set_to_infinity,
-                                ec_GFp_simple_set_Jprojective_coordinates_GFp,
-                                ec_GFp_simple_get_Jprojective_coordinates_GFp,
-                                ec_GFp_simple_point_set_affine_coordinates,
                                 ec_GFp_simple_point_get_affine_coordinates,
-                                0,
-                                0,
-                                0,
-                                ec_GFp_simple_add,
-                                ec_GFp_simple_dbl,
-                                ec_GFp_simple_invert,
-                                ec_GFp_simple_is_at_infinity,
-                                ec_GFp_simple_is_on_curve,
-                                ec_GFp_simple_cmp,
-                                ec_GFp_simple_make_affine,
-                                ec_GFp_simple_points_make_affine,
                                 0 /* mul */,
                                 0 /* precompute_mult */,
                                 0 /* have_precompute_mult */,
                                 ec_GFp_mont_field_mul,
                                 ec_GFp_mont_field_sqr,
-                                0 /* field_div */,
                                 ec_GFp_mont_field_encode,
                                 ec_GFp_mont_field_decode,
                                 ec_GFp_mont_field_set_to_one};
diff --git a/crypto/ec/internal.h b/crypto/ec/internal.h
index 4b78c1b..836490a 100644
--- a/crypto/ec/internal.h
+++ b/crypto/ec/internal.h
@@ -79,13 +79,7 @@
 #endif
 
 
-/* Use default functions for poin2oct, oct2point and compressed coordinates */
-#define EC_FLAGS_DEFAULT_OCT 0x1
-
 struct ec_method_st {
-  /* Various method flags */
-  int flags;
-
   /* used by EC_GROUP_new, EC_GROUP_free, EC_GROUP_clear_free, EC_GROUP_copy: */
   int (*group_init)(EC_GROUP *);
   void (*group_finish)(EC_GROUP *);
@@ -96,66 +90,10 @@
   /* EC_GROUP_set_curve_GF2m, and EC_GROUP_get_curve_GF2m: */
   int (*group_set_curve)(EC_GROUP *, const BIGNUM *p, const BIGNUM *a,
                          const BIGNUM *b, BN_CTX *);
-  int (*group_get_curve)(const EC_GROUP *, BIGNUM *p, BIGNUM *a, BIGNUM *b,
-                         BN_CTX *);
 
-  /* used by EC_GROUP_get_degree: */
-  int (*group_get_degree)(const EC_GROUP *);
-
-  /* used by EC_GROUP_check: */
-  int (*group_check_discriminant)(const EC_GROUP *, BN_CTX *);
-
-  /* used by EC_POINT_new, EC_POINT_free, EC_POINT_clear_free, EC_POINT_copy: */
-  int (*point_init)(EC_POINT *);
-  void (*point_finish)(EC_POINT *);
-  void (*point_clear_finish)(EC_POINT *);
-  int (*point_copy)(EC_POINT *, const EC_POINT *);
-
-  /* used by EC_POINT_set_to_infinity,
-   * EC_POINT_set_Jprojective_coordinates_GFp,
-   * EC_POINT_get_Jprojective_coordinates_GFp,
-   * EC_POINT_set_affine_coordinates_GFp,     ..._GF2m,
-   * EC_POINT_get_affine_coordinates_GFp,     ..._GF2m,
-   * EC_POINT_set_compressed_coordinates_GFp, ..._GF2m:
-   */
-  int (*point_set_to_infinity)(const EC_GROUP *, EC_POINT *);
-  int (*point_set_Jprojective_coordinates_GFp)(const EC_GROUP *, EC_POINT *,
-                                               const BIGNUM *x, const BIGNUM *y,
-                                               const BIGNUM *z, BN_CTX *);
-  int (*point_get_Jprojective_coordinates_GFp)(const EC_GROUP *,
-                                               const EC_POINT *, BIGNUM *x,
-                                               BIGNUM *y, BIGNUM *z, BN_CTX *);
-  int (*point_set_affine_coordinates)(const EC_GROUP *, EC_POINT *,
-                                      const BIGNUM *x, const BIGNUM *y,
-                                      BN_CTX *);
+  /* used by EC_POINT_get_affine_coordinates_GFp: */
   int (*point_get_affine_coordinates)(const EC_GROUP *, const EC_POINT *,
                                       BIGNUM *x, BIGNUM *y, BN_CTX *);
-  int (*point_set_compressed_coordinates)(const EC_GROUP *, EC_POINT *,
-                                          const BIGNUM *x, int y_bit, BN_CTX *);
-
-  /* used by EC_POINT_point2oct, EC_POINT_oct2point: */
-  size_t (*point2oct)(const EC_GROUP *, const EC_POINT *,
-                      point_conversion_form_t form, unsigned char *buf,
-                      size_t len, BN_CTX *);
-  int (*oct2point)(const EC_GROUP *, EC_POINT *, const unsigned char *buf,
-                   size_t len, BN_CTX *);
-
-  /* used by EC_POINT_add, EC_POINT_dbl, ECP_POINT_invert: */
-  int (*add)(const EC_GROUP *, EC_POINT *r, const EC_POINT *a,
-             const EC_POINT *b, BN_CTX *);
-  int (*dbl)(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, BN_CTX *);
-  int (*invert)(const EC_GROUP *, EC_POINT *, BN_CTX *);
-
-  /* used by EC_POINT_is_at_infinity, EC_POINT_is_on_curve, EC_POINT_cmp: */
-  int (*is_at_infinity)(const EC_GROUP *, const EC_POINT *);
-  int (*is_on_curve)(const EC_GROUP *, const EC_POINT *, BN_CTX *);
-  int (*point_cmp)(const EC_GROUP *, const EC_POINT *a, const EC_POINT *b,
-                   BN_CTX *);
-
-  /* used by EC_POINT_make_affine, EC_POINTs_make_affine: */
-  int (*make_affine)(const EC_GROUP *, EC_POINT *, BN_CTX *);
-  int (*points_make_affine)(const EC_GROUP *, size_t num, EC_POINT * [],
-                            BN_CTX *);
 
   /* used by EC_POINTs_mul, EC_POINT_mul, EC_POINT_precompute_mult,
    * EC_POINT_have_precompute_mult
@@ -169,14 +107,12 @@
 
   /* internal functions */
 
-  /* 'field_mul', 'field_sqr', and 'field_div' can be used by 'add' and 'dbl'
-   * so that the same implementations of point operations can be used with
-   * different optimized implementations of expensive field operations: */
+  /* 'field_mul' and 'field_sqr' can be used by 'add' and 'dbl' so that the
+   * same implementations of point operations can be used with different
+   * optimized implementations of expensive field operations: */
   int (*field_mul)(const EC_GROUP *, BIGNUM *r, const BIGNUM *a,
                    const BIGNUM *b, BN_CTX *);
   int (*field_sqr)(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, BN_CTX *);
-  int (*field_div)(const EC_GROUP *, BIGNUM *r, const BIGNUM *a,
-                   const BIGNUM *b, BN_CTX *);
 
   int (*field_encode)(const EC_GROUP *, BIGNUM *r, const BIGNUM *a,
                       BN_CTX *); /* e.g. to Montgomery */
diff --git a/crypto/ec/oct.c b/crypto/ec/oct.c
index cb50e17..365dc3d 100644
--- a/crypto/ec/oct.c
+++ b/crypto/ec/oct.c
@@ -277,39 +277,21 @@
 
 int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point,
                        const uint8_t *buf, size_t len, BN_CTX *ctx) {
-  if (group->meth->oct2point == 0 &&
-      !(group->meth->flags & EC_FLAGS_DEFAULT_OCT)) {
-    OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-    return 0;
-  }
   if (group->meth != point->meth) {
     OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
     return 0;
   }
-  if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) {
-    return ec_GFp_simple_oct2point(group, point, buf, len, ctx);
-  }
-
-  return group->meth->oct2point(group, point, buf, len, ctx);
+  return ec_GFp_simple_oct2point(group, point, buf, len, ctx);
 }
 
 size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point,
                           point_conversion_form_t form, uint8_t *buf,
                           size_t len, BN_CTX *ctx) {
-  if (group->meth->point2oct == 0 &&
-      !(group->meth->flags & EC_FLAGS_DEFAULT_OCT)) {
-    OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-    return 0;
-  }
   if (group->meth != point->meth) {
     OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
     return 0;
   }
-  if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) {
-    return ec_GFp_simple_point2oct(group, point, form, buf, len, ctx);
-  }
-
-  return group->meth->point2oct(group, point, form, buf, len, ctx);
+  return ec_GFp_simple_point2oct(group, point, form, buf, len, ctx);
 }
 
 int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group,
@@ -452,19 +434,9 @@
 int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group,
                                             EC_POINT *point, const BIGNUM *x,
                                             int y_bit, BN_CTX *ctx) {
-  if (group->meth->point_set_compressed_coordinates == 0 &&
-      !(group->meth->flags & EC_FLAGS_DEFAULT_OCT)) {
-    OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-    return 0;
-  }
   if (group->meth != point->meth) {
     OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
     return 0;
   }
-  if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) {
-    return ec_GFp_simple_set_compressed_coordinates(group, point, x, y_bit,
-                                                    ctx);
-  }
-  return group->meth->point_set_compressed_coordinates(group, point, x, y_bit,
-                                                       ctx);
+  return ec_GFp_simple_set_compressed_coordinates(group, point, x, y_bit, ctx);
 }
diff --git a/crypto/ec/p224-64.c b/crypto/ec/p224-64.c
index f8527bc..1958a90 100644
--- a/crypto/ec/p224-64.c
+++ b/crypto/ec/p224-64.c
@@ -1320,41 +1320,17 @@
 }
 
 const EC_METHOD *EC_GFp_nistp224_method(void) {
-  static const EC_METHOD ret = {EC_FLAGS_DEFAULT_OCT,
-                                ec_GFp_nistp224_group_init,
+  static const EC_METHOD ret = {ec_GFp_nistp224_group_init,
                                 ec_GFp_simple_group_finish,
                                 ec_GFp_simple_group_clear_finish,
                                 ec_GFp_simple_group_copy,
                                 ec_GFp_nistp224_group_set_curve,
-                                ec_GFp_simple_group_get_curve,
-                                ec_GFp_simple_group_get_degree,
-                                ec_GFp_simple_group_check_discriminant,
-                                ec_GFp_simple_point_init,
-                                ec_GFp_simple_point_finish,
-                                ec_GFp_simple_point_clear_finish,
-                                ec_GFp_simple_point_copy,
-                                ec_GFp_simple_point_set_to_infinity,
-                                ec_GFp_simple_set_Jprojective_coordinates_GFp,
-                                ec_GFp_simple_get_Jprojective_coordinates_GFp,
-                                ec_GFp_simple_point_set_affine_coordinates,
                                 ec_GFp_nistp224_point_get_affine_coordinates,
-                                0 /* point_set_compressed_coordinates */,
-                                0 /* point2oct */,
-                                0 /* oct2point */,
-                                ec_GFp_simple_add,
-                                ec_GFp_simple_dbl,
-                                ec_GFp_simple_invert,
-                                ec_GFp_simple_is_at_infinity,
-                                ec_GFp_simple_is_on_curve,
-                                ec_GFp_simple_cmp,
-                                ec_GFp_simple_make_affine,
-                                ec_GFp_simple_points_make_affine,
                                 ec_GFp_nistp224_points_mul,
                                 0 /* precompute_mult */,
                                 0 /* have_precompute_mult */,
                                 ec_GFp_simple_field_mul,
                                 ec_GFp_simple_field_sqr,
-                                0 /* field_div */,
                                 0 /* field_encode */,
                                 0 /* field_decode */,
                                 0 /* field_set_to_one */};
diff --git a/crypto/ec/p256-64.c b/crypto/ec/p256-64.c
index 3946b29..bc657cd 100644
--- a/crypto/ec/p256-64.c
+++ b/crypto/ec/p256-64.c
@@ -1902,26 +1902,14 @@
 
 const EC_METHOD *EC_GFp_nistp256_method(void) {
   static const EC_METHOD ret = {
-      EC_FLAGS_DEFAULT_OCT,
       ec_GFp_nistp256_group_init,
       ec_GFp_simple_group_finish,
       ec_GFp_simple_group_clear_finish,
       ec_GFp_simple_group_copy, ec_GFp_nistp256_group_set_curve,
-      ec_GFp_simple_group_get_curve, ec_GFp_simple_group_get_degree,
-      ec_GFp_simple_group_check_discriminant, ec_GFp_simple_point_init,
-      ec_GFp_simple_point_finish, ec_GFp_simple_point_clear_finish,
-      ec_GFp_simple_point_copy, ec_GFp_simple_point_set_to_infinity,
-      ec_GFp_simple_set_Jprojective_coordinates_GFp,
-      ec_GFp_simple_get_Jprojective_coordinates_GFp,
-      ec_GFp_simple_point_set_affine_coordinates,
       ec_GFp_nistp256_point_get_affine_coordinates,
-      0 /* point_set_compressed_coordinates */, 0 /* point2oct */,
-      0 /* oct2point */, ec_GFp_simple_add, ec_GFp_simple_dbl,
-      ec_GFp_simple_invert, ec_GFp_simple_is_at_infinity,
-      ec_GFp_simple_is_on_curve, ec_GFp_simple_cmp, ec_GFp_simple_make_affine,
-      ec_GFp_simple_points_make_affine, ec_GFp_nistp256_points_mul,
+      ec_GFp_nistp256_points_mul,
       0 /* precompute_mult */, 0 /* have_precompute_mult */,
-      ec_GFp_simple_field_mul, ec_GFp_simple_field_sqr, 0 /* field_div */,
+      ec_GFp_simple_field_mul, ec_GFp_simple_field_sqr,
       0 /* field_encode */, 0 /* field_decode */, 0 /* field_set_to_one */
   };
 
diff --git a/crypto/ec/simple.c b/crypto/ec/simple.c
index c62199c..9381028 100644
--- a/crypto/ec/simple.c
+++ b/crypto/ec/simple.c
@@ -77,41 +77,17 @@
 
 
 const EC_METHOD *EC_GFp_simple_method(void) {
-  static const EC_METHOD ret = {EC_FLAGS_DEFAULT_OCT,
-                                ec_GFp_simple_group_init,
+  static const EC_METHOD ret = {ec_GFp_simple_group_init,
                                 ec_GFp_simple_group_finish,
                                 ec_GFp_simple_group_clear_finish,
                                 ec_GFp_simple_group_copy,
                                 ec_GFp_simple_group_set_curve,
-                                ec_GFp_simple_group_get_curve,
-                                ec_GFp_simple_group_get_degree,
-                                ec_GFp_simple_group_check_discriminant,
-                                ec_GFp_simple_point_init,
-                                ec_GFp_simple_point_finish,
-                                ec_GFp_simple_point_clear_finish,
-                                ec_GFp_simple_point_copy,
-                                ec_GFp_simple_point_set_to_infinity,
-                                ec_GFp_simple_set_Jprojective_coordinates_GFp,
-                                ec_GFp_simple_get_Jprojective_coordinates_GFp,
-                                ec_GFp_simple_point_set_affine_coordinates,
                                 ec_GFp_simple_point_get_affine_coordinates,
-                                0,
-                                0,
-                                0,
-                                ec_GFp_simple_add,
-                                ec_GFp_simple_dbl,
-                                ec_GFp_simple_invert,
-                                ec_GFp_simple_is_at_infinity,
-                                ec_GFp_simple_is_on_curve,
-                                ec_GFp_simple_cmp,
-                                ec_GFp_simple_make_affine,
-                                ec_GFp_simple_points_make_affine,
                                 0 /* mul */,
                                 0 /* precompute_mult */,
                                 0 /* have_precompute_mult */,
                                 ec_GFp_simple_field_mul,
                                 ec_GFp_simple_field_sqr,
-                                0 /* field_div */,
                                 0 /* field_encode */,
                                 0 /* field_decode */,
                                 0 /* field_set_to_one */};