3 * Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
5 * This file is part of CyaSSL.
7 * CyaSSL is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * CyaSSL is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
24 void fp_mul_comba4(fp_int *A, fp_int *B, fp_int *C)
26 fp_digit c0, c1, c2, at[8];
28 memcpy(at, A->dp, 4 * sizeof(fp_digit));
29 memcpy(at+4, B->dp, 4 * sizeof(fp_digit));
35 COMBA_STORE(C->dp[0]);
38 MULADD(at[0], at[5]); MULADD(at[1], at[4]);
39 COMBA_STORE(C->dp[1]);
42 MULADD(at[0], at[6]); MULADD(at[1], at[5]); MULADD(at[2], at[4]);
43 COMBA_STORE(C->dp[2]);
46 MULADD(at[0], at[7]); MULADD(at[1], at[6]); MULADD(at[2], at[5]); MULADD(at[3], at[4]);
47 COMBA_STORE(C->dp[3]);
50 MULADD(at[1], at[7]); MULADD(at[2], at[6]); MULADD(at[3], at[5]);
51 COMBA_STORE(C->dp[4]);
54 MULADD(at[2], at[7]); MULADD(at[3], at[6]);
55 COMBA_STORE(C->dp[5]);
59 COMBA_STORE(C->dp[6]);
60 COMBA_STORE2(C->dp[7]);
62 C->sign = A->sign ^ B->sign;