-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
206 changed files
with
23,351 additions
and
27,592 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/.travis.yml export-ignore | ||
|
||
/** export-subst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,35 @@ | ||
language: c | ||
compiler: | ||
- gcc | ||
|
||
script: | ||
- make travis_mtest | ||
- head -n 5 test.log | ||
- tail -n 2 test.log | ||
- ./testme.sh --with-cc=gcc --with-low-mp | ||
install: | ||
- sudo apt-get update -qq | ||
- sudo apt-get install gcc-multilib | ||
|
||
matrix: | ||
fast_finish: true | ||
branches: | ||
only: | ||
- master | ||
- develop | ||
- /^release\/.*$/ | ||
|
||
compiler: | ||
- gcc | ||
- clang | ||
script: | ||
- ./testme.sh --with-cc=$CC ${BUILDOPTIONS} | ||
env: | ||
- | | ||
BUILDOPTIONS="--test-vs-mtest=333333" | ||
- | | ||
BUILDOPTIONS="--test-vs-mtest=333333 --mtest-real-rand" | ||
- | | ||
BUILDOPTIONS="--with-low-mp" | ||
- | | ||
BUILDOPTIONS="--with-m64 --with-m32 --with-mx32" | ||
after_failure: | ||
- cat test_*.log | ||
- cat gcc_errors_*.log | ||
|
||
notifications: | ||
irc: "chat.freenode.net#libtom-notifications" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,26 @@ | ||
LibTomMath is licensed under DUAL licensing terms. | ||
|
||
Choose and use the license of your needs. | ||
|
||
[LICENSE #1] | ||
|
||
LibTomMath is public domain. As should all quality software be. | ||
|
||
Tom St Denis | ||
|
||
[/LICENSE #1] | ||
|
||
[LICENSE #2] | ||
|
||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
Version 2, December 2004 | ||
|
||
Copyright (C) 2004 Sam Hocevar <[email protected]> | ||
|
||
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] | ||
The LibTom license | ||
|
||
This is free and unencumbered software released into the public domain. | ||
|
||
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. | ||
|
||
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. | ||
|
||
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. | ||
|
||
For more information, please refer to <http://unlicense.org/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
[![Build Status - master](https://travis-ci.org/libtom/libtommath.png?branch=master)](https://travis-ci.org/libtom/libtommath) | ||
# libtommath | ||
|
||
[![Build Status - develop](https://travis-ci.org/libtom/libtommath.png?branch=develop)](https://travis-ci.org/libtom/libtommath) | ||
This is the git repository for [LibTomMath](http://www.libtom.net/LibTomMath/), a free open source portable number theoretic multiple-precision integer (MPI) library written entirely in C. | ||
|
||
This is the git repository for [LibTomMath](http://www.libtom.org/), a free open source portable number theoretic multiple-precision integer (MPI) library written entirely in C. | ||
## Build Status | ||
|
||
master: [![Build Status](https://api.travis-ci.org/libtom/libtommath.png?branch=master)](https://travis-ci.org/libtom/libtommath) | ||
|
||
develop: [![Build Status](https://api.travis-ci.org/libtom/libtommath.png?branch=develop)](https://travis-ci.org/libtom/libtommath) | ||
|
||
API/ABI changes: [check here](https://abi-laboratory.pro/tracker/timeline/libtommath/) | ||
|
||
## Summary | ||
|
||
The `develop` branch contains the in-development version. Stable releases are tagged. | ||
|
||
Documentation is built from the LaTeX file `bn.tex`. There is also limited documentation in `tommath.h`. There is also a document, `tommath.pdf`, which describes the goals of the project and many of the algorithms used. | ||
|
||
The project can be build by using `make`. Along with the usual `make`, `make clean` and `make install`, there are several other build targets, see the makefile for details. There are also makefiles for certain specific platforms. | ||
|
||
## Testing | ||
|
||
Tests are located in `demo/` and can be built in two flavors. | ||
* `make test` creates a test binary that is intended to be run against `mtest`. `mtest` can be built with `make mtest` and test execution is done like `./mtest/mtest | ./test`. `mtest` is creating test vectors using an alternative MPI library and `test` is consuming these vectors to verify correct behavior of ltm | ||
* `make test_standalone` creates a stand-alone test binary that executes several test routines. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Artistic Style, see http://astyle.sourceforge.net/ | ||
# full documentation, see: http://astyle.sourceforge.net/astyle.html | ||
# | ||
# usage: | ||
# astyle --options=astylerc *.[ch] | ||
|
||
## Bracket Style Options | ||
style=kr | ||
|
||
## Tab Options | ||
indent=spaces=3 | ||
|
||
## Bracket Modify Options | ||
|
||
## Indentation Options | ||
min-conditional-indent=0 | ||
|
||
## Padding Options | ||
pad-header | ||
unpad-paren | ||
align-pointer=name | ||
|
||
## Formatting Options | ||
break-after-logical | ||
max-code-length=120 | ||
convert-tabs | ||
mode=c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#include <tommath_private.h> | ||
#include "tommath_private.h" | ||
#ifdef BN_ERROR_C | ||
/* LibTomMath, multiple-precision integer library -- Tom St Denis | ||
* | ||
|
@@ -9,31 +9,28 @@ | |
* Michael Fromberger but has been written from scratch with | ||
* additional optimizations in place. | ||
* | ||
* The library is free for all purposes without any express | ||
* guarantee it works. | ||
* | ||
* Tom St Denis, [email protected], http://libtom.org | ||
* SPDX-License-Identifier: Unlicense | ||
*/ | ||
|
||
static const struct { | ||
int code; | ||
const char *msg; | ||
int code; | ||
const char *msg; | ||
} msgs[] = { | ||
{ MP_OKAY, "Successful" }, | ||
{ MP_MEM, "Out of heap" }, | ||
{ MP_VAL, "Value out of range" } | ||
{ MP_OKAY, "Successful" }, | ||
{ MP_MEM, "Out of heap" }, | ||
{ MP_VAL, "Value out of range" } | ||
}; | ||
|
||
/* return a char * string for a given code */ | ||
const char *mp_error_to_string(int code) | ||
{ | ||
int x; | ||
size_t x; | ||
|
||
/* scan the lookup table for the given message */ | ||
for (x = 0; x < (int)(sizeof(msgs) / sizeof(msgs[0])); x++) { | ||
if (msgs[x].code == code) { | ||
return msgs[x].msg; | ||
} | ||
for (x = 0; x < (sizeof(msgs) / sizeof(msgs[0])); x++) { | ||
if (msgs[x].code == code) { | ||
return msgs[x].msg; | ||
} | ||
} | ||
|
||
/* generic reply for invalid code */ | ||
|
Oops, something went wrong.