• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /barrelfish-2018-10-04/lib/tommath/

Lines Matching refs:mp

188                           & functional mp\_div() function \\
325 \index{mp\_error\_to\_string}
334 The basic ``multiple precision integer'' type is known as the ``mp\_int'' within LibTomMath. This data type is used to
338 \index{mp\_int}
346 Where ``mp\_digit'' is a data type that represents individual digits of the integer. By default, an mp\_digit is the
347 ISO C ``unsigned long'' data type and each digit is $28-$bits long. The mp\_digit type can be configured to suit other
350 All LTM functions that use the mp\_int type will expect a pointer to mp\_int structure. You must allocate memory to
352 done to use an mp\_int is that it must be initialized.
377 A single mp\_int can be initialized with the ``mp\_init'' function.
379 \index{mp\_init}
384 This function expects a pointer to an mp\_int structure and will initialize the members of the structure so the mp\_int
385 represents the default integer which is zero. If the functions returns MP\_OKAY then the mp\_int is ready to be used
407 When you are finished with an mp\_int it is ideal to return the heap it used back to the system. The following function
410 \index{mp\_clear}
415 The function expects a pointer to a previously initialized mp\_int structure and frees the heap it uses. It sets the
416 pointer\footnote{The ``dp'' member.} within the mp\_int to \textbf{NULL} which is used to prevent double free situations.
417 Is is legal to call mp\_clear() twice on the same mp\_int in a row.
441 Certain algorithms require more than one large integer. In these instances it is ideal to initialize all of the mp\_int
445 The mp\_init\_multi() function provides this functionality.
447 \index{mp\_init\_multi} \index{mp\_clear\_multi}
449 int mp_init_multi(mp_int *mp, ...);
452 It accepts a \textbf{NULL} terminated list of pointers to mp\_int structures. It will attempt to initialize them all
453 at once. If the function returns MP\_OKAY then all of the mp\_int variables are ready to use, otherwise none of them
454 are available for use. A complementary mp\_clear\_multi() function allows multiple mp\_int variables to be free'd
481 To initialized and make a copy of an mp\_int the mp\_init\_copy() function has been provided.
483 \index{mp\_init\_copy}
514 Another less common initializer is mp\_init\_size() which allows the user to initialize an mp\_int with a given
518 \index{mp\_init\_size}
523 The $size$ parameter must be greater than zero. If the function succeeds the mp\_int $a$ will be initialized
548 When an mp\_int is in a state where it won't be changed again\footnote{A Diffie-Hellman modulus for instance.} excess
549 digits can be removed to return memory to the heap with the mp\_shrink() function.
551 \index{mp\_shrink}
556 This will remove excess digits of the mp\_int $a$. If the operation fails the mp\_int should be intact without the
557 excess digits being removed. Note that you can use a shrunk mp\_int in further computations, however, such operations
558 will require heap operations which can be slow. It is not ideal to shrink mp\_int variables that you will further
594 Within the mp\_int structure are two parameters which control the limitations of the array of digits that represent
595 the integer the mp\_int is meant to equal. The \textit{used} parameter dictates how many digits are significant, that is,
596 contribute to the value of the mp\_int. The \textit{alloc} parameter dictates how many digits are currently available in
597 the array. If you need to perform an operation that requires more digits you will have to mp\_grow() the mp\_int to
600 \index{mp\_grow}
641 Setting mp\_ints to small constants is a relatively common operation. To accomodate these instances there are two
650 \index{mp\_set}
686 \index{mp\_set\_int}
691 This will assign the value of the 32-bit variable $b$ to the mp\_int $a$. Unlike mp\_set() this function will always
695 To get the ``unsigned long'' copy of an mp\_int the following function can be used.
697 \index{mp\_get\_int}
702 This will return the 32 least significant bits of the mp\_int $a$.
740 \index{mp\_init\_set} \index{mp\_init\_set\_int}
746 Both functions work like the previous counterparts except they first mp\_init $a$ before setting the values.
810 mp\_int structures. This is analogous to an absolute comparison. The function mp\_cmp\_mag() will compare two
811 mp\_int variables based on their digits only.
813 \index{mp\_cmp\_mag}
856 If this program\footnote{This function uses the mp\_neg() function which is discussed in section \ref{sec:NEG}.} completes
867 To compare two mp\_int variables based on their signed value the mp\_cmp() function is provided.
869 \index{mp\_cmp}
874 This will compare $a$ to the left of $b$. It will first compare the signs of the two mp\_int variables. If they
914 If this program\footnote{This function uses the mp\_neg() function which is discussed in section \ref{sec:NEG}.} completes
923 To compare a single digit against an mp\_int the following function has been provided.
925 \index{mp\_cmp\_d}
981 \index{mp\_mul\_2} \index{mp\_div\_2}
1006 if ((result = mp\_mul\_2(&number, &number)) != MP_OKAY) \{
1018 if ((result = mp\_div\_2(&number, &number)) != MP_OKAY) \{
1045 \index{mp\_mul\_2d}
1055 \index{mp\_div\_2d}
1065 Strictly speaking the organization of the integers within the mp\_int structures is what is known as a
1073 \index{mp\_lshd}
1081 \index{mp\_rshd}
1093 \index{mp\_or} \index{mp\_and} \index{mp\_xor}
1106 \index{mp\_add} \index{mp\_sub}
1120 \index{mp\_neg}
1130 \index{mp\_neg}
1140 \index{mp\_div}
1153 \index{mp\_mul}
1162 Fortunately for the developer you don't really need to know this unless you really want to fine tune the system. mp\_mul()
1218 mp\_mul().
1220 \index{mp\_sqr}
1226 algorithms all which can be called from mp\_sqr(). It is ideal to use mp\_sqr over mp\_mul when squaring terms because
1288 algorithm mp\_exptmod when an appropriate modulus is detected.
1293 \index{mp\_mod}
1306 \index{mp\_reduce\_setup}
1314 \index{mp\_reduce}
1380 \index{mp\_montgomery\_setup}
1382 int mp_montgomery_setup(mp_int *a, mp_digit *mp);
1385 For the given odd moduli $a$ the precomputation value is placed in $mp$. The reduction is computed with the
1388 \index{mp\_montgomery\_reduce}
1390 int mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp);
1392 This reduces $a$ in place modulo $m$ with the pre--computed value $mp$. $a$ must be in the range
1404 \index{mp\_montgomery\_calc\_normalization}
1418 mp_digit mp;
1432 /* get mp value */
1433 if ((result = mp_montgomery_setup(&c, &mp)) != MP_OKAY) \{
1454 if ((result = mp_montgomery_reduce(&c, &b, mp)) != MP_OKAY) \{
1468 if ((result = mp_montgomery_reduce(&c, &b, mp)) != MP_OKAY) \{
1475 if ((result = mp_montgomery_reduce(&c, &b, mp)) != MP_OKAY) \{
1501 \index{mp\_dr\_setup}
1510 \index{mp\_dr\_reduce}
1512 int mp_dr_reduce(mp_int *a, mp_int *b, mp_digit mp);
1515 This reduces $a$ in place modulo $b$ with the pre--computed value $mp$. $b$ must be of a restricted
1532 \index{mp\_reduce\_2k\_setup}
1539 \index{mp\_reduce\_2k}
1545 slower than mp\_dr\_reduce but faster for most moduli sizes than the Montgomery reduction.
1549 \index{mp\_expt\_d}
1557 \index{mp\_exptmod}
1572 \index{mp\_n\_root}
1590 \index{mp\_prime\_is\_divisible}
1600 \index{mp\_prime\_fermat}
1609 \index{mp\_prime\_miller\_rabin}
1625 \index{mp\_prime\_rabin\_miller\_trials}
1636 \index{mp\_prime\_is\_prime}
1645 \index{mp\_prime\_next\_prime}
1649 This finds the next prime after $a$ that passes mp\_prime\_is\_prime() with $t$ tests. Set $bbs\_style$ to one if you
1653 \index{mp\_prime\_random}
1667 mp\_prime\_random() is more suitable for generating primes which must be secret (as in the case of RSA) since there
1671 but users are encouraged to use the new mp\_prime\_random\_ex() function instead.
1674 \index{mp\_prime\_random\_ex}
1683 mp\_prime\_random().
1708 \index{mp\_toradix}
1716 \index{mp\_radix\_size}
1724 \index{mp\_read\_radix}
1734 Converting an mp\_int to and from binary is another keen idea.
1736 \index{mp\_unsigned\_bin\_size}
1743 \index{mp\_to\_unsigned\_bin}
1750 \index{mp\_read\_unsigned\_bin}
1771 \index{mp\_exteuclid}
1786 \index{mp\_gcd}
1793 \index{mp\_lcm}
1800 \index{mp\_jacobi}
1810 \index{mp\_invmod}
1820 \index{mp\_add\_d} \index{mp\_sub\_d} \index{mp\_mul\_d} \index{mp\_div\_d} \index{mp\_mod\_d}
1829 These work like the full mp\_int capable variants except the second parameter $b$ is a mp\_digit. These
1831 an entire mp\_int to store a number like $1$ or $2$.