Main Page Modules Data Structures File List Data Fields Globals Related Pages

# beecrypt/mp32.h File Reference

Multiprecision 2's complement integer routines for 32 bit cpu, header/. More...

`#include "beecrypt.h"`
`#include <stdio.h>`
`#include "mp32opt.h"`

Go to the source code of this file.

## Defines
#define | mp32copy(size, dst, src) memcpy(dst, src, (size) << 2)
#define | mp32move(size, dst, src) memmove(dst, src, (size) << 2)
## Functions
void | mp32copy (uint32 size, uint32 *dst, const uint32 *src)
void | mp32move (uint32 size, uint32 *dst, const uint32 *src)
void | mp32zero (uint32 xsize, uint32 *xdata)
void | mp32fill (uint32 xsize, uint32 *xdata, uint32 val)
int | mp32odd (uint32 xsize, const uint32 *xdata)
int | mp32even (uint32 xsize, const uint32 *xdata)
int | mp32z (uint32 xsize, const uint32 *xdata)
int | mp32nz (uint32 xsize, const uint32 *xdata)
int | mp32eq (uint32 size, const uint32 *xdata, const uint32 *ydata)
int | mp32ne (uint32 size, const uint32 *xdata, const uint32 *ydata)
int | mp32gt (uint32 size, const uint32 *xdata, const uint32 *ydata)
int | mp32lt (uint32 size, const uint32 *xdata, const uint32 *ydata)
int | mp32ge (uint32 size, const uint32 *xdata, const uint32 *ydata)
int | mp32le (uint32 size, const uint32 *xdata, const uint32 *ydata)
int | mp32eqx (uint32 xsize, const uint32 *xdata, uint32 ysize, const uint32 *ydata)
int | mp32nex (uint32 xsize, const uint32 *xdata, uint32 ysize, const uint32 *ydata)
int | mp32gtx (uint32 xsize, const uint32 *xdata, uint32 ysize, const uint32 *ydata)
int | mp32ltx (uint32 xsize, const uint32 *xdata, uint32 ysize, const uint32 *ydata)
int | mp32gex (uint32 xsize, const uint32 *xdata, uint32 ysize, const uint32 *ydata)
int | mp32lex (uint32 xsize, const uint32 *xdata, uint32 ysize, const uint32 *ydata)
int | mp32isone (uint32 xsize, const uint32 *xdata)
int | mp32istwo (uint32 xsize, const uint32 *xdata)
int | mp32leone (uint32 xsize, const uint32 *xdata)
int | mp32eqmone (uint32 size, const uint32 *xdata, const uint32 *ydata)
int | mp32msbset (uint32 xsize, const uint32 *xdata)
int | mp32lsbset (uint32 xsize, const uint32 *xdata)
void | mp32setmsb (uint32 xsize, uint32 *xdata)
void | mp32setlsb (uint32 xsize, uint32 *xdata)
void | mp32clrmsb (uint32 xsize, uint32 *xdata)
void | mp32clrlsb (uint32 xsize, uint32 *xdata)
void | mp32xor (uint32 size, uint32 *xdata, const uint32 *ydata)
void | mp32not (uint32 xsize, uint32 *xdata)
void | mp32setw (uint32 xsize, uint32 *xdata, uint32 y)
void | mp32setx (uint32 xsize, uint32 *xdata, uint32 ysize, const uint32 *ydata)
uint32 | mp32addw (uint32 xsize, uint32 *xdata, uint32 y)
uint32 | mp32add (uint32 size, uint32 *xdata, const uint32 *ydata)
uint32 | mp32addx (uint32 xsize, uint32 *xdata, uint32 ysize, const uint32 *ydata)
uint32 | mp32subw (uint32 xsize, uint32 *xdata, uint32 y)
uint32 | mp32sub (uint32 size, uint32 *xdata, const uint32 *ydata)
uint32 | mp32subx (uint32 xsize, uint32 *xdata, uint32 ysize, const uint32 *ydata)
uint32 | mp32multwo (uint32 xsize, uint32 *xdata)
void | mp32neg (uint32 xsize, uint32 *xdata)
uint32 | mp32size (uint32 xsize, const uint32 *xdata)
uint32 | mp32mszcnt (uint32 xsize, const uint32 *xdata)
uint32 | mp32lszcnt (uint32 xsize, const uint32 *xdata)
void | mp32lshift (uint32 xsize, uint32 *xdata, uint32 count)
void | mp32rshift (uint32 xsize, uint32 *xdata, uint32 count)
uint32 | mp32rshiftlsz (uint32 xsize, uint32 *xdata)
uint32 | mp32norm (uint32 xsize, uint32 *xdata)
uint32 | mp32divpowtwo (uint32 xsize, uint32 *xdata)
void | mp32divtwo (uint32 xsize, uint32 *xdata)
void | mp32sdivtwo (uint32 xsize, uint32 *xdata)
uint32 | mp32setmul (uint32 size, uint32 *result, const uint32 *xdata, uint32 y)
uint32 | mp32addmul (uint32 size, uint32 *result, const uint32 *xdata, uint32 y)
uint32 | mp32addsqrtrc (uint32 size, uint32 *result, const uint32 *xdata)
void | mp32mul (uint32 *result, uint32 xsize, const uint32 *xdata, uint32 ysize, const uint32 *ydata)
void | mp32sqr (uint32 *result, uint32 xsize, const uint32 *xdata)
void | mp32gcd_w (uint32 size, const uint32 *xdata, const uint32 *ydata, uint32 *result, uint32 *wksp)
| mp32gcd_w need workspace of (size) words. More...
uint32 | mp32nmodw (uint32 *result, uint32 xsize, const uint32 *xdata, uint32 y, uint32 *wksp)
void | mp32nmod (uint32 *result, uint32 xsize, const uint32 *xdata, uint32 ysize, const uint32 *ydata, uint32 *wksp)
void | mp32ndivmod (uint32 *result, uint32 xsize, const uint32 *xdata, uint32 ysize, const uint32 *ydata, uint32 *wksp)
void | mp32print (FILE *fp, uint32 xsize, const uint32 *xdata)
void | mp32println (FILE *fp, uint32 xsize, const uint32 *xdata)

