Merge tag 'v0.13.0' into develop

This is the v0.13.0 release
This commit is contained in:
Steffen Jaeckel 2015-10-24 14:57:39 +02:00
commit 2bb1d4dd2c
66 changed files with 13788 additions and 175 deletions

View File

@ -1,10 +1,14 @@
XXX, 2014 October 24th, 2015
v0.13.0 v0.13.0
-- Add fp_rand() -- Add fp_rand()
-- Fix bug in fp_sub() reported by Martins Mozeiko -- Fix bug in fp_sub() reported by Martins Mozeiko
-- Fix bugs/apply patches in fp_mul() and fp_sqr() reported by rasky -- Fix bugs/apply patches in fp_mul() and fp_sqr() reported by rasky
-- Fix bugs in fp_read_radix() -- Fix bugs in fp_read_radix()
-- Fix build issues for Linux x32 ABI -- Fix build issues for Linux x32 ABI
-- Sebastian Siewior provided fp_toradix_n(),
reported multiple issues on behalf of ClamAV
and did most of the testing work to be able to push this release out.
-- Fix a load of compiler warnings.
March 14th, 2007 March 14th, 2007
0.12 -- Christophe Devine contributed MIPS asm w00t 0.12 -- Christophe Devine contributed MIPS asm w00t

Binary file not shown.

View File

@ -1,7 +1,7 @@
#makefile for TomsFastMath #makefile for TomsFastMath
# #
# #
VERSION=0.12 VERSION=0.13
CFLAGS += -Wall -W -Wshadow -Isrc/headers CFLAGS += -Wall -W -Wshadow -Isrc/headers
@ -60,7 +60,8 @@ src/sqr/fp_sqr_comba_48.o src/sqr/fp_sqr_comba_4.o src/sqr/fp_sqr_comba_64.o src
src/sqr/fp_sqr_comba_7.o src/sqr/fp_sqr_comba_8.o src/sqr/fp_sqr_comba_9.o src/sqr/fp_sqr_comba.o \ src/sqr/fp_sqr_comba_7.o src/sqr/fp_sqr_comba_8.o src/sqr/fp_sqr_comba_9.o src/sqr/fp_sqr_comba.o \
src/sqr/fp_sqr_comba_generic.o src/sqr/fp_sqr_comba_small_set.o src/sqr/fp_sqrmod.o src/sqr/fp_sqr_comba_generic.o src/sqr/fp_sqr_comba_small_set.o src/sqr/fp_sqrmod.o
HEADERS=src/headers/tfm.h HEADERS_PUB:=src/headers/tfm.h
HEADERS=src/headers/tfm_private.h $(HEADERS_PUB)
#END_INS #END_INS
@ -100,7 +101,7 @@ install: $(LIBNAME)
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH) install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(INCPATH) install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(INCPATH)
install -g $(GROUP) -o $(USER) $(LIBNAME) $(DESTDIR)$(LIBPATH) install -g $(GROUP) -o $(USER) $(LIBNAME) $(DESTDIR)$(LIBPATH)
install -g $(GROUP) -o $(USER) $(HEADERS) $(DESTDIR)$(INCPATH) install -g $(GROUP) -o $(USER) $(HEADERS_PUB) $(DESTDIR)$(INCPATH)
.PHONY: mtest .PHONY: mtest
mtest: $(LIBNAME) mtest: $(LIBNAME)
@ -181,7 +182,8 @@ clean:
.PHONY: pre_gen .PHONY: pre_gen
pre_gen: pre_gen:
perl gen.pl perl gen.pl
mv mpi.c pre_gen/ sed -e 's/[[:blank:]]*$$//' mpi.c > pre_gen/mpi.c
rm mpi.c
zipup: zipup:
rm -rf ../tomsfastmath-$(VERSION) && rm -f ../tfm-$(VERSION).zip ../tfm-$(VERSION).tar.bz2 && \ rm -rf ../tomsfastmath-$(VERSION) && rm -f ../tfm-$(VERSION).zip ../tfm-$(VERSION).tar.bz2 && \

View File

