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

# beecrypt/mp32.c File Reference

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

`#include "system.h"`
`#include "beecrypt.h"`
`#include "mp32opt.h"`
`#include "mp32.h"`
`#include "debug.h"`

Go to the source code of this file.

## Functions

void | mp32zero (register uint32 xsize, register uint32 *xdata)
void | mp32fill (register uint32 xsize, register uint32 *xdata, register uint32 val)
int | mp32odd (register uint32 xsize, register const uint32 *xdata)
int | mp32even (register uint32 xsize, register const uint32 *xdata)
int | mp32z (register uint32 xsize, register const uint32 *xdata)
int | mp32nz (register uint32 xsize, register const uint32 *xdata)
int | mp32eq (register uint32 size, register const uint32 *xdata, register const uint32 *ydata)
int | mp32eqx (register uint32 xsize, register const uint32 *xdata, register uint32 ysize, register const uint32 *ydata)
int | mp32ne (register uint32 size, register const uint32 *xdata, register const uint32 *ydata)
int | mp32nex (register uint32 xsize, register const uint32 *xdata, register uint32 ysize, register const uint32 *ydata)
int | mp32gt (register uint32 size, register const uint32 *xdata, register const uint32 *ydata)
int | mp32gtx (register uint32 xsize, register const uint32 *xdata, register uint32 ysize, register const uint32 *ydata)
int | mp32lt (register uint32 size, register const uint32 *xdata, register const uint32 *ydata)
int | mp32ltx (register uint32 xsize, register const uint32 *xdata, register uint32 ysize, register const uint32 *ydata)
int | mp32ge (register uint32 size, register const uint32 *xdata, register const uint32 *ydata)
int | mp32gex (register uint32 xsize, register const uint32 *xdata, register uint32 ysize, register const uint32 *ydata)
int | mp32le (register uint32 size, register const uint32 *xdata, register const uint32 *ydata)
int | mp32lex (register uint32 xsize, register const uint32 *xdata, register uint32 ysize, register const uint32 *ydata)
int | mp32isone (register uint32 xsize, register const uint32 *xdata)
int | mp32istwo (register uint32 xsize, register const uint32 *xdata)
int | mp32eqmone (register uint32 size, register const uint32 *xdata, register const uint32 *ydata)
int | mp32leone (register uint32 xsize, register const uint32 *xdata)
int | mp32msbset (register uint32 xsize, register const uint32 *xdata)
int | mp32lsbset (register uint32 xsize, register const uint32 *xdata)
void | mp32setmsb (register uint32 xsize, register uint32 *xdata)
void | mp32setlsb (register uint32 xsize, register uint32 *xdata)
void | mp32clrmsb (register uint32 xsize, register uint32 *xdata)
void | mp32clrlsb (register uint32 xsize, register uint32 *xdata)
void | mp32xor (register uint32 size, register uint32 *xdata, register const uint32 *ydata)
void | mp32not (register uint32 xsize, register uint32 *xdata)
void | mp32setw (register uint32 xsize, register uint32 *xdata, register uint32 y)
void | mp32setx (register uint32 xsize, register uint32 *xdata, register uint32 ysize, register const uint32 *ydata)
uint32 | mp32addw (register uint32 xsize, register uint32 *xdata, register uint32 y)
uint32 | mp32add (register uint32 size, register uint32 *xdata, register const uint32 *ydata)
uint32 | mp32addx (register uint32 xsize, register uint32 *xdata, register uint32 ysize, register const uint32 *ydata)
uint32 | mp32subw (register uint32 xsize, register uint32 *xdata, register uint32 y)
uint32 | mp32sub (register uint32 size, register uint32 *xdata, register const uint32 *ydata)
uint32 | mp32subx (register uint32 xsize, register uint32 *xdata, register uint32 ysize, register const uint32 *ydata)
void | mp32neg (register uint32 xsize, register uint32 *xdata)
uint32 | mp32setmul (register uint32 size, register uint32 *result, register const uint32 *xdata, register uint32 y)
uint32 | mp32addmul (register uint32 size, register uint32 *result, register const uint32 *xdata, register uint32 y)
void | mp32mul (uint32 *result, uint32 xsize, const uint32 *xdata, uint32 ysize, const uint32 *ydata)
uint32 | mp32addsqrtrc (register uint32 size, register uint32 *result, register const uint32 *xdata)
void | mp32sqr (register uint32 *result, register uint32 xsize, register const uint32 *xdata)
uint32 | mp32size (register uint32 xsize, register const uint32 *xdata)
uint32 | mp32norm (register uint32 xsize, register uint32 *xdata)
uint32 | mp32divpowtwo (register uint32 xsize, register uint32 *xdata)
void | mp32divtwo (register uint32 xsize, register uint32 *xdata)
void | mp32sdivtwo (register uint32 xsize, register uint32 *xdata)
uint32 | mp32multwo (register uint32 xsize, register uint32 *xdata)
uint32 | mp32mszcnt (register uint32 xsize, register const uint32 *xdata)
uint32 | mp32lszcnt (register uint32 xsize, register const uint32 *xdata)
void | mp32lshift (register uint32 xsize, register uint32 *xdata, uint32 count)
void | mp32rshift (register uint32 xsize, register uint32 *xdata, uint32 count)
uint32 | mp32rshiftlsz (register uint32 xsize, register 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, register uint32 *wksp)
void | mp32print (register FILE *fp, register uint32 xsize, register const uint32 *xdata)
void | mp32println (register FILE *fp, register uint32 xsize, register const uint32 *xdata)