## Detailed Description

Multiprecision 2's complement integer routines for 32 bit cpu, header/.

Definition in file mp32.h.

## Define Documentation

#define mp32copy | ( | size,
|  | dst,
|  | src |  | ) | memcpy(dst, src, (size) << 2)

| Definition at line 53 of file mp32.h. Referenced by aesSetup, dldp_pgonMakeSafe, dldp_pgoqMakeSafe, fips186init, fips186Next, md5Digest, md5Reset, mp32bcopy, mp32bmod_w, mp32bmu_w, mp32bneg, mp32brnd_w, mp32brndodd_w, mp32bset, mp32bsubone, mp32gcd_w, mp32ndivmod, mp32ninit, mp32nmod, mp32nmodw, mp32nset, mp32pmilrab_w, mp32prnd_w, mp32prndconone_w, mp32prndsafe_w, mtprngSeed, sha1Digest, sha1Reset, sha256Digest, and sha256Reset.

#define mp32move | ( | size,
|  | dst,
|  | src |  | ) | memmove(dst, src, (size) << 2)

| Definition at line 66 of file mp32.h. Referenced by mp32lshift, and mp32rshift.

## Function Documentation

uint32 mp32add | ( | uint32 | size,
|  | uint32 * | xdata,
|  | const uint32 * | ydata
| ) |

| Referenced by elgv1sign, mp32addx, mp32binv_w, mp32bneg, and mp32btwopowmod_w.

uint32 mp32addmul | ( | uint32 | size,
|  | uint32 * | result,
|  | const uint32 * | xdata,
|  | uint32 | y
| ) |

| Referenced by mp32bmod_w, mp32mul, and mp32sqr.

uint32 mp32addsqrtrc | ( | uint32 | size,
|  | uint32 * | result,
|  | const uint32 * | xdata
| ) |

| Referenced by mp32sqr.

uint32 mp32addw | ( | uint32 | xsize,
|  | uint32 * | xdata,
|  | uint32 | y
| ) |

| Referenced by fips186Next, mp32addx, mp32neg, and mp32prndconone_w.

uint32 mp32addx | ( | uint32 | xsize,
|  | uint32 * | xdata,
|  | uint32 | ysize,
|  | const uint32 * | ydata
| ) |

