forked from ibphoenix/tomsfastmath
commit
c82a774e4c
1
.gitignore
vendored
1
.gitignore
vendored
@ -16,6 +16,7 @@
|
|||||||
test_*.txt
|
test_*.txt
|
||||||
*.pc
|
*.pc
|
||||||
doc/tfm.pdf
|
doc/tfm.pdf
|
||||||
|
pre_gen/
|
||||||
|
|
||||||
*.gcda
|
*.gcda
|
||||||
*.gcno
|
*.gcno
|
||||||
|
52
LICENSE
52
LICENSE
@ -1,36 +1,26 @@
|
|||||||
TomsFastMath is licensed under DUAL licensing terms.
|
The LibTom license
|
||||||
|
|
||||||
Choose and use the license of your needs.
|
This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
[LICENSE #1]
|
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
|
distribute this software, either in source code form or as a compiled
|
||||||
|
binary, for any purpose, commercial or non-commercial, and by any
|
||||||
|
means.
|
||||||
|
|
||||||
TomsFastMath is public domain. As should all quality software be.
|
In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
of this software dedicate any and all copyright interest in the
|
||||||
|
software to the public domain. We make this dedication for the benefit
|
||||||
|
of the public at large and to the detriment of our heirs and
|
||||||
|
successors. We intend this dedication to be an overt act of
|
||||||
|
relinquishment in perpetuity of all present and future rights to this
|
||||||
|
software under copyright law.
|
||||||
|
|
||||||
Tom St Denis
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
[/LICENSE #1]
|
For more information, please refer to <http://unlicense.org/>
|
||||||
|
|
||||||
[LICENSE #2]
|
|
||||||
|
|
||||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
||||||
Version 2, December 2004
|
|
||||||
|
|
||||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
|
||||||
|
|
||||||
Everyone is permitted to copy and distribute verbatim or modified
|
|
||||||
copies of this license document, and changing it is allowed as long
|
|
||||||
as the name is changed.
|
|
||||||
|
|
||||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
||||||
|
|
||||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
|
||||||
|
|
||||||
[/LICENSE #2]
|
|
||||||
|
|
||||||
-- Mark Karpelès & Steffen Jaeckel
|
|
||||||
|
|
||||||
Note some ideas were borrowed from LibTomMath and OpenSSL. All of the code is original or ported
|
|
||||||
from LibTomMath [no code was ported from OpenSSL].
|
|
||||||
|
|
||||||
-- Tom St Denis
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
|
|
||||||
#include "tfm.h"
|
#include "tfm.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
@ -77,7 +80,3 @@ int main(void)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
|
|
||||||
/* A simple static test program. */
|
/* A simple static test program. */
|
||||||
#include <tfm.h>
|
#include <tfm.h>
|
||||||
|
|
||||||
@ -180,8 +183,3 @@ int main(void)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
|
|
||||||
/* TFM demo program */
|
/* TFM demo program */
|
||||||
#include <tfm.h>
|
#include <tfm.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -435,9 +438,3 @@ draw(&a);draw(&b);draw(&c);draw(&d);
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
|
|
||||||
/* TFM timing analysis */
|
/* TFM timing analysis */
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#include <tfm.h>
|
#include <tfm.h>
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
# TomsFastMath, a fast ISO C bignum library. -- Tom St Denis
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
ifeq ($V,1)
|
ifeq ($V,1)
|
||||||
silent=
|
silent=
|
||||||
silent_stdout=
|
silent_stdout=
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
% TomsFastMath, a fast ISO C bignum library. -- Tom St Denis
|
||||||
|
% SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
\documentclass[b5paper]{book}
|
\documentclass[b5paper]{book}
|
||||||
\usepackage{hyperref}
|
\usepackage{hyperref}
|
||||||
\usepackage{makeidx}
|
\usepackage{makeidx}
|
||||||
@ -50,7 +53,7 @@
|
|||||||
\frontmatter
|
\frontmatter
|
||||||
\pagestyle{empty}
|
\pagestyle{empty}
|
||||||
\title{TomsFastMath User Manual \\ v0.13.1}
|
\title{TomsFastMath User Manual \\ v0.13.1}
|
||||||
\author{Tom St Denis \\ tomstdenis@gmail.com}
|
\author{LibTom Projects \\ www.libtom.net}
|
||||||
\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
|
||||||
[176x250] paper using the \LaTeX{} {\em book} macro package.
|
[176x250] paper using the \LaTeX{} {\em book} macro package.
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
#
|
||||||
# we want to filter every between START_INS and END_INS out and then insert crap from another file (this is fun)
|
# we want to filter every between START_INS and END_INS out and then insert crap from another file (this is fun)
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
$dst = shift;
|
$dst = shift;
|
||||||
$ins = shift;
|
$ins = shift;
|
||||||
|
1
gen.pl
1
gen.pl
@ -3,6 +3,7 @@
|
|||||||
# Generates a "single file" you can use to quickly
|
# Generates a "single file" you can use to quickly
|
||||||
# add the whole source without any makefile troubles
|
# add the whole source without any makefile troubles
|
||||||
#
|
#
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
open( OUT, ">mpi.c" ) or die "Couldn't open mpi.c for writing: $!";
|
open( OUT, ">mpi.c" ) or die "Couldn't open mpi.c for writing: $!";
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
export a=`find . -type f | sort | grep "[.]/src" | grep "[.]c" | grep -v generators | sed -e 'sE\./EE' | sed -e 's/\.c/\.o/' | xargs`
|
export a=`find . -type f | sort | grep "[.]/src" | grep "[.]c" | grep -v generators | sed -e 'sE\./EE' | sed -e 's/\.c/\.o/' | xargs`
|
||||||
perl ./parsenames.pl OBJECTS "$a"
|
perl ./parsenames.pl OBJECTS "$a"
|
||||||
export a=`find . -type f | grep [.]/src | grep [.]h | sed -e 'se\./ee' | xargs`
|
export a=`find . -type f | grep [.]/src | grep [.]h | sed -e 'se\./ee' | xargs`
|
||||||
perl ./parsenames.pl HEADERS "$a"
|
perl ./parsenames.pl HEADERS "$a"
|
||||||
|
|
||||||
# $Source: /cvs/libtom/tomsfastmath/genlist.sh,v $
|
|
||||||
# $Revision: 1.1 $
|
|
||||||
# $Date: 2006/12/31 21:31:40 $
|
|
||||||
|
10
makefile
10
makefile
@ -1,6 +1,6 @@
|
|||||||
#makefile for TomsFastMath
|
# makefile for TomsFastMath, a fast ISO C bignum library. -- Tom St Denis
|
||||||
#
|
# SPDX-License-Identifier: Unlicense
|
||||||
#
|
|
||||||
ifndef LIBNAME
|
ifndef LIBNAME
|
||||||
LIBNAME=libtfm.a
|
LIBNAME=libtfm.a
|
||||||
endif
|
endif
|
||||||
@ -130,7 +130,3 @@ stest: $(LIBNAME) demo/stest.o
|
|||||||
|
|
||||||
rsatest: $(LIBNAME) demo/rsa.o
|
rsatest: $(LIBNAME) demo/rsa.o
|
||||||
$(CC) $(CFLAGS) demo/rsa.o $(LIBNAME) -o rsatest
|
$(CC) $(CFLAGS) demo/rsa.o $(LIBNAME) -o rsatest
|
||||||
|
|
||||||
# ref: $Format:%D$
|
|
||||||
# git commit: $Format:%H$
|
|
||||||
# commit time: $Format:%ai$
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#makefile for TomsFastMath
|
# makefile for TomsFastMath, a fast ISO C bignum library. -- Tom St Denis
|
||||||
#
|
# SPDX-License-Identifier: Unlicense
|
||||||
#
|
|
||||||
ifndef LIBNAME
|
ifndef LIBNAME
|
||||||
LIBNAME=libtfm.la
|
LIBNAME=libtfm.la
|
||||||
endif
|
endif
|
||||||
@ -80,8 +80,3 @@ stest: $(LIBNAME) demo/stest.o
|
|||||||
.PHONY: timing
|
.PHONY: timing
|
||||||
timing: $(LIBNAME) demo/timing.o
|
timing: $(LIBNAME) demo/timing.o
|
||||||
$(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o timing demo/timing.o $(LIBNAME)
|
$(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o timing demo/timing.o $(LIBNAME)
|
||||||
|
|
||||||
# $Source$
|
|
||||||
# $Revision$
|
|
||||||
# $Date$
|
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Include makefile used by makefile + makefile.shared
|
# Include makefile used by makefile + makefile.shared
|
||||||
# (GNU make only)
|
# (GNU make only)
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
ifndef INSTALL_CMD
|
ifndef INSTALL_CMD
|
||||||
$(error your makefile must define INSTALL_CMD)
|
$(error your makefile must define INSTALL_CMD)
|
||||||
@ -134,13 +135,13 @@ docs:
|
|||||||
doc/tfm.pdf:
|
doc/tfm.pdf:
|
||||||
$(MAKE) -C doc/ tfm.pdf V=$(V)
|
$(MAKE) -C doc/ tfm.pdf V=$(V)
|
||||||
|
|
||||||
.PHONY: pre_gen
|
|
||||||
pre_gen:
|
pre_gen:
|
||||||
|
mkdir -p pre_gen
|
||||||
perl gen.pl
|
perl gen.pl
|
||||||
sed -e 's/[[:blank:]]*$$//' mpi.c > pre_gen/mpi.c
|
sed -e 's/[[:blank:]]*$$//' mpi.c > pre_gen/mpi.c
|
||||||
rm mpi.c
|
rm mpi.c
|
||||||
|
|
||||||
zipup: pre_gen doc/tfm.pdf
|
zipup: doc/tfm.pdf
|
||||||
@# Update the index, so diff-index won't fail in case the pdf has been created.
|
@# Update the index, so diff-index won't fail in case the pdf has been created.
|
||||||
@# As the pdf creation modifies tfm.tex, git sometimes detects the
|
@# As the pdf creation modifies tfm.tex, git sometimes detects the
|
||||||
@# modified file, but misses that it's put back to its original version.
|
@# modified file, but misses that it's put back to its original version.
|
||||||
@ -151,6 +152,7 @@ zipup: pre_gen doc/tfm.pdf
|
|||||||
git archive --format=tar --prefix=tomsfastmath-$(VERSION)/ HEAD | tar x
|
git archive --format=tar --prefix=tomsfastmath-$(VERSION)/ HEAD | tar x
|
||||||
mkdir -p tomsfastmath-$(VERSION)/doc
|
mkdir -p tomsfastmath-$(VERSION)/doc
|
||||||
cp doc/tfm.pdf tomsfastmath-$(VERSION)/doc/tfm.pdf
|
cp doc/tfm.pdf tomsfastmath-$(VERSION)/doc/tfm.pdf
|
||||||
|
$(MAKE) -C tomsfastmath-$(VERSION)/ pre_gen
|
||||||
tar -c tomsfastmath-$(VERSION)/ | xz -6e -c - > tfm-$(VERSION).tar.xz
|
tar -c tomsfastmath-$(VERSION)/ | xz -6e -c - > tfm-$(VERSION).tar.xz
|
||||||
zip -9rq tfm-$(VERSION).zip tomsfastmath-$(VERSION)
|
zip -9rq tfm-$(VERSION).zip tomsfastmath-$(VERSION)
|
||||||
rm -rf tomsfastmath-$(VERSION)
|
rm -rf tomsfastmath-$(VERSION)
|
||||||
@ -159,3 +161,5 @@ zipup: pre_gen doc/tfm.pdf
|
|||||||
|
|
||||||
new_file:
|
new_file:
|
||||||
bash updatemakes.sh
|
bash updatemakes.sh
|
||||||
|
|
||||||
|
.PHONY: pre_gen doc/tfm.pdf
|
||||||
|
4
mess.sh
4
mess.sh
@ -1,4 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
if cvs log $1 >/dev/null 2>/dev/null; then exit 0; else echo "$1 shouldn't be here" ; exit 1; fi
|
|
||||||
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
|||||||
|
# TomsFastMath, a fast ISO C bignum library. -- Tom St Denis
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
CFLAGS += -Wall -W -O3 -Wno-unused-result
|
CFLAGS += -Wall -W -O3 -Wno-unused-result
|
||||||
|
|
||||||
default: mtest
|
default: mtest
|
||||||
|
@ -27,6 +27,7 @@ mulmod
|
|||||||
1
|
1
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
|
|
||||||
#ifdef MP_8BIT
|
#ifdef MP_8BIT
|
||||||
#define THE_MASK 127
|
#define THE_MASK 127
|
||||||
@ -386,7 +387,3 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
# wrapped at 80 chars
|
# wrapped at 80 chars
|
||||||
#
|
#
|
||||||
# Tom St Denis
|
# Tom St Denis
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
@a = split(" ", $ARGV[1]);
|
@a = split(" ", $ARGV[1]);
|
||||||
$b = "$ARGV[0]=";
|
$b = "$ARGV[0]=";
|
||||||
$len = length($b);
|
$len = length($b);
|
||||||
@ -20,7 +21,3 @@ foreach my $obj (@a) {
|
|||||||
#if ($ARGV[0] eq "HEADERS") { print "testprof/tomcrypt_test.h"; }
|
#if ($ARGV[0] eq "HEADERS") { print "testprof/tomcrypt_test.h"; }
|
||||||
|
|
||||||
print "\n\n";
|
print "\n\n";
|
||||||
|
|
||||||
# $Source: /cvs/libtom/tomsfastmath/parsenames.pl,v $
|
|
||||||
# $Revision: 1.1 $
|
|
||||||
# $Date: 2006/12/31 21:31:40 $
|
|
||||||
|
13588
pre_gen/mpi.c
13588
pre_gen/mpi.c
File diff suppressed because it is too large
Load Diff
@ -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,3 +1,6 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
@ -8,6 +11,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
printf(
|
printf(
|
||||||
#if 1
|
#if 1
|
||||||
|
"/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */\n"
|
||||||
|
"/* SPDX-License-Identifier: Unlicense */\n"
|
||||||
"#ifdef TFM_SMALL_MONT_SET\n"
|
"#ifdef TFM_SMALL_MONT_SET\n"
|
||||||
"/* computes x/R == x (mod N) via Montgomery Reduction */\n"
|
"/* computes x/R == x (mod N) via Montgomery Reduction */\n"
|
||||||
"void fp_montgomery_reduce_small(fp_int *a, fp_int *m, fp_digit mp)\n"
|
"void fp_montgomery_reduce_small(fp_int *a, fp_int *m, fp_digit mp)\n"
|
||||||
|
@ -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>
|
||||||
@ -19,6 +12,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
/* print out preamble */
|
/* print out preamble */
|
||||||
printf(
|
printf(
|
||||||
|
"/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */\n"
|
||||||
|
"/* SPDX-License-Identifier: Unlicense */\n"
|
||||||
"#ifndef TFM_PRE_GEN_MPI_C\n"
|
"#ifndef TFM_PRE_GEN_MPI_C\n"
|
||||||
"#define TFM_DEFINES\n"
|
"#define TFM_DEFINES\n"
|
||||||
"#include \"fp_mul_comba.c\"\n"
|
"#include \"fp_mul_comba.c\"\n"
|
||||||
@ -77,15 +72,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$ */
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
|
|
||||||
/* program emits a NxN comba multiplier for 1x1 to 16x16 */
|
/* program emits a NxN comba multiplier for 1x1 to 16x16 */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -7,6 +10,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
/* print out preamble */
|
/* print out preamble */
|
||||||
printf(
|
printf(
|
||||||
|
"/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */\n"
|
||||||
|
"/* SPDX-License-Identifier: Unlicense */\n"
|
||||||
"#ifndef TFM_PRE_GEN_MPI_C\n"
|
"#ifndef TFM_PRE_GEN_MPI_C\n"
|
||||||
"#define TFM_DEFINES\n"
|
"#define TFM_DEFINES\n"
|
||||||
"#include \"fp_mul_comba.c\"\n"
|
"#include \"fp_mul_comba.c\"\n"
|
||||||
@ -57,14 +62,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>
|
||||||
@ -17,6 +10,8 @@ int main(int argc, char **argv)
|
|||||||
N = atoi(argv[1]);
|
N = atoi(argv[1]);
|
||||||
|
|
||||||
printf(
|
printf(
|
||||||
|
"/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */\n"
|
||||||
|
"/* SPDX-License-Identifier: Unlicense */\n"
|
||||||
"#ifndef TFM_PRE_GEN_MPI_C\n"
|
"#ifndef TFM_PRE_GEN_MPI_C\n"
|
||||||
"#define TFM_DEFINES\n"
|
"#define TFM_DEFINES\n"
|
||||||
"#include \"fp_sqr_comba.c\"\n"
|
"#include \"fp_sqr_comba.c\"\n"
|
||||||
@ -100,15 +95,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>
|
||||||
@ -16,6 +9,8 @@ int main(int argc, char **argv)
|
|||||||
int x, y, z, N, f;
|
int x, y, z, N, f;
|
||||||
|
|
||||||
printf(
|
printf(
|
||||||
|
"/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */\n"
|
||||||
|
"/* SPDX-License-Identifier: Unlicense */\n"
|
||||||
"#ifndef TFM_PRE_GEN_MPI_C\n"
|
"#ifndef TFM_PRE_GEN_MPI_C\n"
|
||||||
"#define TFM_DEFINES\n"
|
"#define TFM_DEFINES\n"
|
||||||
"#include \"fp_sqr_comba.c\"\n"
|
"#include \"fp_sqr_comba.c\"\n"
|
||||||
@ -108,15 +103,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,3 +1,6 @@
|
|||||||
|
# TomsFastMath, a fast ISO C bignum library. -- Tom St Denis
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
all: comba_sqr_gen comba_sqr_smallgen
|
all: comba_sqr_gen comba_sqr_smallgen
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
/* TomsFastMath, a fast ISO C bignum library.
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis
|
||||||
*
|
*
|
||||||
* This project is meant to fill in where LibTomMath
|
* This project is meant to fill in where LibTomMath
|
||||||
* falls short. That is speed ;-)
|
* falls short. That is speed ;-)
|
||||||
*
|
*
|
||||||
* This project is public domain and free for all purposes.
|
* This project is public domain and free for all purposes.
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com
|
|
||||||
*/
|
*/
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
#ifndef TFM_H_
|
#ifndef TFM_H_
|
||||||
#define TFM_H_
|
#define TFM_H_
|
||||||
|
|
||||||
@ -492,7 +491,3 @@ 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);
|
||||||
|
|
||||||
#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_PRIVATE_H_
|
#ifndef TFM_PRIVATE_H_
|
||||||
#define TFM_PRIVATE_H_
|
#define TFM_PRIVATE_H_
|
||||||
|
|
||||||
@ -119,7 +112,3 @@ void fp_sqr_comba64(fp_int *A, fp_int *B);
|
|||||||
extern const char *fp_s_rmap;
|
extern const char *fp_s_rmap;
|
||||||
|
|
||||||
#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>
|
||||||
|
|
||||||
#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,3 +1,5 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
#ifdef TFM_SMALL_MONT_SET
|
#ifdef TFM_SMALL_MONT_SET
|
||||||
/* computes x/R == x (mod N) via Montgomery Reduction */
|
/* computes x/R == x (mod N) via Montgomery Reduction */
|
||||||
void fp_montgomery_reduce_small(fp_int *a, fp_int *m, fp_digit mp)
|
void fp_montgomery_reduce_small(fp_int *a, fp_int *m, fp_digit mp)
|
||||||
|
@ -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 */
|
||||||
@ -132,8 +125,3 @@ clean:
|
|||||||
C->dp[y] = 0;
|
C->dp[y] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Source: /cvs/libtom/tomsfastmath/src/mul/fp_mul.c,v $ */
|
|
||||||
/* $Revision: 1.1 $ */
|
|
||||||
/* $Date: 2006/12/31 21:25:53 $ */
|
|
||||||
|
@ -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$ */
|
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
#ifndef TFM_PRE_GEN_MPI_C
|
#ifndef TFM_PRE_GEN_MPI_C
|
||||||
#define TFM_DEFINES
|
#define TFM_DEFINES
|
||||||
#include "fp_mul_comba.c"
|
#include "fp_mul_comba.c"
|
||||||
@ -111,8 +113,3 @@ void fp_mul_comba12(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
#ifndef TFM_PRE_GEN_MPI_C
|
#ifndef TFM_PRE_GEN_MPI_C
|
||||||
#define TFM_DEFINES
|
#define TFM_DEFINES
|
||||||
#include "fp_mul_comba.c"
|
#include "fp_mul_comba.c"
|
||||||
@ -151,8 +153,3 @@ void fp_mul_comba17(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
#ifndef TFM_PRE_GEN_MPI_C
|
#ifndef TFM_PRE_GEN_MPI_C
|
||||||
#define TFM_DEFINES
|
#define TFM_DEFINES
|
||||||
#include "fp_mul_comba.c"
|
#include "fp_mul_comba.c"
|
||||||
@ -175,8 +177,3 @@ void fp_mul_comba20(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
#ifndef TFM_PRE_GEN_MPI_C
|
#ifndef TFM_PRE_GEN_MPI_C
|
||||||
#define TFM_DEFINES
|
#define TFM_DEFINES
|
||||||
#include "fp_mul_comba.c"
|
#include "fp_mul_comba.c"
|
||||||
@ -207,8 +209,3 @@ void fp_mul_comba24(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
#ifndef TFM_PRE_GEN_MPI_C
|
#ifndef TFM_PRE_GEN_MPI_C
|
||||||
#define TFM_DEFINES
|
#define TFM_DEFINES
|
||||||
#include "fp_mul_comba.c"
|
#include "fp_mul_comba.c"
|
||||||
@ -239,8 +241,3 @@ void fp_mul_comba28(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
#ifndef TFM_PRE_GEN_MPI_C
|
#ifndef TFM_PRE_GEN_MPI_C
|
||||||
#define TFM_DEFINES
|
#define TFM_DEFINES
|
||||||
#include "fp_mul_comba.c"
|
#include "fp_mul_comba.c"
|
||||||
@ -39,8 +41,3 @@ void fp_mul_comba3(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
#ifndef TFM_PRE_GEN_MPI_C
|
#ifndef TFM_PRE_GEN_MPI_C
|
||||||
#define TFM_DEFINES
|
#define TFM_DEFINES
|
||||||
#include "fp_mul_comba.c"
|
#include "fp_mul_comba.c"
|
||||||
@ -285,8 +287,3 @@ void fp_mul_comba32(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
#ifndef TFM_PRE_GEN_MPI_C
|
#ifndef TFM_PRE_GEN_MPI_C
|
||||||
#define TFM_DEFINES
|
#define TFM_DEFINES
|
||||||
#include "fp_mul_comba.c"
|
#include "fp_mul_comba.c"
|
||||||
@ -47,8 +49,3 @@ void fp_mul_comba4(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
#ifndef TFM_PRE_GEN_MPI_C
|
#ifndef TFM_PRE_GEN_MPI_C
|
||||||
#define TFM_DEFINES
|
#define TFM_DEFINES
|
||||||
#include "fp_mul_comba.c"
|
#include "fp_mul_comba.c"
|
||||||
@ -429,8 +431,3 @@ void fp_mul_comba48(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
#ifndef TFM_PRE_GEN_MPI_C
|
#ifndef TFM_PRE_GEN_MPI_C
|
||||||
#define TFM_DEFINES
|
#define TFM_DEFINES
|
||||||
#include "fp_mul_comba.c"
|
#include "fp_mul_comba.c"
|
||||||
@ -63,8 +65,3 @@ void fp_mul_comba6(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
#ifndef TFM_PRE_GEN_MPI_C
|
#ifndef TFM_PRE_GEN_MPI_C
|
||||||
#define TFM_DEFINES
|
#define TFM_DEFINES
|
||||||
#include "fp_mul_comba.c"
|
#include "fp_mul_comba.c"
|
||||||
@ -573,8 +575,3 @@ void fp_mul_comba64(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
#ifndef TFM_PRE_GEN_MPI_C
|
#ifndef TFM_PRE_GEN_MPI_C
|
||||||
#define TFM_DEFINES
|
#define TFM_DEFINES
|
||||||
#include "fp_mul_comba.c"
|
#include "fp_mul_comba.c"
|
||||||
@ -71,8 +73,3 @@ void fp_mul_comba7(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
#ifndef TFM_PRE_GEN_MPI_C
|
#ifndef TFM_PRE_GEN_MPI_C
|
||||||
#define TFM_DEFINES
|
#define TFM_DEFINES
|
||||||
#include "fp_mul_comba.c"
|
#include "fp_mul_comba.c"
|
||||||
@ -79,8 +81,3 @@ void fp_mul_comba8(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
#ifndef TFM_PRE_GEN_MPI_C
|
#ifndef TFM_PRE_GEN_MPI_C
|
||||||
#define TFM_DEFINES
|
#define TFM_DEFINES
|
||||||
#include "fp_mul_comba.c"
|
#include "fp_mul_comba.c"
|
||||||
@ -87,8 +89,3 @@ void fp_mul_comba9(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
COMBA_FINI;
|
COMBA_FINI;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
|
||||||
/* $Revision$ */
|
|
||||||
/* $Date$ */
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */
|
||||||
|
/* SPDX-License-Identifier: Unlicense */
|
||||||
#ifndef TFM_PRE_GEN_MPI_C
|
#ifndef TFM_PRE_GEN_MPI_C
|
||||||
#define TFM_DEFINES
|
#define TFM_DEFINES
|
||||||
#include "fp_mul_comba.c"
|
#include "fp_mul_comba.c"
|
||||||
@ -1228,8 +1230,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 */
|
||||||
@ -119,8 +112,3 @@ clean:
|
|||||||
B->dp[y] = 0;
|
B->dp[y] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Source: /cvs/libtom/tomsfastmath/src/sqr/fp_sqr.c,v $ */
|
|
||||||
/* $Revision: 1.1 $ */
|
|
||||||
/* $Date: 2006/12/31 21:25:53 $ */
|
|
||||||
|
@ -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$ */
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user