ecc-224.c 2.07 KB
Newer Older
1
/* ecc-224.c
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32

   Compile time constant (but machine dependent) tables.

   Copyright (C) 2013 Niels Möller

   This file is part of GNU Nettle.

   GNU Nettle is free software: you can redistribute it and/or
   modify it under the terms of either:

     * the GNU Lesser General Public License as published by the Free
       Software Foundation; either version 3 of the License, or (at your
       option) any later version.

   or

     * the GNU General Public License as published by the Free
       Software Foundation; either version 2 of the License, or (at your
       option) any later version.

   or both in parallel, as here.

   GNU Nettle is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received copies of the GNU General Public License and
   the GNU Lesser General Public License along with this program.  If
   not, see http://www.gnu.org/licenses/.
*/
Niels Möller's avatar
Niels Möller committed
33

34
/* Development of Nettle's ECC support was funded by the .SE Internet Fund. */
Niels Möller's avatar
Niels Möller committed
35 36 37 38 39

#if HAVE_CONFIG_H
# include "config.h"
#endif

40
#include "ecc.h"
Niels Möller's avatar
Niels Möller committed
41 42
#include "ecc-internal.h"

Niels Möller's avatar
Niels Möller committed
43 44 45 46 47 48 49 50
#if HAVE_NATIVE_ecc_224_modp

#define USE_REDC 0
#define ecc_224_modp nettle_ecc_224_modp
void
ecc_224_modp (const struct ecc_curve *ecc, mp_limb_t *rp);

#else
Niels Möller's avatar
Niels Möller committed
51
#define USE_REDC (ECC_REDC_SIZE != 0)
Niels Möller's avatar
Niels Möller committed
52 53
#define ecc_224_modp ecc_generic_modp
#endif
Niels Möller's avatar
Niels Möller committed
54 55 56 57 58 59 60 61

#include "ecc-224.h"

const struct ecc_curve nettle_secp_224r1 =
{
  224,
  ECC_LIMB_SIZE,    
  ECC_BMODP_SIZE,
62
  224,
Niels Möller's avatar
Niels Möller committed
63 64 65 66 67
  ECC_BMODQ_SIZE,
  USE_REDC,
  ECC_REDC_SIZE,
  ECC_PIPPENGER_K,
  ECC_PIPPENGER_C,
68

69 70 71 72
  ECC_MUL_A_ITCH (ECC_LIMB_SIZE),
  ECC_MUL_G_ITCH (ECC_LIMB_SIZE),
  ECC_J_TO_A_ITCH (ECC_LIMB_SIZE),

73 74 75 76 77
  ecc_224_modp,
  ecc_generic_redc,
  USE_REDC ? ecc_generic_redc : ecc_224_modp,
  ecc_generic_modq,

78 79 80 81
  ecc_mul_a,
  ecc_mul_g,
  ecc_j_to_a,

Niels Möller's avatar
Niels Möller committed
82 83 84 85
  ecc_p,
  ecc_b,
  ecc_q,
  ecc_g,
86
  NULL,
Niels Möller's avatar
Niels Möller committed
87 88 89 90 91 92 93 94 95 96
  ecc_Bmodp,
  ecc_Bmodp_shifted,
  ecc_pp1h,
  ecc_redc_ppm1,
  ecc_unit,
  ecc_Bmodq,
  ecc_Bmodq_shifted,
  ecc_qp1h,
  ecc_table
};