| Referenced by fips186Next, fips186Seed, mp32baddmod_w, mp32bsubmod_w, and rsapricrt.

void mp32clrlsb | ( | uint32 | xsize,
|  | uint32 * | xdata
| ) |

void mp32clrmsb | ( | uint32 | xsize,
|  | uint32 * | xdata
| ) |

void mp32copy | ( | uint32 | size,
|  | uint32 * | dst,
|  | const uint32 * | src
| ) |

uint32 mp32divpowtwo | ( | uint32 | xsize,
|  | uint32 * | xdata
| ) |

void mp32divtwo | ( | uint32 | xsize,
|  | uint32 * | xdata
| ) |

| Referenced by dldp_pgonGenerator_w, dldp_pgonMakeSafe, dldp_pgoqMakeSafe, mp32binv_w, mp32prndsafe_w, and mp32sdivtwo.

int mp32eq | ( | uint32 | size,
|  | const uint32 * | xdata,
|  | const uint32 * | ydata
| ) |

| Referenced by elgv1vrfy, elgv3vrfy, hashFunctionContextDigestMatch, keyedHashFunctionContextDigestMatch, mp32eqx, mp32pmilraba_w, and mp32pmilrabtwo_w.

int mp32eqmone | ( | uint32 | size,
|  | const uint32 * | xdata,
|  | const uint32 * | ydata
| ) |

int mp32eqx | ( | uint32 | xsize,
|  | const uint32 * | xdata,
|  | uint32 | ysize,
|  | const uint32 * | ydata
| ) |

| Referenced by dldp_pEqual, dlpk_pEqual, and rsavrfy.

int mp32even | ( | uint32 | xsize,
|  | const uint32 * | xdata
| ) |

| Referenced by dldp_pValidate, mp32binv_w, and mp32brndinv_w.

void mp32fill | ( | uint32 | xsize,
|  | uint32 * | xdata,
|  | uint32 | val
| ) |

void mp32gcd_w | ( | uint32 | size,
|  | const uint32 * | xdata,
|  | const uint32 * | ydata,
|  | uint32 * | result,
|  | uint32 * | wksp
| ) |

| mp32gcd_w need workspace of (size) words. Definition at line 1055 of file mp32.c. Referenced by mp32bpprime_w, mp32prnd_w, mp32prndconone_w, and mp32psppdiv_w.

int mp32ge | ( | uint32 | size,
|  | const uint32 * | xdata,
|  | const uint32 * | ydata
| ) |

| Referenced by mp32brnd_w, mp32brndodd_w, mp32btwopowmod_w, mp32gcd_w, mp32gex, mp32ndivmod, mp32nmod, and mp32nmodw.

int mp32gex | ( | uint32 | xsize,
|  | const uint32 * | xdata,
|  | uint32 | ysize,
|  | const uint32 * | ydata
| ) |

| Referenced by dldp_pValidate, dlpk_pgonValidate, dlpk_pgoqValidate, elgv1vrfy, elgv3vrfy, and mp32bmod_w.

int mp32gt | ( | uint32 | size,
|  | const uint32 * | xdata,
|  | const uint32 * | ydata
| ) |

| Referenced by mp32gtx.

int mp32gtx | ( | uint32 | xsize,
|  | const uint32 * | xdata,
|  | uint32 | ysize,
|  | const uint32 * | ydata
| ) |

int mp32isone | ( | uint32 | xsize,
|  | const uint32 * | xdata
| ) |

| Referenced by dldp_pgonGenerator_w, dldp_pgoqGenerator_w, mp32binv_w, mp32bpprime_w, mp32pmilraba_w, mp32pmilrabtwo_w, mp32prnd_w, mp32prndconone_w, and mp32psppdiv_w.

int mp32istwo | ( | uint32 | xsize,
|  | const uint32 * | xdata
| ) |

| Referenced by dldp_pgonGenerator_w.

int mp32le | ( | uint32 | size,
|  | const uint32 * | xdata,
|  | const uint32 * | ydata
| ) |

| Referenced by mp32lex, and rsakpMake.

int mp32leone | ( | uint32 | xsize,
|  | const uint32 * | xdata
| ) |

