3 Copyright (C) 2016-2020 Dmitry Eremin-Solenikov
5 This file is part of GNU Nettle.
7 GNU Nettle is free software: you can redistribute it and/or
8 modify it under the terms of either:
10 * the GNU Lesser General Public License as published by the Free
11 Software Foundation; either version 3 of the License, or (at your
12 option) any later version.
16 * the GNU General Public License as published by the Free
17 Software Foundation; either version 2 of the License, or (at your
18 option) any later version.
20 or both in parallel, as here.
22 GNU Nettle is distributed in the hope that it will be useful,
23 but WITHOUT ANY WARRANTY; without even the implied warranty of
24 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 General Public License for more details.
27 You should have received copies of the GNU General Public License and
28 the GNU Lesser General Public License along with this program. If
29 not, see http://www.gnu.org/licenses/.
39 #include "ecc-internal.h"
43 #include "ecc-gost-gc512a.h"
46 ecc_gost_gc512a_modp (const struct ecc_modulo
*m
, mp_limb_t
*rp
, mp_limb_t
*xp
)
48 mp_size_t mn
= m
->size
;
51 hi
= mpn_addmul_1(xp
, xp
+ mn
, mn
, 0x239);
52 hi
= sec_add_1 (xp
, xp
, mn
, hi
* 0x239);
53 hi
= sec_add_1 (rp
, xp
, mn
, hi
* 0x239);
57 #define ecc_gost_gc512a_modp ecc_gost_gc512a_modp
58 #define ecc_gost_gc512a_modq ecc_mod
60 const struct ecc_curve _nettle_gost_gc512a
=
67 ECC_MOD_INV_ITCH (ECC_LIMB_SIZE
),
89 ECC_MOD_INV_ITCH (ECC_LIMB_SIZE
),
100 ecc_gost_gc512a_modq
,
101 ecc_gost_gc512a_modq
,
111 ECC_ADD_JJA_ITCH (ECC_LIMB_SIZE
),
112 ECC_ADD_JJJ_ITCH (ECC_LIMB_SIZE
),
113 ECC_DUP_JJ_ITCH (ECC_LIMB_SIZE
),
114 ECC_MUL_A_ITCH (ECC_LIMB_SIZE
),
115 ECC_MUL_G_ITCH (ECC_LIMB_SIZE
),
116 ECC_J_TO_A_ITCH (ECC_LIMB_SIZE
, ECC_MOD_INV_ITCH(ECC_LIMB_SIZE
)),
130 const struct ecc_curve
*nettle_get_gost_gc512a(void)
132 return &_nettle_gost_gc512a
;