move EC_GROUP_get_basis_type() from ec_lib.c to ec_asn1.c
authorBodo Möller <bodo@openssl.org>
Mon, 26 Aug 2002 11:33:13 +0000 (11:33 +0000)
committerBodo Möller <bodo@openssl.org>
Mon, 26 Aug 2002 11:33:13 +0000 (11:33 +0000)
crypto/ec/ec.h
crypto/ec/ec_asn1.c
crypto/ec/ec_lcl.h
crypto/ec/ec_lib.c

index 51cc3f8..e401eb7 100644 (file)
@@ -191,12 +191,6 @@ const char *EC_GROUP_get0_comment(int nid);
  * with the given index i from the internal curve list */
 int ec_group_index2nid(int i);
 
-/* EC_GROUP_get_basis_type() returns the NID of the basis type
- * used to represent the field elements (in case of a pentanomial or trinomial
- * basis the coefficient are returned in the k? arguments) */
-int EC_GROUP_get_basis_type(const EC_GROUP *, unsigned int *k1,
-       unsigned int *k2, unsigned int *k3);
-
 
 /* EC_POINT functions */
 
@@ -261,6 +255,13 @@ int EC_GROUP_precompute_mult(EC_GROUP *, BN_CTX *);
 
 
 /* ASN1 stuff */
+
+/* EC_GROUP_get_basis_type() returns the NID of the basis type
+ * used to represent the field elements (in case of a pentanomial or trinomial
+ * basis the coefficient are returned in the k? arguments) */
+int EC_GROUP_get_basis_type(const EC_GROUP *, unsigned int *k1,
+       unsigned int *k2, unsigned int *k3);
+
 #define OPENSSL_EC_NAMED_CURVE 0x001
 
 typedef struct ecpk_parameters_st ECPKPARAMETERS;
index 26f3916..8b0167b 100644 (file)
 #include <openssl/asn1t.h>
 #include <openssl/objects.h>
 
+
+int EC_GROUP_get_basis_type(const EC_GROUP *group, unsigned int *k1, 
+       unsigned int *k2, unsigned int *k3)
+       {
+       int i = 0;
+
+       if (group == NULL)
+               return 0;
+
+       if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) !=
+               NID_X9_62_characteristic_two_field)
+               /* everything else is currently not supported */
+               return 0;
+
+       while (group->poly[i] != 0)
+               i++;
+
+       if (i == 4)
+               {
+               if (k1)
+                       *k1 = group->poly[3];
+               if (k2)
+                       *k2 = group->poly[2];
+               if (k3)
+                       *k3 = group->poly[1];
+
+               return NID_X9_62_ppBasis;
+               }
+       else if (i == 2)
+               {
+               if (k1)
+                       *k1 = group->poly[1];
+
+               return NID_X9_62_tpBasis;
+               }
+       else
+               /* everything else is currently not supported */
+               return 0;
+       }
+
+
+
 /* some structures needed for the asn1 encoding */
 typedef struct x9_62_fieldid_st {
         ASN1_OBJECT *fieldType;
index 247c985..ae67ccf 100644 (file)
 #include <openssl/ec.h>
 
 
+/* internal function: ec_group_index2nid() returns the NID of curve
+ * with the given index i from the internal curve list */
+int ec_group_index2nid(int i);
+
+
 /* Structure details are not part of the exported interface,
  * so all this may change in future versions. */
 
index 9bccb07..9669f42 100644 (file)
@@ -537,45 +537,6 @@ void EC_GROUP_clear_free_extra_data(EC_GROUP *group)
        }
 
 
-int EC_GROUP_get_basis_type(const EC_GROUP *group, unsigned int *k1, 
-       unsigned int *k2, unsigned int *k3)
-       {
-       int i = 0;
-
-       if (group == NULL)
-               return 0;
-
-       if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) !=
-               NID_X9_62_characteristic_two_field)
-               /* everything else is currently not supported */
-               return 0;
-
-       while (group->poly[i] != 0)
-               i++;
-
-       if (i == 4)
-               {
-               if (k1)
-                       *k1 = group->poly[3];
-               if (k2)
-                       *k2 = group->poly[2];
-               if (k3)
-                       *k3 = group->poly[1];
-
-               return NID_X9_62_ppBasis;
-               }
-       else if (i == 2)
-               {
-               if (k1)
-                       *k1 = group->poly[1];
-
-               return NID_X9_62_tpBasis;
-               }
-       else
-               /* everything else is currently not supported */
-               return 0;
-       }
-
 /* functions for EC_POINT objects */
 
 EC_POINT *EC_POINT_new(const EC_GROUP *group)