| Referenced by dldp_pValidate, dlpk_pgonValidate, dlpk_pgoqValidate, mp32brnd_w, and mp32brndodd_w.

int mp32lex | ( | uint32 | xsize,
|  | const uint32 * | xdata,
|  | uint32 | ysize,
|  | const uint32 * | ydata
| ) |

| Referenced by mp32prndconone_w.

int mp32lsbset | ( | uint32 | xsize,
|  | const uint32 * | xdata
| ) |

void mp32lshift | ( | uint32 | xsize,
|  | uint32 * | xdata,
|  | uint32 | count
| ) |

| Referenced by mp32gcd_w, and mp32norm.

uint32 mp32lszcnt | ( | uint32 | xsize,
|  | const uint32 * | xdata
| ) |

int mp32lt | ( | uint32 | size,
|  | const uint32 * | xdata,
|  | const uint32 * | ydata
| ) |

| Referenced by mp32ltx, mp32ndivmod, mp32nmod, and mp32nmodw.

int mp32ltx | ( | uint32 | xsize,
|  | const uint32 * | xdata,
|  | uint32 | ysize,
|  | const uint32 * | ydata
| ) |

void mp32move | ( | uint32 | size,
|  | uint32 * | dst,
|  | const uint32 * | src
| ) |

int mp32msbset | ( | uint32 | xsize,
|  | const uint32 * | xdata
| ) |

| Referenced by hashFunctionContextUpdateMP32, keyedHashFunctionContextUpdateMP32, and rsakpMake.

uint32 mp32mszcnt | ( | uint32 | xsize,
|  | const uint32 * | xdata
| ) |

| Referenced by mp32brnd_w, mp32brndodd_w, and mp32norm.

void mp32mul | ( | uint32 * | result,
|  | uint32 | xsize,
|  | const uint32 * | xdata,
|  | uint32 | ysize,
|  | const uint32 * | ydata
| ) |

| Definition at line 682 of file mp32.c. Referenced by mp32bmulmod_w, mp32bnmulmod, mp32prndconone_w, rsakpMake, and rsapricrt.

uint32 mp32multwo | ( | uint32 | xsize,
|  | uint32 * | xdata
| ) |

| Referenced by mp32prndconone_w, and mp32sqr.

void mp32ndivmod | ( | uint32 * | result,
|  | uint32 | xsize,
|  | const uint32 * | xdata,
|  | uint32 | ysize,
|  | const uint32 * | ydata,
|  | uint32 * | wksp
| ) |

| Referenced by mp32bmu_w.

int mp32ne | ( | uint32 | size,
|  | const uint32 * | xdata,
|  | const uint32 * | ydata
| ) |

| Referenced by mp32nex.

void mp32neg | ( | uint32 | xsize,
|  | uint32 * | xdata
| ) |

| Referenced by elgv1sign, mp32binv_w, and mp32bneg.

int mp32nex | ( | uint32 | xsize,
|  | const uint32 * | xdata,
|  | uint32 | ysize,
|  | const uint32 * | ydata
| ) |

void mp32nmod | ( | uint32 * | result,
|  | uint32 | xsize,
|  | const uint32 * | xdata,
|  | uint32 | ysize,
|  | const uint32 * | ydata,
|  | uint32 * | wksp
| ) |

| Definition at line 1170 of file mp32.c.

uint32 mp32nmodw | ( | uint32 * | result,
|  | uint32 | xsize,
|  | const uint32 * | xdata,
|  | uint32 | y,
|  | uint32 * | wksp
| ) |

| Definition at line 1113 of file mp32.c.

uint32 mp32norm | ( | uint32 | xsize,
|  | uint32 * | xdata
| ) |

| Referenced by mp32bmu_w.

void mp32not | ( | uint32 | xsize,
|  | uint32 * | xdata
| ) |

| Referenced by mp32neg.

int mp32nz | ( | uint32 | xsize,
|  | const uint32 * | xdata
| ) |

| Referenced by mp32binv_w, mp32gcd_w, mp32gex, mp32gtx, mp32lex, mp32ltx, and mp32nex.

int mp32odd | ( | uint32 | xsize,
|  | const uint32 * | xdata
| ) |

| Referenced by mp32binv_w, and mp32bpprime_w.

