forked from ibphoenix/tomsfastmath
clean-up file headers & footers
This commit is contained in:
parent
6b1c8318a9
commit
a251347c50
@ -77,7 +77,3 @@ int main(void)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -180,8 +180,3 @@ int main(void)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -435,9 +435,3 @@ draw(&a);draw(&b);draw(&c);draw(&d);
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -386,7 +386,3 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
void fp_add(fp_int *a, fp_int *b, fp_int *c)
|
void fp_add(fp_int *a, fp_int *b, fp_int *c)
|
||||||
@ -37,7 +30,3 @@ void fp_add(fp_int *a, fp_int *b, fp_int *c)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* c = a + b */
|
/* c = a + b */
|
||||||
@ -16,7 +9,3 @@ void fp_add_d(fp_int *a, fp_digit b, fp_int *c)
|
|||||||
fp_set(&tmp, b);
|
fp_set(&tmp, b);
|
||||||
fp_add(a,&tmp,c);
|
fp_add(a,&tmp,c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* d = a + b (mod c) */
|
/* d = a + b (mod c) */
|
||||||
@ -17,7 +10,3 @@ int fp_addmod(fp_int *a, fp_int *b, fp_int *c, fp_int *d)
|
|||||||
fp_add(a, b, &tmp);
|
fp_add(a, b, &tmp);
|
||||||
return fp_mod(&tmp, c, d);
|
return fp_mod(&tmp, c, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
int fp_cmp(fp_int *a, fp_int *b)
|
int fp_cmp(fp_int *a, fp_int *b)
|
||||||
@ -25,7 +18,3 @@ int fp_cmp(fp_int *a, fp_int *b)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* compare against a single digit */
|
/* compare against a single digit */
|
||||||
@ -32,7 +25,3 @@ int fp_cmp_d(fp_int *a, fp_digit b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
int fp_cmp_mag(fp_int *a, fp_int *b)
|
int fp_cmp_mag(fp_int *a, fp_int *b)
|
||||||
@ -28,8 +21,3 @@ int fp_cmp_mag(fp_int *a, fp_int *b)
|
|||||||
}
|
}
|
||||||
return FP_EQ;
|
return FP_EQ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* c = a - b */
|
/* c = a - b */
|
||||||
@ -43,8 +36,3 @@ void fp_sub(fp_int *a, fp_int *b, fp_int *c)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* c = a - b */
|
/* c = a - b */
|
||||||
@ -16,7 +9,3 @@ void fp_sub_d(fp_int *a, fp_digit b, fp_int *c)
|
|||||||
fp_set(&tmp, b);
|
fp_set(&tmp, b);
|
||||||
fp_sub(a, &tmp, c);
|
fp_sub(a, &tmp, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* d = a - b (mod c) */
|
/* d = a - b (mod c) */
|
||||||
@ -17,8 +10,3 @@ int fp_submod(fp_int *a, fp_int *b, fp_int *c, fp_int *d)
|
|||||||
fp_sub(a, b, &tmp);
|
fp_sub(a, b, &tmp);
|
||||||
return fp_mod(&tmp, c, d);
|
return fp_mod(&tmp, c, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* unsigned addition */
|
/* unsigned addition */
|
||||||
@ -36,7 +29,3 @@ void s_fp_add(fp_int *a, fp_int *b, fp_int *c)
|
|||||||
}
|
}
|
||||||
fp_clamp(c);
|
fp_clamp(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* unsigned subtraction ||a|| >= ||b|| ALWAYS! */
|
/* unsigned subtraction ||a|| >= ||b|| ALWAYS! */
|
||||||
@ -34,7 +27,3 @@ void s_fp_sub(fp_int *a, fp_int *b, fp_int *c)
|
|||||||
}
|
}
|
||||||
fp_clamp(c);
|
fp_clamp(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
int fp_radix_size(fp_int *a, int radix, int *size)
|
int fp_radix_size(fp_int *a, int radix, int *size)
|
||||||
@ -45,7 +38,3 @@ int fp_radix_size(fp_int *a, int radix, int *size)
|
|||||||
return FP_OKAY;
|
return FP_OKAY;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
int fp_read_radix(fp_int *a, const char *str, int radix)
|
int fp_read_radix(fp_int *a, const char *str, int radix)
|
||||||
@ -64,7 +57,3 @@ int fp_read_radix(fp_int *a, const char *str, int radix)
|
|||||||
}
|
}
|
||||||
return FP_OKAY;
|
return FP_OKAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
void fp_read_signed_bin(fp_int *a, const unsigned char *b, int c)
|
void fp_read_signed_bin(fp_int *a, const unsigned char *b, int c)
|
||||||
@ -21,7 +14,3 @@ void fp_read_signed_bin(fp_int *a, const unsigned char *b, int c)
|
|||||||
a->sign = FP_NEG;
|
a->sign = FP_NEG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
void fp_read_unsigned_bin(fp_int *a, const unsigned char *b, int c)
|
void fp_read_unsigned_bin(fp_int *a, const unsigned char *b, int c)
|
||||||
@ -64,7 +57,3 @@ void fp_read_unsigned_bin(fp_int *a, const unsigned char *b, int c)
|
|||||||
#endif
|
#endif
|
||||||
fp_clamp (a);
|
fp_clamp (a);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* reverse an array, used for radix code */
|
/* reverse an array, used for radix code */
|
||||||
@ -25,7 +18,3 @@ void fp_reverse (unsigned char *s, int len)
|
|||||||
--iy;
|
--iy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,17 +1,6 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* chars used in radix conversions */
|
/* chars used in radix conversions */
|
||||||
const char *fp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/";
|
const char *fp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/";
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,19 +1,8 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
int fp_signed_bin_size(fp_int *a)
|
int fp_signed_bin_size(fp_int *a)
|
||||||
{
|
{
|
||||||
return 1 + fp_unsigned_bin_size (a);
|
return 1 + fp_unsigned_bin_size (a);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
void fp_to_signed_bin(fp_int *a, unsigned char *b)
|
void fp_to_signed_bin(fp_int *a, unsigned char *b)
|
||||||
@ -14,7 +7,3 @@ void fp_to_signed_bin(fp_int *a, unsigned char *b)
|
|||||||
fp_to_unsigned_bin (a, b + 1);
|
fp_to_unsigned_bin (a, b + 1);
|
||||||
b[0] = (unsigned char) ((a->sign == FP_ZPOS) ? 0 : 1);
|
b[0] = (unsigned char) ((a->sign == FP_ZPOS) ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
void fp_to_unsigned_bin(fp_int *a, unsigned char *b)
|
void fp_to_unsigned_bin(fp_int *a, unsigned char *b)
|
||||||
@ -23,7 +16,3 @@ void fp_to_unsigned_bin(fp_int *a, unsigned char *b)
|
|||||||
}
|
}
|
||||||
fp_reverse (b, x);
|
fp_reverse (b, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,7 +18,3 @@ int fp_toradix(fp_int *a, char *str, int radix)
|
|||||||
{
|
{
|
||||||
return fp_toradix_n(a, str, radix, INT_MAX);
|
return fp_toradix_n(a, str, radix, INT_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
int fp_toradix_n(fp_int *a, char *str, int radix, int maxlen)
|
int fp_toradix_n(fp_int *a, char *str, int radix, int maxlen)
|
||||||
@ -65,7 +58,3 @@ int fp_toradix_n(fp_int *a, char *str, int radix, int maxlen)
|
|||||||
return FP_VAL;
|
return FP_VAL;
|
||||||
return FP_OKAY;
|
return FP_OKAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
int fp_unsigned_bin_size(fp_int *a)
|
int fp_unsigned_bin_size(fp_int *a)
|
||||||
@ -14,7 +7,3 @@ int fp_unsigned_bin_size(fp_int *a)
|
|||||||
int size = fp_count_bits (a);
|
int size = fp_count_bits (a);
|
||||||
return (size / 8 + ((size & 7) != 0 ? 1 : 0));
|
return (size / 8 + ((size & 7) != 0 ? 1 : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
static const int lnz[16] = {
|
static const int lnz[16] = {
|
||||||
@ -39,8 +32,3 @@ int fp_cnt_lsb(fp_int *a)
|
|||||||
}
|
}
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
int fp_count_bits (fp_int * a)
|
int fp_count_bits (fp_int * a)
|
||||||
@ -30,7 +23,3 @@ int fp_count_bits (fp_int * a)
|
|||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* b = a/2 */
|
/* b = a/2 */
|
||||||
@ -47,7 +40,3 @@ void fp_div_2(fp_int * a, fp_int * b)
|
|||||||
b->sign = a->sign;
|
b->sign = a->sign;
|
||||||
fp_clamp (b);
|
fp_clamp (b);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* c = a / 2**b */
|
/* c = a / 2**b */
|
||||||
@ -73,7 +66,3 @@ void fp_div_2d(fp_int *a, int b, fp_int *c, fp_int *d)
|
|||||||
fp_copy (&t, d);
|
fp_copy (&t, d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
void fp_lshd(fp_int *a, int x)
|
void fp_lshd(fp_int *a, int x)
|
||||||
@ -32,7 +25,3 @@ void fp_lshd(fp_int *a, int x)
|
|||||||
/* clamp digits */
|
/* clamp digits */
|
||||||
fp_clamp(a);
|
fp_clamp(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* c = a mod 2**d */
|
/* c = a mod 2**d */
|
||||||
@ -36,7 +29,3 @@ void fp_mod_2d(fp_int *a, int b, fp_int *c)
|
|||||||
c->dp[b / DIGIT_BIT] &= ~((fp_digit)0) >> (DIGIT_BIT - b);
|
c->dp[b / DIGIT_BIT] &= ~((fp_digit)0) >> (DIGIT_BIT - b);
|
||||||
fp_clamp (c);
|
fp_clamp (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
void fp_rshd(fp_int *a, int x)
|
void fp_rshd(fp_int *a, int x)
|
||||||
@ -33,8 +26,3 @@ void fp_rshd(fp_int *a, int x)
|
|||||||
a->used -= x;
|
a->used -= x;
|
||||||
fp_clamp(a);
|
fp_clamp(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* a/b => cb + d == a */
|
/* a/b => cb + d == a */
|
||||||
@ -151,7 +144,3 @@ int fp_div(fp_int *a, fp_int *b, fp_int *c, fp_int *d)
|
|||||||
|
|
||||||
return FP_OKAY;
|
return FP_OKAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
static int s_is_power_of_two(fp_digit b, int *p)
|
static int s_is_power_of_two(fp_digit b, int *p)
|
||||||
@ -91,8 +84,3 @@ int fp_div_d(fp_int *a, fp_digit b, fp_int *c, fp_digit *d)
|
|||||||
|
|
||||||
return FP_OKAY;
|
return FP_OKAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* c = a mod b, 0 <= c < b */
|
/* c = a mod b, 0 <= c < b */
|
||||||
@ -26,9 +19,3 @@ int fp_mod(fp_int *a, fp_int *b, fp_int *c)
|
|||||||
}
|
}
|
||||||
return FP_OKAY;
|
return FP_OKAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* c = a mod b, 0 <= c < b */
|
/* c = a mod b, 0 <= c < b */
|
||||||
@ -14,7 +7,3 @@ int fp_mod_d(fp_int *a, fp_digit b, fp_digit *c)
|
|||||||
{
|
{
|
||||||
return fp_div_d(a, b, NULL, c);
|
return fp_div_d(a, b, NULL, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* computes a = 2**b */
|
/* computes a = 2**b */
|
||||||
@ -32,8 +25,3 @@ void fp_2expt(fp_int *a, int b)
|
|||||||
/* put the single bit in its place */
|
/* put the single bit in its place */
|
||||||
a->dp[z] = ((fp_digit)1) << (b % DIGIT_BIT);
|
a->dp[z] = ((fp_digit)1) << (b % DIGIT_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
#ifdef TFM_TIMING_RESISTANT
|
#ifdef TFM_TIMING_RESISTANT
|
||||||
@ -270,7 +263,3 @@ int fp_exptmod(fp_int * G, fp_int * X, fp_int * P, fp_int * Y)
|
|||||||
return _fp_exptmod(G, X, P, Y);
|
return _fp_exptmod(G, X, P, Y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* program emits a NxN comba multiplier */
|
/* program emits a NxN comba multiplier */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -77,15 +70,8 @@ printf(
|
|||||||
" C->sign = A->sign ^ B->sign;\n"
|
" C->sign = A->sign ^ B->sign;\n"
|
||||||
" fp_clamp(C);\n"
|
" fp_clamp(C);\n"
|
||||||
" COMBA_FINI;\n"
|
" COMBA_FINI;\n"
|
||||||
"}\n#endif\n\n\n"
|
"}\n#endif\n"
|
||||||
"/* $Source$ */\n"
|
|
||||||
"/* $Revision$ */\n"
|
|
||||||
"/* $Date$ */\n"
|
|
||||||
, N+N-1, N+N);
|
, N+N-1, N+N);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -57,14 +57,7 @@ printf(
|
|||||||
" COMBA_FINI;\n"
|
" COMBA_FINI;\n"
|
||||||
" break;\n", N+N-1, N+N);
|
" break;\n", N+N-1, N+N);
|
||||||
}
|
}
|
||||||
printf(" }\n}\n\n#endif\n\n\n"
|
printf(" }\n}\n\n#endif\n");
|
||||||
"/* $Source$ */\n"
|
|
||||||
"/* $Revision$ */\n"
|
|
||||||
"/* $Date$ */\n");
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -100,15 +93,8 @@ printf(
|
|||||||
" B->sign = FP_ZPOS;\n"
|
" B->sign = FP_ZPOS;\n"
|
||||||
" memcpy(B->dp, b, %d * sizeof(fp_digit));\n"
|
" memcpy(B->dp, b, %d * sizeof(fp_digit));\n"
|
||||||
" fp_clamp(B);\n"
|
" fp_clamp(B);\n"
|
||||||
"}\n#endif\n\n\n"
|
"}\n#endif\n"
|
||||||
"/* $Source$ */\n"
|
|
||||||
"/* $Revision$ */\n"
|
|
||||||
"/* $Date$ */\n"
|
|
||||||
, N+N, N+N);
|
, N+N, N+N);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Generates squaring comba code... it learns it knows our secrets! */
|
/* Generates squaring comba code... it learns it knows our secrets! */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -108,15 +101,8 @@ printf(
|
|||||||
" break;\n\n", N+N, N+N);
|
" break;\n\n", N+N, N+N);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("}\n}\n\n#endif /* TFM_SMALL_SET */\n\n"
|
printf("}\n}\n\n#endif /* TFM_SMALL_SET */\n"
|
||||||
"/* $Source$ */\n"
|
|
||||||
"/* $Revision$ */\n"
|
|
||||||
"/* $Date$ */\n"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
#ifndef GIT_VERSION
|
#ifndef GIT_VERSION
|
||||||
@ -95,8 +88,3 @@ int main(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
#if FP_GEN_RANDOM_MAX == 0xffffffff
|
#if FP_GEN_RANDOM_MAX == 0xffffffff
|
||||||
@ -59,7 +52,3 @@ void fp_rand(fp_int *a, int digits)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
void fp_set(fp_int *a, fp_digit b)
|
void fp_set(fp_int *a, fp_digit b)
|
||||||
@ -15,7 +8,3 @@ void fp_set(fp_int *a, fp_digit b)
|
|||||||
a->dp[0] = b;
|
a->dp[0] = b;
|
||||||
a->used = a->dp[0] ? 1 : 0;
|
a->used = a->dp[0] ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* computes a = B**n mod b without division or multiplication useful for
|
/* computes a = B**n mod b without division or multiplication useful for
|
||||||
@ -36,8 +29,3 @@ void fp_montgomery_calc_normalization(fp_int *a, fp_int *b)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
@ -545,8 +538,3 @@ void fp_montgomery_reduce(fp_int *a, fp_int *m, fp_digit mp)
|
|||||||
s_fp_sub (a, m, a);
|
s_fp_sub (a, m, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* setups the montgomery reduction */
|
/* setups the montgomery reduction */
|
||||||
@ -41,8 +34,3 @@ int fp_montgomery_setup(fp_int *a, fp_digit *rho)
|
|||||||
|
|
||||||
return FP_OKAY;
|
return FP_OKAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* c = a * b */
|
/* c = a * b */
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
void fp_mul_2(fp_int * a, fp_int * b)
|
void fp_mul_2(fp_int * a, fp_int * b)
|
||||||
@ -60,8 +53,3 @@ void fp_mul_2(fp_int * a, fp_int * b)
|
|||||||
}
|
}
|
||||||
b->sign = a->sign;
|
b->sign = a->sign;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* c = a * 2**d */
|
/* c = a * 2**d */
|
||||||
@ -40,8 +33,3 @@ void fp_mul_2d(fp_int *a, int b, fp_int *c)
|
|||||||
}
|
}
|
||||||
fp_clamp(c);
|
fp_clamp(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* About this file...
|
/* About this file...
|
||||||
|
|
||||||
@ -366,8 +359,3 @@ void fp_mul_comba(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
|
||||||
|
@ -111,8 +111,3 @@ void fp_mul_comba12(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -151,8 +151,3 @@ void fp_mul_comba17(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -175,8 +175,3 @@ void fp_mul_comba20(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -207,8 +207,3 @@ void fp_mul_comba24(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -239,8 +239,3 @@ void fp_mul_comba28(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -39,8 +39,3 @@ void fp_mul_comba3(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -285,8 +285,3 @@ void fp_mul_comba32(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -47,8 +47,3 @@ void fp_mul_comba4(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -429,8 +429,3 @@ void fp_mul_comba48(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -63,8 +63,3 @@ void fp_mul_comba6(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -573,8 +573,3 @@ void fp_mul_comba64(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -71,8 +71,3 @@ void fp_mul_comba7(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -79,8 +79,3 @@ void fp_mul_comba8(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -87,8 +87,3 @@ void fp_mul_comba9(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1228,8 +1228,3 @@ void fp_mul_comba_small(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* c = a * b */
|
/* c = a * b */
|
||||||
@ -33,8 +26,3 @@ void fp_mul_d(fp_int *a, fp_digit b, fp_int *c)
|
|||||||
}
|
}
|
||||||
fp_clamp(c);
|
fp_clamp(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
/* d = a * b (mod c) */
|
/* d = a * b (mod c) */
|
||||||
int fp_mulmod(fp_int *a, fp_int *b, fp_int *c, fp_int *d)
|
int fp_mulmod(fp_int *a, fp_int *b, fp_int *c, fp_int *d)
|
||||||
@ -16,7 +9,3 @@ int fp_mulmod(fp_int *a, fp_int *b, fp_int *c, fp_int *d)
|
|||||||
fp_mul(a, b, &tmp);
|
fp_mul(a, b, &tmp);
|
||||||
return fp_mod(&tmp, c, d);
|
return fp_mod(&tmp, c, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* c = (a, b) */
|
/* c = (a, b) */
|
||||||
@ -49,7 +42,3 @@ void fp_gcd(fp_int *a, fp_int *b, fp_int *c)
|
|||||||
}
|
}
|
||||||
fp_copy(&u, c);
|
fp_copy(&u, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
static int fp_invmod_slow (fp_int * a, fp_int * b, fp_int * c)
|
static int fp_invmod_slow (fp_int * a, fp_int * b, fp_int * c)
|
||||||
@ -201,7 +194,3 @@ top:
|
|||||||
c->sign = neg;
|
c->sign = neg;
|
||||||
return FP_OKAY;
|
return FP_OKAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,19 +1,8 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
int fp_isprime(fp_int *a)
|
int fp_isprime(fp_int *a)
|
||||||
{
|
{
|
||||||
return fp_isprime_ex(a, 8);
|
return fp_isprime_ex(a, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* a few primes */
|
/* a few primes */
|
||||||
@ -77,7 +70,3 @@ int fp_isprime_ex(fp_int *a, int t)
|
|||||||
}
|
}
|
||||||
return FP_YES;
|
return FP_YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* c = [a, b] */
|
/* c = [a, b] */
|
||||||
@ -25,7 +18,3 @@ void fp_lcm(fp_int *a, fp_int *b, fp_int *c)
|
|||||||
fp_mul(a, &t2, c);
|
fp_mul(a, &t2, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* Miller-Rabin test of "a" to the base of "b" as described in
|
/* Miller-Rabin test of "a" to the base of "b" as described in
|
||||||
@ -71,7 +64,3 @@ void fp_prime_miller_rabin (fp_int * a, fp_int * b, int *result)
|
|||||||
/* probably prime now */
|
/* probably prime now */
|
||||||
*result = FP_YES;
|
*result = FP_YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* This is possibly the mother of all prime generation functions, muahahahahaha! */
|
/* This is possibly the mother of all prime generation functions, muahahahahaha! */
|
||||||
@ -95,7 +88,3 @@ error:
|
|||||||
free(tmp);
|
free(tmp);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* b = a*a */
|
/* b = a*a */
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/*
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
#if defined(TFM_PRESCOTT) && defined(TFM_SSE2)
|
#if defined(TFM_PRESCOTT) && defined(TFM_SSE2)
|
||||||
@ -671,7 +664,3 @@ asm( \
|
|||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -139,8 +139,3 @@ void fp_sqr_comba12(fp_int *A, fp_int *B)
|
|||||||
fp_clamp(B);
|
fp_clamp(B);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -189,8 +189,3 @@ void fp_sqr_comba17(fp_int *A, fp_int *B)
|
|||||||
fp_clamp(B);
|
fp_clamp(B);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -219,8 +219,3 @@ void fp_sqr_comba20(fp_int *A, fp_int *B)
|
|||||||
fp_clamp(B);
|
fp_clamp(B);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -259,8 +259,3 @@ void fp_sqr_comba24(fp_int *A, fp_int *B)
|
|||||||
fp_clamp(B);
|
fp_clamp(B);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -299,8 +299,3 @@ void fp_sqr_comba28(fp_int *A, fp_int *B)
|
|||||||
fp_clamp(B);
|
fp_clamp(B);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -49,8 +49,3 @@ void fp_sqr_comba3(fp_int *A, fp_int *B)
|
|||||||
fp_clamp(B);
|
fp_clamp(B);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -339,8 +339,3 @@ void fp_sqr_comba32(fp_int *A, fp_int *B)
|
|||||||
fp_clamp(B);
|
fp_clamp(B);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -59,8 +59,3 @@ void fp_sqr_comba4(fp_int *A, fp_int *B)
|
|||||||
fp_clamp(B);
|
fp_clamp(B);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -499,8 +499,3 @@ void fp_sqr_comba48(fp_int *A, fp_int *B)
|
|||||||
fp_clamp(B);
|
fp_clamp(B);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -79,8 +79,3 @@ void fp_sqr_comba6(fp_int *A, fp_int *B)
|
|||||||
fp_clamp(B);
|
fp_clamp(B);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -659,8 +659,3 @@ void fp_sqr_comba64(fp_int *A, fp_int *B)
|
|||||||
fp_clamp(B);
|
fp_clamp(B);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -89,8 +89,3 @@ void fp_sqr_comba7(fp_int *A, fp_int *B)
|
|||||||
fp_clamp(B);
|
fp_clamp(B);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -99,8 +99,3 @@ void fp_sqr_comba8(fp_int *A, fp_int *B)
|
|||||||
fp_clamp(B);
|
fp_clamp(B);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -109,8 +109,3 @@ void fp_sqr_comba9(fp_int *A, fp_int *B)
|
|||||||
fp_clamp(B);
|
fp_clamp(B);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef TFM_PRE_GEN_MPI_C
|
#ifndef TFM_PRE_GEN_MPI_C
|
||||||
#define TFM_DEFINES
|
#define TFM_DEFINES
|
||||||
@ -94,7 +87,3 @@ void fp_sqr_comba(fp_int *A, fp_int *B)
|
|||||||
fp_copy(dst, B);
|
fp_copy(dst, B);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1519,7 +1519,3 @@ void fp_sqr_comba_small(fp_int *A, fp_int *B)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif /* TFM_SMALL_SET */
|
#endif /* TFM_SMALL_SET */
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
*
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
* This project is meant to fill in where LibTomMath
|
|
||||||
* falls short. That is speed ;-)
|
|
||||||
*
|
|
||||||
* This project is public domain and free for all purposes.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
|
||||||
#include <tfm_private.h>
|
#include <tfm_private.h>
|
||||||
|
|
||||||
/* c = a * a (mod b) */
|
/* c = a * a (mod b) */
|
||||||
@ -17,7 +10,3 @@ int fp_sqrmod(fp_int *a, fp_int *b, fp_int *c)
|
|||||||
fp_sqr(a, &tmp);
|
fp_sqr(a, &tmp);
|
||||||
return fp_mod(&tmp, b, c);
|
return fp_mod(&tmp, b, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
Loading…
Reference in New Issue
Block a user