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 51cc3f8c08dc2920e26c3028fc081889adda331b..e401eb739c969bec8081e771d6fac34713c5f7e5 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 26f3916d014d84c6317ba366b94b15f997660664..8b0167bd60fe9ec5bae19c7c9ab4f632994104ba 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 247c985a236d85c3afff0146f175b3f93aaafb60..ae67ccfdc24bf9c62ef6453f2ef68886f38fe722 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 9bccb073c6f45ba8efc88f5f8384dc8dde0685ed..9669f42aab94ebe10791c773236a1b209fc05d3f 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)