void mp32print | ( | FILE * | fp,
|  | uint32 | xsize,
|  | const uint32 * | xdata
| ) |

void mp32println | ( | FILE * | fp,
|  | uint32 | xsize,
|  | const uint32 * | xdata
| ) |

| Referenced by mp32binv_w, pgpHexSet, pgpPrtPubkeyParams, and pgpPrtSigParams.

void mp32rshift | ( | uint32 | xsize,
|  | uint32 * | xdata,
|  | uint32 | count
| ) |

| Referenced by mp32bmu_w.

uint32 mp32rshiftlsz | ( | uint32 | xsize,
|  | uint32 * | xdata
| ) |

| Referenced by mp32divpowtwo, mp32gcd_w, and mp32pmilrab_w.

void mp32sdivtwo | ( | uint32 | xsize,
|  | uint32 * | xdata
| ) |

| Referenced by mp32binv_w.

void mp32setlsb | ( | uint32 | xsize,
|  | uint32 * | xdata
| ) |

| Referenced by mp32brndodd_w, and mp32prndconone_w.

void mp32setmsb | ( | uint32 | xsize,
|  | uint32 * | xdata
| ) |

uint32 mp32setmul | ( | uint32 | size,
|  | uint32 * | result,
|  | const uint32 * | xdata,
|  | uint32 | y
| ) |

| Referenced by mp32bmod_w, mp32mul, mp32ndivmod, mp32nmod, mp32nmodw, and mp32sqr.

void mp32setw | ( | uint32 | xsize,
|  | uint32 * | xdata,
|  | uint32 | y
| ) |

| Referenced by mp32binv_w, mp32bpowmodsld_w, and mp32btwopowmod_w.

void mp32setx | ( | uint32 | xsize,
|  | uint32 * | xdata,
|  | uint32 | ysize,
|  | const uint32 * | ydata
| ) |

| Referenced by dldp_pgonGenerator_w, mp32baddmod_w, mp32binv_w, mp32bmod_w, mp32bpprime_w, mp32bslide_w, mp32bsubmod_w, mp32prnd_w, mp32prndconone_w, mp32psppdiv_w, and rsapricrt.

uint32 mp32size | ( | uint32 | xsize,
|  | const uint32 * | xdata
| ) |

void mp32sqr | ( | uint32 * | result,
|  | uint32 | xsize,
|  | const uint32 * | xdata
| ) |

| Referenced by mp32bnsqrmod, and mp32bsqrmod_w.

uint32 mp32sub | ( | uint32 | size,
|  | uint32 * | xdata,
|  | const uint32 * | ydata
| ) |

| Referenced by mp32binv_w, mp32bmod_w, mp32brnd_w, mp32brndodd_w, mp32btwopowmod_w, mp32gcd_w, mp32ndivmod, mp32nmod, mp32nmodw, and mp32subx.

uint32 mp32subw | ( | uint32 | xsize,
|  | uint32 * | xdata,
|  | uint32 | y
| ) |

| Referenced by mp32binv_w, mp32brnd_w, mp32brndodd_w, mp32bsubone, mp32pmilrab_w, mp32prnd_w, mp32prndconone_w, and mp32subx.

uint32 mp32subx | ( | uint32 | xsize,
|  | uint32 * | xdata,
|  | uint32 | ysize,
|  | const uint32 * | ydata
| ) |

| Referenced by mp32bmod_w, mp32bsubmod_w, mp32ndivmod, mp32nmod, and mp32nmodw.

void mp32xor | ( | uint32 | size,
|  | uint32 * | xdata,
|  | const uint32 * | ydata
| ) |

int mp32z | ( | uint32 | xsize,
|  | const uint32 * | xdata
| ) |

| Referenced by elgv1vrfy, elgv3vrfy, mp32eqx, mp32gex, mp32gtx, mp32lex, and mp32ltx.

void mp32zero | ( | uint32 | xsize,
|  | uint32 * | xdata
| ) |

| Referenced by md5Reset, mp32binv_w, mp32bmu_w, mp32bmulmod_w, mp32bnmulmod, mp32bnsqrmod, mp32bsqrmod_w, mp32lshift, mp32nwipe, mp32rshift, sha1Reset, and sha256Reset.