@ -1,7 +1,7 @@
#makefile for TomsFastMath #makefile for TomsFastMath
# #
# #
VERSION=0:12 VERSION=1:0:0
LT ?= libtool LT ?= libtool
LTCOMPILE = $(LT) --mode=compile --tag=CC $(CC) LTCOMPILE = $(LT) --mode=compile --tag=CC $(CC)

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.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)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* c = a + b */ /* c = a + b */
void fp_add_d(fp_int *a, fp_digit b, fp_int *c) void fp_add_d(fp_int *a, fp_digit b, fp_int *c)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* d = a + b (mod c) */ /* d = a + b (mod c) */
int fp_addmod(fp_int *a, fp_int *b, fp_int *c, fp_int *d) int fp_addmod(fp_int *a, fp_int *b, fp_int *c, fp_int *d)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
int fp_cmp(fp_int *a, fp_int *b) int fp_cmp(fp_int *a, fp_int *b)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* compare against a single digit */ /* compare against a single digit */
int fp_cmp_d(fp_int *a, fp_digit b) int fp_cmp_d(fp_int *a, fp_digit b)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.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)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* c = a - b */ /* c = a - b */
void fp_sub(fp_int *a, fp_int *b, fp_int *c) void fp_sub(fp_int *a, fp_int *b, fp_int *c)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* c = a - b */ /* c = a - b */
void fp_sub_d(fp_int *a, fp_digit b, fp_int *c) void fp_sub_d(fp_int *a, fp_digit b, fp_int *c)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* d = a - b (mod c) */ /* d = a - b (mod c) */
int fp_submod(fp_int *a, fp_int *b, fp_int *c, fp_int *d) int fp_submod(fp_int *a, fp_int *b, fp_int *c, fp_int *d)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* unsigned addition */ /* unsigned addition */
void s_fp_add(fp_int *a, fp_int *b, fp_int *c) void s_fp_add(fp_int *a, fp_int *b, fp_int *c)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* unsigned subtraction ||a|| >= ||b|| ALWAYS! */ /* unsigned subtraction ||a|| >= ||b|| ALWAYS! */
void s_fp_sub(fp_int *a, fp_int *b, fp_int *c) void s_fp_sub(fp_int *a, fp_int *b, fp_int *c)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.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)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
int fp_read_radix(fp_int *a, char *str, int radix) int fp_read_radix(fp_int *a, char *str, int radix)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
void fp_read_signed_bin(fp_int *a, unsigned char *b, int c) void fp_read_signed_bin(fp_int *a, unsigned char *b, int c)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
void fp_read_unsigned_bin(fp_int *a, unsigned char *b, int c) void fp_read_unsigned_bin(fp_int *a, unsigned char *b, int c)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* reverse an array, used for radix code */ /* reverse an array, used for radix code */
void fp_reverse (unsigned char *s, int len) void fp_reverse (unsigned char *s, int len)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.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+/";

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
int fp_signed_bin_size(fp_int *a) int fp_signed_bin_size(fp_int *a)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.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)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.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)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/** /**
* a: pointer to fp_int representing the input number * a: pointer to fp_int representing the input number

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.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)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
int fp_unsigned_bin_size(fp_int *a) int fp_unsigned_bin_size(fp_int *a)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
static const int lnz[16] = { static const int lnz[16] = {
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
int fp_count_bits (fp_int * a) int fp_count_bits (fp_int * a)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* b = a/2 */ /* b = a/2 */
void fp_div_2(fp_int * a, fp_int * b) void fp_div_2(fp_int * a, fp_int * b)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* c = a / 2**b */ /* c = a / 2**b */
void fp_div_2d(fp_int *a, int b, fp_int *c, fp_int *d) void fp_div_2d(fp_int *a, int b, fp_int *c, fp_int *d)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
void fp_lshd(fp_int *a, int x) void fp_lshd(fp_int *a, int x)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* c = a mod 2**d */ /* c = a mod 2**d */
void fp_mod_2d(fp_int *a, int b, fp_int *c) void fp_mod_2d(fp_int *a, int b, fp_int *c)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
void fp_rshd(fp_int *a, int x) void fp_rshd(fp_int *a, int x)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* a/b => cb + d == a */ /* a/b => cb + d == a */
int fp_div(fp_int *a, fp_int *b, fp_int *c, fp_int *d) int fp_div(fp_int *a, fp_int *b, fp_int *c, fp_int *d)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.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)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* c = a mod b, 0 <= c < b */ /* c = a mod b, 0 <= c < b */
int fp_mod(fp_int *a, fp_int *b, fp_int *c) int fp_mod(fp_int *a, fp_int *b, fp_int *c)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* c = a mod b, 0 <= c < b */ /* c = a mod b, 0 <= c < b */
int fp_mod_d(fp_int *a, fp_digit b, fp_digit *c) int fp_mod_d(fp_int *a, fp_digit b, fp_digit *c)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* computes a = 2**b */ /* computes a = 2**b */
void fp_2expt(fp_int *a, int b) void fp_2expt(fp_int *a, int b)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
#ifdef TFM_TIMING_RESISTANT #ifdef TFM_TIMING_RESISTANT

View File