## Detailed Description

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

Definition in file mp32.c.

## Function Documentation

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

| Definition at line 523 of file mp32.c. References uint32, and uint64.

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

| Definition at line 658 of file mp32.c. References uint32, and uint64.

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

| Definition at line 725 of file mp32.c. References uint32, and uint64.

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

| Definition at line 501 of file mp32.c. References uint32, and uint64.

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

| Definition at line 545 of file mp32.c. References mp32add, mp32addw, and uint32.

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

| Definition at line 434 of file mp32.c. References uint32.

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

| Definition at line 425 of file mp32.c. References uint32.

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

| Definition at line 808 of file mp32.c. References mp32rshiftlsz, and uint32.

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

| Definition at line 816 of file mp32.c. References uint32.

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

| Definition at line 98 of file mp32.c. References uint32.

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

| Definition at line 353 of file mp32.c. References uint32.

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

| Definition at line 117 of file mp32.c. References mp32eq, mp32z, and uint32.

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

| Definition at line 65 of file mp32.c. References uint32.

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

| Definition at line 46 of file mp32.c. References uint32.

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. References mp32copy, mp32ge, mp32lshift, mp32nz, mp32rshiftlsz, mp32sub, and uint32.

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

| Definition at line 244 of file mp32.c. References uint32.

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

| Definition at line 261 of file mp32.c. References mp32ge, mp32nz, mp32z, and uint32.

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

| Definition at line 174 of file mp32.c. References uint32.

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

| Definition at line 190 of file mp32.c. References mp32gt, mp32nz, mp32z, and uint32.

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

| Definition at line 319 of file mp32.c. References uint32.

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

| Definition at line 336 of file mp32.c. References uint32.

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

| Definition at line 281 of file mp32.c. References uint32.

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

| Definition at line 372 of file mp32.c. References uint32.

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

| Definition at line 298 of file mp32.c. References mp32le, mp32nz, mp32z, and uint32.

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

| Definition at line 398 of file mp32.c. References uint32.

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

| Definition at line 916 of file mp32.c. References mp32move, mp32zero, uint32, and uint8.

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

| Definition at line 889 of file mp32.c. References uint32.

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

| Definition at line 209 of file mp32.c. References uint32.

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

| Definition at line 225 of file mp32.c. References mp32lt, mp32nz, mp32z, and uint32.

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

| Definition at line 389 of file mp32.c. References uint32.

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

| Definition at line 862 of file mp32.c. References uint32.

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

| Definition at line 682 of file mp32.c. References mp32addmul, mp32setmul, and uint32.

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

| Definition at line 844 of file mp32.c. References uint32.

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

| Definition at line 1217 of file mp32.c. References mp32copy, mp32ge, mp32lt, mp32setmul, mp32sub, mp32subx, uint32, and uint64.

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

| Definition at line 136 of file mp32.c. References uint32.

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

| Definition at line 626 of file mp32.c. References mp32addw, mp32not, and uint32.

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

| Definition at line 155 of file mp32.c. References mp32ne, mp32nz, and uint32.

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

| Definition at line 1170 of file mp32.c. References mp32copy, mp32ge, mp32lt, mp32setmul, mp32sub, mp32subx, uint32, and uint64.

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

| Definition at line 1113 of file mp32.c. References mp32copy, mp32ge, mp32lt, mp32setmul, mp32sub, mp32subx, uint32, and uint64.

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

| Definition at line 798 of file mp32.c. References mp32lshift, mp32mszcnt, and uint32.

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

| Definition at line 457 of file mp32.c. References uint32.

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

| Definition at line 86 of file mp32.c. References uint32.

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

| Definition at line 56 of file mp32.c. References uint32.

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

| Definition at line 1296 of file mp32.c. References uint32.

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

| Definition at line 1311 of file mp32.c. References uint32.

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

| Definition at line 953 of file mp32.c. References mp32move, mp32zero, uint32, and uint8.

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

| Definition at line 991 of file mp32.c. References uint32.

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

| Definition at line 832 of file mp32.c. References mp32divtwo, and uint32.

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

| Definition at line 416 of file mp32.c. References uint32.

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

| Definition at line 407 of file mp32.c. References uint32.

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

| Definition at line 635 of file mp32.c. References uint32, and uint64.

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

| Definition at line 470 of file mp32.c. References uint32.

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

| Definition at line 481 of file mp32.c. References uint32.

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

| Definition at line 782 of file mp32.c. References uint32.

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

| Definition at line 751 of file mp32.c. References mp32addmul, mp32addsqrtrc, mp32multwo, mp32setmul, and uint32.

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

| Definition at line 587 of file mp32.c. References uint32, and uint64.

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

| Definition at line 563 of file mp32.c. References uint32, and uint64.

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

| Definition at line 609 of file mp32.c. References mp32sub, mp32subw, and uint32.

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

| Definition at line 443 of file mp32.c. References uint32.

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

| Definition at line 74 of file mp32.c. References uint32.

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

| Definition at line 36 of file mp32.c. References uint32.