| OLD | NEW |
| (Empty) |
| 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/. */ | |
| 4 | |
| 5 #ifndef __ec2_h_ | |
| 6 #define __ec2_h_ | |
| 7 | |
| 8 #include "ecl-priv.h" | |
| 9 | |
| 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); | |
| 12 | |
| 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); | |
| 15 | |
| 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 *gro
up); | |
| 21 | |
| 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 *gro
up); | |
| 26 | |
| 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 *gro
up); | |
| 30 | |
| 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); | |
| 33 | |
| 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 | |
| 43 | |
| 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); | |
| 50 | |
| 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); | |
| 56 | |
| 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); | |
| 62 | |
| 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); | |
| 67 | |
| 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); | |
| 71 | |
| 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_in
t *qx, | |
| 76 const mp_int *qy, mp_int *rx,
mp_int *ry, | |
| 77 mp_int *rz, const ECGroup *gr
oup); | |
| 78 | |
| 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 *gr
oup); | |
| 83 | |
| 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 | |
| 91 | |
| 92 #endif /* __ec2_h_ */ | |
| OLD | NEW |