jdk/src/jdk.crypto.ec/share/native/libsunec/impl/mp_gf2m.h
changeset 25859 3317bb8137f4
parent 9774 50a2b28ca54c
equal deleted inserted replaced
25858:836adbf7a2cd 25859:3317bb8137f4
       
     1 /*
       
     2  * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
       
     3  * Use is subject to license terms.
       
     4  *
       
     5  * This library is free software; you can redistribute it and/or
       
     6  * modify it under the terms of the GNU Lesser General Public
       
     7  * License as published by the Free Software Foundation; either
       
     8  * version 2.1 of the License, or (at your option) any later version.
       
     9  *
       
    10  * This library is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13  * Lesser General Public License for more details.
       
    14  *
       
    15  * You should have received a copy of the GNU Lesser General Public License
       
    16  * along with this library; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20  * or visit www.oracle.com if you need additional information or have any
       
    21  * questions.
       
    22  */
       
    23 
       
    24 /* *********************************************************************
       
    25  *
       
    26  * The Original Code is the Multi-precision Binary Polynomial Arithmetic Library.
       
    27  *
       
    28  * The Initial Developer of the Original Code is
       
    29  * Sun Microsystems, Inc.
       
    30  * Portions created by the Initial Developer are Copyright (C) 2003
       
    31  * the Initial Developer. All Rights Reserved.
       
    32  *
       
    33  * Contributor(s):
       
    34  *   Sheueling Chang Shantz <sheueling.chang@sun.com> and
       
    35  *   Douglas Stebila <douglas@stebila.ca> of Sun Laboratories.
       
    36  *
       
    37  *********************************************************************** */
       
    38 
       
    39 #ifndef _MP_GF2M_H_
       
    40 #define _MP_GF2M_H_
       
    41 
       
    42 #include "mpi.h"
       
    43 
       
    44 mp_err mp_badd(const mp_int *a, const mp_int *b, mp_int *c);
       
    45 mp_err mp_bmul(const mp_int *a, const mp_int *b, mp_int *c);
       
    46 
       
    47 /* For modular arithmetic, the irreducible polynomial f(t) is represented
       
    48  * as an array of int[], where f(t) is of the form:
       
    49  *     f(t) = t^p[0] + t^p[1] + ... + t^p[k]
       
    50  * where m = p[0] > p[1] > ... > p[k] = 0.
       
    51  */
       
    52 mp_err mp_bmod(const mp_int *a, const unsigned int p[], mp_int *r);
       
    53 mp_err mp_bmulmod(const mp_int *a, const mp_int *b, const unsigned int p[],
       
    54     mp_int *r);
       
    55 mp_err mp_bsqrmod(const mp_int *a, const unsigned int p[], mp_int *r);
       
    56 mp_err mp_bdivmod(const mp_int *y, const mp_int *x, const mp_int *pp,
       
    57     const unsigned int p[], mp_int *r);
       
    58 
       
    59 int mp_bpoly2arr(const mp_int *a, unsigned int p[], int max);
       
    60 mp_err mp_barr2poly(const unsigned int p[], mp_int *a);
       
    61 
       
    62 #endif /* _MP_GF2M_H_ */