1 C x86_64/ecc-224-modp.asm
4 Copyright (C) 2013 Niels Möller
6 This file is part of GNU Nettle.
8 GNU Nettle is free software: you can redistribute it and/or
9 modify it under the terms of either:
11 * the GNU Lesser General Public License as published by the Free
12 Software Foundation; either version 3 of the License, or (at your
13 option) any later version.
17 * the GNU General Public License as published by the Free
18 Software Foundation; either version 2 of the License, or (at your
19 option) any later version.
21 or both in parallel, as here.
23 GNU Nettle is distributed in the hope that it will be useful,
24 but WITHOUT ANY WARRANTY; without even the implied warranty of
25 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 General Public License for more details.
28 You should have received copies of the GNU General Public License and
29 the GNU Lesser General Public License along with this program. If
30 not, see http://www.gnu.org/licenses/.
33 .file "ecc-224-modp.asm"
38 define(<T0>, <%rdi>) C Overlaps unused modulo input
47 C ecc_224_modp (const struct ecc_modulo *m, mp_limb_t *rp)
48 PROLOGUE(nettle_ecc_224_modp)
52 C Set (F2,F1,F0) <-- (H1,H0) << 32
69 sbb $0, H1 C No further borrow
75 C Set (F2,F1,F0) <-- (H2,H1,H0) << 32
76 C To free registers, add in T1, T0 as soon as H0, H1 have been copied
103 C We now have H2, H1, H0, T1, T0, with 33 bits left to reduce
104 C Set F0 <-- (H2, H1) >> 32
105 C Set (F2,F1) <-- (H2, H1 & 0xffffffff00000000)
106 C H1 <-- H1 & 0xffffffff
111 movl XREG(H1), XREG(H1) C Clears high 32 bits
112 sub H1, F1 C Clears low 32 bits
131 EPILOGUE(nettle_ecc_224_modp)