security/nss/lib/freebl/ecl/ec2.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/nss/lib/freebl/ecl/ec2.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,92 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#ifndef __ec2_h_
     1.9 +#define __ec2_h_
    1.10 +
    1.11 +#include "ecl-priv.h"
    1.12 +
    1.13 +/* Checks if point P(px, py) is at infinity.  Uses affine coordinates. */
    1.14 +mp_err ec_GF2m_pt_is_inf_aff(const mp_int *px, const mp_int *py);
    1.15 +
    1.16 +/* Sets P(px, py) to be the point at infinity.  Uses affine coordinates. */
    1.17 +mp_err ec_GF2m_pt_set_inf_aff(mp_int *px, mp_int *py);
    1.18 +
    1.19 +/* Computes R = P + Q where R is (rx, ry), P is (px, py) and Q is (qx,
    1.20 + * qy). Uses affine coordinates. */
    1.21 +mp_err ec_GF2m_pt_add_aff(const mp_int *px, const mp_int *py,
    1.22 +						  const mp_int *qx, const mp_int *qy, mp_int *rx,
    1.23 +						  mp_int *ry, const ECGroup *group);
    1.24 +
    1.25 +/* Computes R = P - Q.  Uses affine coordinates. */
    1.26 +mp_err ec_GF2m_pt_sub_aff(const mp_int *px, const mp_int *py,
    1.27 +						  const mp_int *qx, const mp_int *qy, mp_int *rx,
    1.28 +						  mp_int *ry, const ECGroup *group);
    1.29 +
    1.30 +/* Computes R = 2P.  Uses affine coordinates. */
    1.31 +mp_err ec_GF2m_pt_dbl_aff(const mp_int *px, const mp_int *py, mp_int *rx,
    1.32 +						  mp_int *ry, const ECGroup *group);
    1.33 +
    1.34 +/* Validates a point on a GF2m curve. */
    1.35 +mp_err ec_GF2m_validate_point(const mp_int *px, const mp_int *py, const ECGroup *group);
    1.36 +
    1.37 +/* by default, this routine is unused and thus doesn't need to be compiled */
    1.38 +#ifdef ECL_ENABLE_GF2M_PT_MUL_AFF
    1.39 +/* Computes R = nP where R is (rx, ry) and P is (px, py). The parameters
    1.40 + * a, b and p are the elliptic curve coefficients and the irreducible that 
    1.41 + * determines the field GF2m.  Uses affine coordinates. */
    1.42 +mp_err ec_GF2m_pt_mul_aff(const mp_int *n, const mp_int *px,
    1.43 +						  const mp_int *py, mp_int *rx, mp_int *ry,
    1.44 +						  const ECGroup *group);
    1.45 +#endif
    1.46 +
    1.47 +/* Computes R = nP where R is (rx, ry) and P is (px, py). The parameters
    1.48 + * a, b and p are the elliptic curve coefficients and the irreducible that 
    1.49 + * determines the field GF2m.  Uses Montgomery projective coordinates. */
    1.50 +mp_err ec_GF2m_pt_mul_mont(const mp_int *n, const mp_int *px,
    1.51 +						   const mp_int *py, mp_int *rx, mp_int *ry,
    1.52 +						   const ECGroup *group);
    1.53 +
    1.54 +#ifdef ECL_ENABLE_GF2M_PROJ
    1.55 +/* Converts a point P(px, py) from affine coordinates to projective
    1.56 + * coordinates R(rx, ry, rz). */
    1.57 +mp_err ec_GF2m_pt_aff2proj(const mp_int *px, const mp_int *py, mp_int *rx,
    1.58 +						   mp_int *ry, mp_int *rz, const ECGroup *group);
    1.59 +
    1.60 +/* Converts a point P(px, py, pz) from projective coordinates to affine
    1.61 + * coordinates R(rx, ry). */
    1.62 +mp_err ec_GF2m_pt_proj2aff(const mp_int *px, const mp_int *py,
    1.63 +						   const mp_int *pz, mp_int *rx, mp_int *ry,
    1.64 +						   const ECGroup *group);
    1.65 +
    1.66 +/* Checks if point P(px, py, pz) is at infinity.  Uses projective
    1.67 + * coordinates. */
    1.68 +mp_err ec_GF2m_pt_is_inf_proj(const mp_int *px, const mp_int *py,
    1.69 +							  const mp_int *pz);
    1.70 +
    1.71 +/* Sets P(px, py, pz) to be the point at infinity.  Uses projective
    1.72 + * coordinates. */
    1.73 +mp_err ec_GF2m_pt_set_inf_proj(mp_int *px, mp_int *py, mp_int *pz);
    1.74 +
    1.75 +/* Computes R = P + Q where R is (rx, ry, rz), P is (px, py, pz) and Q is
    1.76 + * (qx, qy, qz).  Uses projective coordinates. */
    1.77 +mp_err ec_GF2m_pt_add_proj(const mp_int *px, const mp_int *py,
    1.78 +						   const mp_int *pz, const mp_int *qx,
    1.79 +						   const mp_int *qy, mp_int *rx, mp_int *ry,
    1.80 +						   mp_int *rz, const ECGroup *group);
    1.81 +
    1.82 +/* Computes R = 2P.  Uses projective coordinates. */
    1.83 +mp_err ec_GF2m_pt_dbl_proj(const mp_int *px, const mp_int *py,
    1.84 +						   const mp_int *pz, mp_int *rx, mp_int *ry,
    1.85 +						   mp_int *rz, const ECGroup *group);
    1.86 +
    1.87 +/* Computes R = nP where R is (rx, ry) and P is (px, py). The parameters
    1.88 + * a, b and p are the elliptic curve coefficients and the prime that
    1.89 + * determines the field GF2m.  Uses projective coordinates. */
    1.90 +mp_err ec_GF2m_pt_mul_proj(const mp_int *n, const mp_int *px,
    1.91 +						   const mp_int *py, mp_int *rx, mp_int *ry,
    1.92 +						   const ECGroup *group);
    1.93 +#endif
    1.94 +
    1.95 +#endif							/* __ec2_h_ */

mercurial