provide tfm_private.h

tfm.h contains declarations for the public part of the library.
tfm_private.h contains the function which are private to tfm and should
not be exposed to the public.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
This commit is contained in:
Sebastian Andrzej Siewior 2015-08-11 23:26:06 +02:00 committed by Sebastian Andrzej Siewior
parent 24d98570b0
commit f7e7f83718
60 changed files with 183 additions and 166 deletions

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

@ -480,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)