annotate src/share/native/sun/security/ec/impl/ec2.h @ 3909:272483f6650b

7033660: Update copyright year to 2011 on any files changed in 2011 Reviewed-by: dholmes
author ohair
date Wed, 06 Apr 2011 22:06:11 -0700
parents 1b5c838b8db8
children b49a0af85821
rev   line source
vinnie@1674 1 /* *********************************************************************
vinnie@1674 2 *
vinnie@1674 3 * Sun elects to have this file available under and governed by the
vinnie@1674 4 * Mozilla Public License Version 1.1 ("MPL") (see
vinnie@1674 5 * http://www.mozilla.org/MPL/ for full license text). For the avoidance
vinnie@1674 6 * of doubt and subject to the following, Sun also elects to allow
vinnie@1674 7 * licensees to use this file under the MPL, the GNU General Public
vinnie@1674 8 * License version 2 only or the Lesser General Public License version
vinnie@1674 9 * 2.1 only. Any references to the "GNU General Public License version 2
vinnie@1674 10 * or later" or "GPL" in the following shall be construed to mean the
vinnie@1674 11 * GNU General Public License version 2 only. Any references to the "GNU
vinnie@1674 12 * Lesser General Public License version 2.1 or later" or "LGPL" in the
vinnie@1674 13 * following shall be construed to mean the GNU Lesser General Public
vinnie@1674 14 * License version 2.1 only. However, the following notice accompanied
vinnie@1674 15 * the original version of this file:
vinnie@1674 16 *
vinnie@1674 17 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
vinnie@1674 18 *
vinnie@1674 19 * The contents of this file are subject to the Mozilla Public License Version
vinnie@1674 20 * 1.1 (the "License"); you may not use this file except in compliance with
vinnie@1674 21 * the License. You may obtain a copy of the License at
vinnie@1674 22 * http://www.mozilla.org/MPL/
vinnie@1674 23 *
vinnie@1674 24 * Software distributed under the License is distributed on an "AS IS" basis,
vinnie@1674 25 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
vinnie@1674 26 * for the specific language governing rights and limitations under the
vinnie@1674 27 * License.
vinnie@1674 28 *
vinnie@1674 29 * The Original Code is the elliptic curve math library for binary polynomial field curves.
vinnie@1674 30 *
vinnie@1674 31 * The Initial Developer of the Original Code is
vinnie@1674 32 * Sun Microsystems, Inc.
vinnie@1674 33 * Portions created by the Initial Developer are Copyright (C) 2003
vinnie@1674 34 * the Initial Developer. All Rights Reserved.
vinnie@1674 35 *
vinnie@1674 36 * Contributor(s):
vinnie@1674 37 * Douglas Stebila <douglas@stebila.ca>, Sun Microsystems Laboratories
vinnie@1674 38 *
vinnie@1674 39 * Alternatively, the contents of this file may be used under the terms of
vinnie@1674 40 * either the GNU General Public License Version 2 or later (the "GPL"), or
vinnie@1674 41 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
vinnie@1674 42 * in which case the provisions of the GPL or the LGPL are applicable instead
vinnie@1674 43 * of those above. If you wish to allow use of your version of this file only
vinnie@1674 44 * under the terms of either the GPL or the LGPL, and not to allow others to
vinnie@1674 45 * use your version of this file under the terms of the MPL, indicate your
vinnie@1674 46 * decision by deleting the provisions above and replace them with the notice
vinnie@1674 47 * and other provisions required by the GPL or the LGPL. If you do not delete
vinnie@1674 48 * the provisions above, a recipient may use your version of this file under
vinnie@1674 49 * the terms of any one of the MPL, the GPL or the LGPL.
vinnie@1674 50 *
vinnie@1674 51 *********************************************************************** */
vinnie@1674 52 /*
ohair@3909 53 * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
vinnie@1674 54 * Use is subject to license terms.
vinnie@1674 55 */
vinnie@1674 56
vinnie@1674 57 #ifndef _EC2_H
vinnie@1674 58 #define _EC2_H
vinnie@1674 59
vinnie@1674 60 #include "ecl-priv.h"
vinnie@1674 61
vinnie@1674 62 /* Checks if point P(px, py) is at infinity. Uses affine coordinates. */
vinnie@1674 63 mp_err ec_GF2m_pt_is_inf_aff(const mp_int *px, const mp_int *py);
vinnie@1674 64
vinnie@1674 65 /* Sets P(px, py) to be the point at infinity. Uses affine coordinates. */
vinnie@1674 66 mp_err ec_GF2m_pt_set_inf_aff(mp_int *px, mp_int *py);
vinnie@1674 67
vinnie@1674 68 /* Computes R = P + Q where R is (rx, ry), P is (px, py) and Q is (qx,
vinnie@1674 69 * qy). Uses affine coordinates. */
vinnie@1674 70 mp_err ec_GF2m_pt_add_aff(const mp_int *px, const mp_int *py,
vinnie@1674 71 const mp_int *qx, const mp_int *qy, mp_int *rx,
vinnie@1674 72 mp_int *ry, const ECGroup *group);
vinnie@1674 73
vinnie@1674 74 /* Computes R = P - Q. Uses affine coordinates. */
vinnie@1674 75 mp_err ec_GF2m_pt_sub_aff(const mp_int *px, const mp_int *py,
vinnie@1674 76 const mp_int *qx, const mp_int *qy, mp_int *rx,
vinnie@1674 77 mp_int *ry, const ECGroup *group);
vinnie@1674 78
vinnie@1674 79 /* Computes R = 2P. Uses affine coordinates. */
vinnie@1674 80 mp_err ec_GF2m_pt_dbl_aff(const mp_int *px, const mp_int *py, mp_int *rx,
vinnie@1674 81 mp_int *ry, const ECGroup *group);
vinnie@1674 82
vinnie@1674 83 /* Validates a point on a GF2m curve. */
vinnie@1674 84 mp_err ec_GF2m_validate_point(const mp_int *px, const mp_int *py, const ECGroup *group);
vinnie@1674 85
vinnie@1674 86 /* by default, this routine is unused and thus doesn't need to be compiled */
vinnie@1674 87 #ifdef ECL_ENABLE_GF2M_PT_MUL_AFF
vinnie@1674 88 /* Computes R = nP where R is (rx, ry) and P is (px, py). The parameters
vinnie@1674 89 * a, b and p are the elliptic curve coefficients and the irreducible that
vinnie@1674 90 * determines the field GF2m. Uses affine coordinates. */
vinnie@1674 91 mp_err ec_GF2m_pt_mul_aff(const mp_int *n, const mp_int *px,
vinnie@1674 92 const mp_int *py, mp_int *rx, mp_int *ry,
vinnie@1674 93 const ECGroup *group);
vinnie@1674 94 #endif
vinnie@1674 95
vinnie@1674 96 /* Computes R = nP where R is (rx, ry) and P is (px, py). The parameters
vinnie@1674 97 * a, b and p are the elliptic curve coefficients and the irreducible that
vinnie@1674 98 * determines the field GF2m. Uses Montgomery projective coordinates. */
vinnie@1674 99 mp_err ec_GF2m_pt_mul_mont(const mp_int *n, const mp_int *px,
vinnie@1674 100 const mp_int *py, mp_int *rx, mp_int *ry,
vinnie@1674 101 const ECGroup *group);
vinnie@1674 102
vinnie@1674 103 #ifdef ECL_ENABLE_GF2M_PROJ
vinnie@1674 104 /* Converts a point P(px, py) from affine coordinates to projective
vinnie@1674 105 * coordinates R(rx, ry, rz). */
vinnie@1674 106 mp_err ec_GF2m_pt_aff2proj(const mp_int *px, const mp_int *py, mp_int *rx,
vinnie@1674 107 mp_int *ry, mp_int *rz, const ECGroup *group);
vinnie@1674 108
vinnie@1674 109 /* Converts a point P(px, py, pz) from projective coordinates to affine
vinnie@1674 110 * coordinates R(rx, ry). */
vinnie@1674 111 mp_err ec_GF2m_pt_proj2aff(const mp_int *px, const mp_int *py,
vinnie@1674 112 const mp_int *pz, mp_int *rx, mp_int *ry,
vinnie@1674 113 const ECGroup *group);
vinnie@1674 114
vinnie@1674 115 /* Checks if point P(px, py, pz) is at infinity. Uses projective
vinnie@1674 116 * coordinates. */
vinnie@1674 117 mp_err ec_GF2m_pt_is_inf_proj(const mp_int *px, const mp_int *py,
vinnie@1674 118 const mp_int *pz);
vinnie@1674 119
vinnie@1674 120 /* Sets P(px, py, pz) to be the point at infinity. Uses projective
vinnie@1674 121 * coordinates. */
vinnie@1674 122 mp_err ec_GF2m_pt_set_inf_proj(mp_int *px, mp_int *py, mp_int *pz);
vinnie@1674 123
vinnie@1674 124 /* Computes R = P + Q where R is (rx, ry, rz), P is (px, py, pz) and Q is
vinnie@1674 125 * (qx, qy, qz). Uses projective coordinates. */
vinnie@1674 126 mp_err ec_GF2m_pt_add_proj(const mp_int *px, const mp_int *py,
vinnie@1674 127 const mp_int *pz, const mp_int *qx,
vinnie@1674 128 const mp_int *qy, mp_int *rx, mp_int *ry,
vinnie@1674 129 mp_int *rz, const ECGroup *group);
vinnie@1674 130
vinnie@1674 131 /* Computes R = 2P. Uses projective coordinates. */
vinnie@1674 132 mp_err ec_GF2m_pt_dbl_proj(const mp_int *px, const mp_int *py,
vinnie@1674 133 const mp_int *pz, mp_int *rx, mp_int *ry,
vinnie@1674 134 mp_int *rz, const ECGroup *group);
vinnie@1674 135
vinnie@1674 136 /* Computes R = nP where R is (rx, ry) and P is (px, py). The parameters
vinnie@1674 137 * a, b and p are the elliptic curve coefficients and the prime that
vinnie@1674 138 * determines the field GF2m. Uses projective coordinates. */
vinnie@1674 139 mp_err ec_GF2m_pt_mul_proj(const mp_int *n, const mp_int *px,
vinnie@1674 140 const mp_int *py, mp_int *rx, mp_int *ry,
vinnie@1674 141 const ECGroup *group);
vinnie@1674 142 #endif
vinnie@1674 143
vinnie@1674 144 #endif /* _EC2_H */