Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of MiniTLS-GPL by
math/mul/fp_mul_comba_4.c@4:cbaf466d717d, 2014-06-10 (annotated)
- Committer:
- MiniTLS
- Date:
- Tue Jun 10 14:23:09 2014 +0000
- Revision:
- 4:cbaf466d717d
- Parent:
- 0:35aa5be3b78d
Fixes for mbed
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| MiniTLS | 0:35aa5be3b78d | 1 | #define TFM_DEFINES |
| MiniTLS | 0:35aa5be3b78d | 2 | #include "fp_mul_comba.c" |
| MiniTLS | 0:35aa5be3b78d | 3 | |
| MiniTLS | 0:35aa5be3b78d | 4 | #ifdef TFM_MUL4 |
| MiniTLS | 0:35aa5be3b78d | 5 | void fp_mul_comba4(fp_int *A, fp_int *B, fp_int *C) |
| MiniTLS | 0:35aa5be3b78d | 6 | { |
| MiniTLS | 0:35aa5be3b78d | 7 | fp_digit c0, c1, c2, at[8]; |
| MiniTLS | 0:35aa5be3b78d | 8 | |
| MiniTLS | 0:35aa5be3b78d | 9 | memcpy(at, A->dp, 4 * sizeof(fp_digit)); |
| MiniTLS | 0:35aa5be3b78d | 10 | memcpy(at+4, B->dp, 4 * sizeof(fp_digit)); |
| MiniTLS | 0:35aa5be3b78d | 11 | COMBA_START; |
| MiniTLS | 0:35aa5be3b78d | 12 | |
| MiniTLS | 0:35aa5be3b78d | 13 | COMBA_CLEAR; |
| MiniTLS | 0:35aa5be3b78d | 14 | /* 0 */ |
| MiniTLS | 0:35aa5be3b78d | 15 | MULADD(at[0], at[4]); |
| MiniTLS | 0:35aa5be3b78d | 16 | COMBA_STORE(C->dp[0]); |
| MiniTLS | 0:35aa5be3b78d | 17 | /* 1 */ |
| MiniTLS | 0:35aa5be3b78d | 18 | COMBA_FORWARD; |
| MiniTLS | 0:35aa5be3b78d | 19 | MULADD(at[0], at[5]); MULADD(at[1], at[4]); |
| MiniTLS | 0:35aa5be3b78d | 20 | COMBA_STORE(C->dp[1]); |
| MiniTLS | 0:35aa5be3b78d | 21 | /* 2 */ |
| MiniTLS | 0:35aa5be3b78d | 22 | COMBA_FORWARD; |
| MiniTLS | 0:35aa5be3b78d | 23 | MULADD(at[0], at[6]); MULADD(at[1], at[5]); MULADD(at[2], at[4]); |
| MiniTLS | 0:35aa5be3b78d | 24 | COMBA_STORE(C->dp[2]); |
| MiniTLS | 0:35aa5be3b78d | 25 | /* 3 */ |
| MiniTLS | 0:35aa5be3b78d | 26 | COMBA_FORWARD; |
| MiniTLS | 0:35aa5be3b78d | 27 | MULADD(at[0], at[7]); MULADD(at[1], at[6]); MULADD(at[2], at[5]); MULADD(at[3], at[4]); |
| MiniTLS | 0:35aa5be3b78d | 28 | COMBA_STORE(C->dp[3]); |
| MiniTLS | 0:35aa5be3b78d | 29 | /* 4 */ |
| MiniTLS | 0:35aa5be3b78d | 30 | COMBA_FORWARD; |
| MiniTLS | 0:35aa5be3b78d | 31 | MULADD(at[1], at[7]); MULADD(at[2], at[6]); MULADD(at[3], at[5]); |
| MiniTLS | 0:35aa5be3b78d | 32 | COMBA_STORE(C->dp[4]); |
| MiniTLS | 0:35aa5be3b78d | 33 | /* 5 */ |
| MiniTLS | 0:35aa5be3b78d | 34 | COMBA_FORWARD; |
| MiniTLS | 0:35aa5be3b78d | 35 | MULADD(at[2], at[7]); MULADD(at[3], at[6]); |
| MiniTLS | 0:35aa5be3b78d | 36 | COMBA_STORE(C->dp[5]); |
| MiniTLS | 0:35aa5be3b78d | 37 | /* 6 */ |
| MiniTLS | 0:35aa5be3b78d | 38 | COMBA_FORWARD; |
| MiniTLS | 0:35aa5be3b78d | 39 | MULADD(at[3], at[7]); |
| MiniTLS | 0:35aa5be3b78d | 40 | COMBA_STORE(C->dp[6]); |
| MiniTLS | 0:35aa5be3b78d | 41 | COMBA_STORE2(C->dp[7]); |
| MiniTLS | 0:35aa5be3b78d | 42 | C->used = 8; |
| MiniTLS | 0:35aa5be3b78d | 43 | C->sign = A->sign ^ B->sign; |
| MiniTLS | 0:35aa5be3b78d | 44 | fp_clamp(C); |
| MiniTLS | 0:35aa5be3b78d | 45 | COMBA_FINI; |
| MiniTLS | 0:35aa5be3b78d | 46 | } |
| MiniTLS | 0:35aa5be3b78d | 47 | #endif |