@ -22,8 +22,8 @@
* Patch * Patch
* XX - undefined * XX - undefined
*/ */
#define TFM_VERSION 0x000C0000 #define TFM_VERSION 0x000D0000
#define TFM_VERSION_S "0.12" #define TFM_VERSION_S "v0.13.0"
#ifndef MIN #ifndef MIN
#define MIN(x,y) ((x)<(y)?(x):(y)) #define MIN(x,y) ((x)<(y)?(x):(y))
@ -113,6 +113,10 @@
#error FP_MAX_SIZE must be a multiple of CHAR_BIT #error FP_MAX_SIZE must be a multiple of CHAR_BIT
#endif #endif
#if __SIZEOF_LONG__ == 8
#define FP_64BIT
#endif
/* autodetect x86-64 and make sure we are using 64-bit digits with x86-64 asm */ /* autodetect x86-64 and make sure we are using 64-bit digits with x86-64 asm */
#if defined(__x86_64__) #if defined(__x86_64__)
#if defined(TFM_X86) || defined(TFM_SSE2) || defined(TFM_ARM) #if defined(TFM_X86) || defined(TFM_SSE2) || defined(TFM_ARM)
@ -476,116 +480,8 @@ int fp_radix_size(fp_int *a, int radix, int *size);
int fp_toradix(fp_int *a, char *str, int radix); int fp_toradix(fp_int *a, char *str, int radix);
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);
/* VARIOUS LOW LEVEL STUFFS */
void s_fp_add(fp_int *a, fp_int *b, fp_int *c);
void s_fp_sub(fp_int *a, fp_int *b, fp_int *c);
void fp_reverse(unsigned char *s, int len);
void fp_mul_comba(fp_int *A, fp_int *B, fp_int *C);
#ifdef TFM_SMALL_SET
void fp_mul_comba_small(fp_int *A, fp_int *B, fp_int *C);
#endif #endif
#ifdef TFM_MUL3
void fp_mul_comba3(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL4
void fp_mul_comba4(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL6
void fp_mul_comba6(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL7
void fp_mul_comba7(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL8
void fp_mul_comba8(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL9
void fp_mul_comba9(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL12
void fp_mul_comba12(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL17
void fp_mul_comba17(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL20
void fp_mul_comba20(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL24
void fp_mul_comba24(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL28
void fp_mul_comba28(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL32
void fp_mul_comba32(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL48
void fp_mul_comba48(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL64
void fp_mul_comba64(fp_int *A, fp_int *B, fp_int *C);
#endif
void fp_sqr_comba(fp_int *A, fp_int *B);
#ifdef TFM_SMALL_SET
void fp_sqr_comba_small(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR3
void fp_sqr_comba3(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR4
void fp_sqr_comba4(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR6
void fp_sqr_comba6(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR7
void fp_sqr_comba7(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR8
void fp_sqr_comba8(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR9
void fp_sqr_comba9(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR12
void fp_sqr_comba12(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR17
void fp_sqr_comba17(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR20
void fp_sqr_comba20(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR24
void fp_sqr_comba24(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR28
void fp_sqr_comba28(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR32
void fp_sqr_comba32(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR48
void fp_sqr_comba48(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR64
void fp_sqr_comba64(fp_int *A, fp_int *B);
#endif
extern const char *fp_s_rmap;
#endif
/* $Source$ */ /* $Source$ */
/* $Revision$ */ /* $Revision$ */
/* $Date$ */ /* $Date$ */

125
src/headers/tfm_private.h Normal file
View File

@ -0,0 +1,125 @@
/* TomsFastMath, a fast ISO C bignum library.
*
* 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_PRIVATE_H_
#define TFM_PRIVATE_H_
#include <tfm.h>
/* VARIOUS LOW LEVEL STUFFS */
void s_fp_add(fp_int *a, fp_int *b, fp_int *c);
void s_fp_sub(fp_int *a, fp_int *b, fp_int *c);
void fp_reverse(unsigned char *s, int len);
void fp_mul_comba(fp_int *A, fp_int *B, fp_int *C);
#ifdef TFM_SMALL_SET
void fp_mul_comba_small(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL3
void fp_mul_comba3(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL4
void fp_mul_comba4(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL6
void fp_mul_comba6(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL7
void fp_mul_comba7(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL8
void fp_mul_comba8(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL9
void fp_mul_comba9(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL12
void fp_mul_comba12(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL17
void fp_mul_comba17(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL20
void fp_mul_comba20(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL24
void fp_mul_comba24(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL28
void fp_mul_comba28(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL32
void fp_mul_comba32(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL48
void fp_mul_comba48(fp_int *A, fp_int *B, fp_int *C);
#endif
#ifdef TFM_MUL64
void fp_mul_comba64(fp_int *A, fp_int *B, fp_int *C);
#endif
void fp_sqr_comba(fp_int *A, fp_int *B);
#ifdef TFM_SMALL_SET
void fp_sqr_comba_small(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR3
void fp_sqr_comba3(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR4
void fp_sqr_comba4(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR6
void fp_sqr_comba6(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR7
void fp_sqr_comba7(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR8
void fp_sqr_comba8(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR9
void fp_sqr_comba9(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR12
void fp_sqr_comba12(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR17
void fp_sqr_comba17(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR20
void fp_sqr_comba20(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR24
void fp_sqr_comba24(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR28
void fp_sqr_comba28(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR32
void fp_sqr_comba32(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR48
void fp_sqr_comba48(fp_int *A, fp_int *B);
#endif
#ifdef TFM_SQR64
void fp_sqr_comba64(fp_int *A, fp_int *B);
#endif
extern const char *fp_s_rmap;
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include "tfm.h" #include <tfm_private.h>
const char *fp_ident(void) const char *fp_ident(void)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* makes a pseudo-random int of a given size */ /* makes a pseudo-random int of a given size */

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
void fp_set(fp_int *a, fp_digit b) void fp_set(fp_int *a, fp_digit b)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.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
* normalizing numbers in a Montgomery system. * normalizing numbers in a Montgomery system.

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/******************************************************************/ /******************************************************************/
#if defined(TFM_X86) && !defined(TFM_SSE2) #if defined(TFM_X86) && !defined(TFM_SSE2)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* setups the montgomery reduction */ /* setups the montgomery reduction */
int fp_montgomery_setup(fp_int *a, fp_digit *rho) int fp_montgomery_setup(fp_int *a, fp_digit *rho)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* c = a * b */ /* c = a * b */
void fp_mul(fp_int *A, fp_int *B, fp_int *C) void fp_mul(fp_int *A, fp_int *B, fp_int *C)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.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)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* c = a * 2**d */ /* c = a * 2**d */
void fp_mul_2d(fp_int *a, int b, fp_int *c) void fp_mul_2d(fp_int *a, int b, fp_int *c)

View File

@ -12,7 +12,7 @@
*/ */
#include <tfm.h> #include <tfm_private.h>
#if defined(TFM_PRESCOTT) && defined(TFM_SSE2) #if defined(TFM_PRESCOTT) && defined(TFM_SSE2)
#undef TFM_SSE2 #undef TFM_SSE2

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* c = a * b */ /* c = a * b */
void fp_mul_d(fp_int *a, fp_digit b, fp_int *c) void fp_mul_d(fp_int *a, fp_digit b, fp_int *c)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.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)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* c = (a, b) */ /* c = (a, b) */
void fp_gcd(fp_int *a, fp_int *b, fp_int *c) void fp_gcd(fp_int *a, fp_int *b, fp_int *c)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.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)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
int fp_isprime(fp_int *a) int fp_isprime(fp_int *a)
{ {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* a few primes */ /* a few primes */
static const fp_digit primes[FP_PRIME_SIZE] = { static const fp_digit primes[FP_PRIME_SIZE] = {

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* c = [a, b] */ /* c = [a, b] */
void fp_lcm(fp_int *a, fp_int *b, fp_int *c) void fp_lcm(fp_int *a, fp_int *b, fp_int *c)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.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
* HAC pp. 139 Algorithm 4.24 * HAC pp. 139 Algorithm 4.24

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.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! */
int fp_prime_random_ex(fp_int *a, int t, int size, int flags, tfm_prime_callback cb, void *dat) int fp_prime_random_ex(fp_int *a, int t, int size, int flags, tfm_prime_callback cb, void *dat)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* b = a*a */ /* b = a*a */
void fp_sqr(fp_int *A, fp_int *B) void fp_sqr(fp_int *A, fp_int *B)

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
#if defined(TFM_PRESCOTT) && defined(TFM_SSE2) #if defined(TFM_PRESCOTT) && defined(TFM_SSE2)
#undef TFM_SSE2 #undef TFM_SSE2

View File

@ -7,7 +7,7 @@
* *
* Tom St Denis, tomstdenis@gmail.com * Tom St Denis, tomstdenis@gmail.com
*/ */
#include <tfm.h> #include <tfm_private.h>
/* c = a * a (mod b) */ /* c = a * a (mod b) */
int fp_sqrmod(fp_int *a, fp_int *b, fp_int *c) int fp_sqrmod(fp_int *a, fp_int *b, fp_int *c)

View File

@ -49,7 +49,7 @@
\begin{document} \begin{document}
\frontmatter \frontmatter
\pagestyle{empty} \pagestyle{empty}
\title{TomsFastMath User Manual \\ v0.12} \title{TomsFastMath User Manual \\ v0.13.0}
\author{Tom St Denis \\ tomstdenis@gmail.com} \author{Tom St Denis \\ tomstdenis@gmail.com}
\maketitle \maketitle
This text and library are all hereby placed in the public domain. This book has been formatted for B5 This text and library are all hereby placed in the public domain. This book has been formatted for B5