jdk/src/share/native/sun/security/ec/impl/ecp_224.c

Print this page




  33  * Portions created by the Initial Developer are Copyright (C) 2003
  34  * the Initial Developer. All Rights Reserved.
  35  *
  36  * Contributor(s):
  37  *   Douglas Stebila <douglas@stebila.ca>, Sun Microsystems Laboratories
  38  *
  39  * Alternatively, the contents of this file may be used under the terms of
  40  * either the GNU General Public License Version 2 or later (the "GPL"), or
  41  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  42  * in which case the provisions of the GPL or the LGPL are applicable instead
  43  * of those above. If you wish to allow use of your version of this file only
  44  * under the terms of either the GPL or the LGPL, and not to allow others to
  45  * use your version of this file under the terms of the MPL, indicate your
  46  * decision by deleting the provisions above and replace them with the notice
  47  * and other provisions required by the GPL or the LGPL. If you do not delete
  48  * the provisions above, a recipient may use your version of this file under
  49  * the terms of any one of the MPL, the GPL or the LGPL.
  50  *
  51  *********************************************************************** */
  52 /*
  53  * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
  54  * Use is subject to license terms.
  55  */
  56 
  57 #include "ecp.h"
  58 #include "mpi.h"
  59 #include "mplogic.h"
  60 #include "mpi-priv.h"
  61 #ifndef _KERNEL
  62 #include <stdlib.h>
  63 #endif
  64 
  65 #define ECP224_DIGITS ECL_CURVE_DIGITS(224)
  66 
  67 /* Fast modular reduction for p224 = 2^224 - 2^96 + 1.  a can be r. Uses
  68  * algorithm 7 from Brown, Hankerson, Lopez, Menezes. Software
  69  * Implementation of the NIST Elliptic Curves over Prime Fields. */
  70 mp_err
  71 ec_GFp_nistp224_mod(const mp_int *a, mp_int *r, const GFMethod *meth)
  72 {
  73         mp_err res = MP_OKAY;




  33  * Portions created by the Initial Developer are Copyright (C) 2003
  34  * the Initial Developer. All Rights Reserved.
  35  *
  36  * Contributor(s):
  37  *   Douglas Stebila <douglas@stebila.ca>, Sun Microsystems Laboratories
  38  *
  39  * Alternatively, the contents of this file may be used under the terms of
  40  * either the GNU General Public License Version 2 or later (the "GPL"), or
  41  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  42  * in which case the provisions of the GPL or the LGPL are applicable instead
  43  * of those above. If you wish to allow use of your version of this file only
  44  * under the terms of either the GPL or the LGPL, and not to allow others to
  45  * use your version of this file under the terms of the MPL, indicate your
  46  * decision by deleting the provisions above and replace them with the notice
  47  * and other provisions required by the GPL or the LGPL. If you do not delete
  48  * the provisions above, a recipient may use your version of this file under
  49  * the terms of any one of the MPL, the GPL or the LGPL.
  50  *
  51  *********************************************************************** */
  52 /*
  53  * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  54  * Use is subject to license terms.
  55  */
  56 
  57 #include "ecp.h"
  58 #include "mpi.h"
  59 #include "mplogic.h"
  60 #include "mpi-priv.h"
  61 #ifndef _KERNEL
  62 #include <stdlib.h>
  63 #endif
  64 
  65 #define ECP224_DIGITS ECL_CURVE_DIGITS(224)
  66 
  67 /* Fast modular reduction for p224 = 2^224 - 2^96 + 1.  a can be r. Uses
  68  * algorithm 7 from Brown, Hankerson, Lopez, Menezes. Software
  69  * Implementation of the NIST Elliptic Curves over Prime Fields. */
  70 mp_err
  71 ec_GFp_nistp224_mod(const mp_int *a, mp_int *r, const GFMethod *meth)
  72 {
  73         mp_err res = MP_OKAY;