]> git.ipfire.org Git - thirdparty/openssl.git/blobdiff - crypto/ec/ec_lib.c
Rename implementations of method functions so that they match
[thirdparty/openssl.git] / crypto / ec / ec_lib.c
index 53da1d305758a291f903dff04b771127315dea5e..9669f42aab94ebe10791c773236a1b209fc05d3f 100644 (file)
@@ -1,4 +1,7 @@
 /* crypto/ec/ec_lib.c */
+/*
+ * Originally written by Bodo Moeller for the OpenSSL project.
+ */
 /* ====================================================================
  * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
  *
@@ -655,7 +658,7 @@ int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point)
 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 == 0)
+       if (group->meth->point_set_Jprojective_coordinates_GFp == 0)
                {
                ECerr(EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
                return 0;
@@ -665,14 +668,14 @@ int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *po
                ECerr(EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP, EC_R_INCOMPATIBLE_OBJECTS);
                return 0;
                }
-       return group->meth->point_set_Jprojective_coordinates(group, point, x, y, z, ctx);
+       return group->meth->point_set_Jprojective_coordinates_GFp(group, point, x, y, z, ctx);
        }
 
 
 int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, const EC_POINT *point,
        BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx)
        {
-       if (group->meth->point_get_Jprojective_coordinates == 0)
+       if (group->meth->point_get_Jprojective_coordinates_GFp == 0)
                {
                ECerr(EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
                return 0;
@@ -682,7 +685,7 @@ int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, const EC_POI
                ECerr(EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP, EC_R_INCOMPATIBLE_OBJECTS);
                return 0;
                }
-       return group->meth->point_get_Jprojective_coordinates(group, point, x, y, z, ctx);
+       return group->meth->point_get_Jprojective_coordinates_GFp(group, point, x, y, z, ctx);
        }
 
 
@@ -703,105 +706,71 @@ int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *point,
        }
 
 
-int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, const EC_POINT *point,
-       BIGNUM *x, BIGNUM *y, BN_CTX *ctx)
-       {
-       if (group->meth->point_get_affine_coordinates == 0)
-               {
-               ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-               return 0;
-               }
-       if (group->meth != point->meth)
-               {
-               ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP, EC_R_INCOMPATIBLE_OBJECTS);
-               return 0;
-               }
-       return group->meth->point_get_affine_coordinates(group, point, x, y, ctx);
-       }
-
-
-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)
-               {
-               ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
-               return 0;
-               }
-       if (group->meth != point->meth)
-               {
-               ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP, EC_R_INCOMPATIBLE_OBJECTS);
-               return 0;
-               }
-       return group->meth->point_set_compressed_coordinates(group, point, x, y_bit, ctx);
-       }
-
-
-int EC_POINT_set_Jprojective_coordinates_GF2m(const EC_GROUP *group, EC_POINT *point,
-       const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx)
+int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *point,
+       const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx)
        {
-       if (group->meth->point_set_Jprojective_coordinates == 0)
+       if (group->meth->point_set_affine_coordinates == 0)
                {
-               ECerr(EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GF2M, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
+               ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
                return 0;
                }
        if (group->meth != point->meth)
                {
-               ECerr(EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GF2M, EC_R_INCOMPATIBLE_OBJECTS);
+               ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M, EC_R_INCOMPATIBLE_OBJECTS);
                return 0;
                }
-       return group->meth->point_set_Jprojective_coordinates(group, point, x, y, z, ctx);
+       return group->meth->point_set_affine_coordinates(group, point, x, y, ctx);
        }
 
 
-int EC_POINT_get_Jprojective_coordinates_GF2m(const EC_GROUP *group, const EC_POINT *point,
-       BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx)
+int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, const EC_POINT *point,
+       BIGNUM *x, BIGNUM *y, BN_CTX *ctx)
        {
-       if (group->meth->point_get_Jprojective_coordinates == 0)
+       if (group->meth->point_get_affine_coordinates == 0)
                {
-               ECerr(EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GF2M, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
+               ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
                return 0;
                }
        if (group->meth != point->meth)
                {
-               ECerr(EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GF2M, EC_R_INCOMPATIBLE_OBJECTS);
+               ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP, EC_R_INCOMPATIBLE_OBJECTS);
                return 0;
                }
-       return group->meth->point_get_Jprojective_coordinates(group, point, x, y, z, ctx);
+       return group->meth->point_get_affine_coordinates(group, point, x, y, ctx);
        }
 
 
-int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *point,
-       const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx)
+int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, const EC_POINT *point,
+       BIGNUM *x, BIGNUM *y, BN_CTX *ctx)
        {
-       if (group->meth->point_set_affine_coordinates == 0)
+       if (group->meth->point_get_affine_coordinates == 0)
                {
-               ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
+               ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
                return 0;
                }
        if (group->meth != point->meth)
                {
-               ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M, EC_R_INCOMPATIBLE_OBJECTS);
+               ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M, EC_R_INCOMPATIBLE_OBJECTS);
                return 0;
                }
-       return group->meth->point_set_affine_coordinates(group, point, x, y, ctx);
+       return group->meth->point_get_affine_coordinates(group, point, x, y, ctx);
        }
 
 
-int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, const EC_POINT *point,
-       BIGNUM *x, BIGNUM *y, BN_CTX *ctx)
+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_get_affine_coordinates == 0)
+       if (group->meth->point_set_compressed_coordinates == 0)
                {
-               ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
+               ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
                return 0;
                }
        if (group->meth != point->meth)
                {
-               ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M, EC_R_INCOMPATIBLE_OBJECTS);
+               ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP, EC_R_INCOMPATIBLE_OBJECTS);
                return 0;
                }
-       return group->meth->point_get_affine_coordinates(group, point, x, y, ctx);
+       return group->meth->point_set_compressed_coordinates(group, point, x, y_bit, ctx);
        }