Mercurial > dropbear
annotate tomsfastmath/src/sqr/fp_sqrmod.c @ 647:939cd3e22c87 dropbear-tfm
- Fix constraints so we don't get warned about uninitialised
variable (it isn't used as input by the asm)
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 30 Nov 2011 23:15:21 +0800 |
parents | a362b62d38b2 |
children |
rev | line source |
---|---|
643
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
1 /* TomsFastMath, a fast ISO C bignum library. |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
2 * |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
3 * This project is meant to fill in where LibTomMath |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
4 * falls short. That is speed ;-) |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
5 * |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
6 * This project is public domain and free for all purposes. |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
7 * |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
8 * Tom St Denis, [email protected] |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
9 */ |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
10 #include <tfm.h> |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
11 |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
12 /* c = a * a (mod b) */ |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
13 int fp_sqrmod(fp_int *a, fp_int *b, fp_int *c) |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
14 { |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
15 fp_int tmp; |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
16 fp_zero(&tmp); |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
17 fp_sqr(a, &tmp); |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
18 return fp_mod(&tmp, b, c); |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
19 } |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
20 |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
21 /* $Source$ */ |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
22 /* $Revision$ */ |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
23 /* $Date$ */ |