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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef __ec2_h_
     6 #define __ec2_h_
     8 #include "ecl-priv.h"
    10 /* Checks if point P(px, py) is at infinity.  Uses affine coordinates. */
    11 mp_err ec_GF2m_pt_is_inf_aff(const mp_int *px, const mp_int *py);
    13 /* Sets P(px, py) to be the point at infinity.  Uses affine coordinates. */
    14 mp_err ec_GF2m_pt_set_inf_aff(mp_int *px, mp_int *py);
    16 /* Computes R = P + Q where R is (rx, ry), P is (px, py) and Q is (qx,
    17  * qy). Uses affine coordinates. */
    18 mp_err ec_GF2m_pt_add_aff(const mp_int *px, const mp_int *py,
    19 						  const mp_int *qx, const mp_int *qy, mp_int *rx,
    20 						  mp_int *ry, const ECGroup *group);
    22 /* Computes R = P - Q.  Uses affine coordinates. */
    23 mp_err ec_GF2m_pt_sub_aff(const mp_int *px, const mp_int *py,
    24 						  const mp_int *qx, const mp_int *qy, mp_int *rx,
    25 						  mp_int *ry, const ECGroup *group);
    27 /* Computes R = 2P.  Uses affine coordinates. */
    28 mp_err ec_GF2m_pt_dbl_aff(const mp_int *px, const mp_int *py, mp_int *rx,
    29 						  mp_int *ry, const ECGroup *group);
    31 /* Validates a point on a GF2m curve. */
    32 mp_err ec_GF2m_validate_point(const mp_int *px, const mp_int *py, const ECGroup *group);
    34 /* by default, this routine is unused and thus doesn't need to be compiled */
    35 #ifdef ECL_ENABLE_GF2M_PT_MUL_AFF
    36 /* Computes R = nP where R is (rx, ry) and P is (px, py). The parameters
    37  * a, b and p are the elliptic curve coefficients and the irreducible that 
    38  * determines the field GF2m.  Uses affine coordinates. */
    39 mp_err ec_GF2m_pt_mul_aff(const mp_int *n, const mp_int *px,
    40 						  const mp_int *py, mp_int *rx, mp_int *ry,
    41 						  const ECGroup *group);
    42 #endif
    44 /* Computes R = nP where R is (rx, ry) and P is (px, py). The parameters
    45  * a, b and p are the elliptic curve coefficients and the irreducible that 
    46  * determines the field GF2m.  Uses Montgomery projective coordinates. */
    47 mp_err ec_GF2m_pt_mul_mont(const mp_int *n, const mp_int *px,
    48 						   const mp_int *py, mp_int *rx, mp_int *ry,
    49 						   const ECGroup *group);
    51 #ifdef ECL_ENABLE_GF2M_PROJ
    52 /* Converts a point P(px, py) from affine coordinates to projective
    53  * coordinates R(rx, ry, rz). */
    54 mp_err ec_GF2m_pt_aff2proj(const mp_int *px, const mp_int *py, mp_int *rx,
    55 						   mp_int *ry, mp_int *rz, const ECGroup *group);
    57 /* Converts a point P(px, py, pz) from projective coordinates to affine
    58  * coordinates R(rx, ry). */
    59 mp_err ec_GF2m_pt_proj2aff(const mp_int *px, const mp_int *py,
    60 						   const mp_int *pz, mp_int *rx, mp_int *ry,
    61 						   const ECGroup *group);
    63 /* Checks if point P(px, py, pz) is at infinity.  Uses projective
    64  * coordinates. */
    65 mp_err ec_GF2m_pt_is_inf_proj(const mp_int *px, const mp_int *py,
    66 							  const mp_int *pz);
    68 /* Sets P(px, py, pz) to be the point at infinity.  Uses projective
    69  * coordinates. */
    70 mp_err ec_GF2m_pt_set_inf_proj(mp_int *px, mp_int *py, mp_int *pz);
    72 /* Computes R = P + Q where R is (rx, ry, rz), P is (px, py, pz) and Q is
    73  * (qx, qy, qz).  Uses projective coordinates. */
    74 mp_err ec_GF2m_pt_add_proj(const mp_int *px, const mp_int *py,
    75 						   const mp_int *pz, const mp_int *qx,
    76 						   const mp_int *qy, mp_int *rx, mp_int *ry,
    77 						   mp_int *rz, const ECGroup *group);
    79 /* Computes R = 2P.  Uses projective coordinates. */
    80 mp_err ec_GF2m_pt_dbl_proj(const mp_int *px, const mp_int *py,
    81 						   const mp_int *pz, mp_int *rx, mp_int *ry,
    82 						   mp_int *rz, const ECGroup *group);
    84 /* Computes R = nP where R is (rx, ry) and P is (px, py). The parameters
    85  * a, b and p are the elliptic curve coefficients and the prime that
    86  * determines the field GF2m.  Uses projective coordinates. */
    87 mp_err ec_GF2m_pt_mul_proj(const mp_int *n, const mp_int *px,
    88 						   const mp_int *py, mp_int *rx, mp_int *ry,
    89 						   const ECGroup *group);
    90 #endif
    92 #endif							/* __ec2_h_ */

mercurial