Skip to content

Commit fd941b7

Browse files
committed
Revert "remove headers too"
This reverts commit 2b6a81d.
1 parent 2b6a81d commit fd941b7

File tree

149 files changed

+1818
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+1818
-0
lines changed

bn_error.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_ERROR_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
static const struct {
416
int code;
517
const char *msg;

bn_fast_mp_invmod.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_FAST_MP_INVMOD_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
/* computes the modular inverse via binary extended euclidean algorithm,
416
* that is c = 1/a mod b
517
*

bn_fast_mp_montgomery_reduce.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_FAST_MP_MONTGOMERY_REDUCE_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
/* computes xR**-1 == x (mod N) via Montgomery Reduction
416
*
517
* This is an optimized implementation of montgomery_reduce

bn_fast_s_mp_mul_digs.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_FAST_S_MP_MUL_DIGS_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
/* Fast (comba) multiplier
416
*
517
* This is the fast column-array [comba] multiplier. It is

bn_fast_s_mp_mul_high_digs.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_FAST_S_MP_MUL_HIGH_DIGS_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
/* this is a modified version of fast_s_mul_digs that only produces
416
* output digits *above* digs. See the comments for fast_s_mul_digs
517
* to see how it works.

bn_fast_s_mp_sqr.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_FAST_S_MP_SQR_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
/* the jist of squaring...
416
* you do like mult except the offset of the tmpx [one that
517
* starts closer to zero] can't equal the offset of tmpy.

bn_mp_2expt.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_MP_2EXPT_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
/* computes a = 2**b
416
*
517
* Simple algorithm which zeroes the int, grows it then just sets one bit

bn_mp_abs.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_MP_ABS_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
/* b = |a|
416
*
517
* Simple function copies the input and fixes the sign to positive

bn_mp_add.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_MP_ADD_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
/* high level addition (handles signs) */
416
int mp_add(const mp_int *a, const mp_int *b, mp_int *c)
517
{

bn_mp_add_d.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_MP_ADD_D_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
/* single digit addition */
416
int mp_add_d(const mp_int *a, mp_digit b, mp_int *c)
517
{

bn_mp_addmod.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_MP_ADDMOD_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
/* d = a + b (mod c) */
416
int mp_addmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d)
517
{

bn_mp_and.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_MP_AND_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
/* AND two ints together */
416
int mp_and(const mp_int *a, const mp_int *b, mp_int *c)
517
{

bn_mp_clamp.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_MP_CLAMP_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
/* trim unused digits
416
*
517
* This is used to ensure that leading zero digits are

bn_mp_clear.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_MP_CLEAR_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
/* clear one (frees) */
416
void mp_clear(mp_int *a)
517
{

bn_mp_clear_multi.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_MP_CLEAR_MULTI_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
#include <stdarg.h>
416

517
void mp_clear_multi(mp_int *mp, ...)

bn_mp_cmp.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_MP_CMP_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
/* compare two ints (signed)*/
416
int mp_cmp(const mp_int *a, const mp_int *b)
517
{

bn_mp_cmp_d.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_MP_CMP_D_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
/* compare a digit */
416
int mp_cmp_d(const mp_int *a, mp_digit b)
517
{

bn_mp_cmp_mag.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_MP_CMP_MAG_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
/* compare maginitude of two ints (unsigned) */
416
int mp_cmp_mag(const mp_int *a, const mp_int *b)
517
{

bn_mp_cnt_lsb.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_MP_CNT_LSB_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
static const int lnz[16] = {
416
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
517
};

bn_mp_complement.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_MP_COMPLEMENT_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
/* b = ~a */
416
int mp_complement(const mp_int *a, mp_int *b)
517
{

bn_mp_copy.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_MP_COPY_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
/* copy, b = a */
416
int mp_copy(const mp_int *a, mp_int *b)
517
{

bn_mp_count_bits.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include "tommath_private.h"
22
#ifdef BN_MP_COUNT_BITS_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis
4+
*
5+
* LibTomMath is a library that provides multiple-precision
6+
* integer arithmetic as well as number theoretic functionality.
7+
*
8+
* The library was designed directly after the MPI library by
9+
* Michael Fromberger but has been written from scratch with
10+
* additional optimizations in place.
11+
*
12+
* SPDX-License-Identifier: Unlicense
13+
*/
14+
315
/* returns the number of bits in an int */
416
int mp_count_bits(const mp_int *a)
517
{

0 commit comments

Comments
 (0)