summaryrefslogtreecommitdiffstats
ModeNameSize
-rw-r--r--.clang-format217logstatsplain
-rw-r--r--.gitattributes1137logstatsplain
-rw-r--r--.gitignore64logstatsplain
-rw-r--r--.hooks-config418logstatsplain
d---------Auxiliary191logstatsplain
-rw-r--r--CMakeCPack.cmake9706logstatsplain
-rw-r--r--CMakeCPackOptions.cmake.in12897logstatsplain
-rw-r--r--CMakeGraphVizOptions.cmake153logstatsplain
-rw-r--r--CMakeLists.txt31095logstatsplain
-rw-r--r--CMakeLogo.gif4481logstatsplain
-rw-r--r--CONTRIBUTING.rst1851logstatsplain
-rw-r--r--CTestConfig.cmake440logstatsplain
-rw-r--r--CTestCustom.cmake.in6213logstatsplain
-rw-r--r--CompileFlags.cmake2868logstatsplain
-rw-r--r--Copyright.txt4999logstatsplain
-rw-r--r--DartConfig.cmake374logstatsplain
d---------Help587logstatsplain
d---------Licenses116logstatsplain
d---------Modules20156logstatsplain
d---------Packaging128logstatsplain
-rw-r--r--README.rst3006logstatsplain
d---------Source34673logstatsplain
d---------Templates514logstatsplain
d---------Tests10290logstatsplain
d---------Utilities1394logstatsplain
-rwxr-xr-xbootstrap49491logstatsplain
-rw-r--r--cmake_uninstall.cmake.in790logstatsplain
-rwxr-xr-xconfigure99logstatsplain
-rw-r--r--doxygen.config28046logstatsplain
witch_compile'>dgp_switch_compile Tcl is a high-level, general-purpose, interpreted, dynamic programming language. It was designed with the goal of being very simple but powerful.
summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_mp_reduce_setup.c
blob: 94bd26fef625ef5a7fe4ccf0b0e98a6e7e14f294 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <tommath.h>
#ifdef BN_MP_REDUCE_SETUP_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
 *
 * LibTomMath is a library that provides multiple-precision
 * integer arithmetic as well as number theoretic functionality.
 *
 * The library was designed directly after the MPI library by
 * 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, tomstdenis@gmail.com, http://math.libtomcrypt.com
 */

/* pre-calculate the value required for Barrett reduction
 * For a given modulus "b" it calulates the value required in "a"
 */
int mp_reduce_setup (mp_int * a, mp_int * b)
{
  int     res;
  
  if ((res = mp_2expt (a, b->used * 2 * DIGIT_BIT)) != MP_OKAY) {
    return res;
  }
  return mp_div (a, b, a, NULL);
}
#endif

/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_reduce_setup.c,v $ */
/* $Revision: 1.1.1.3 $ */
/* $Date: 2006/12/01 00:08:11 $ */