Appendix A. Directory of C Functions

Input/Output, Assignment, Conversions, Comparisons

int
byte2clint_l (CLINT n_l,
    char *bytes, int len);

conversion of a byte vector to CLINT (after IEEE, P1363, 5.5.1)

UCHAR*
clint2byte_l (CLINT n_l,
     int *len);

convert CLINT to a byte vector (according to IEEE, P1363, 5.5.1)

int
cmp_l (CLINT a_l, CLINT b_l);

size comparison of a_l and b_l

int
cpy_l (CLINT dest_l, CLINT src_l);

assignment of src_l to dest_l

int
equ_l (CLINT a_l, CLINT b_l);

test of equality of a_l and b_l

void
fswap_l (CLINT a_l, CLINT b_l);

exchange of a_l and b_l

clint*
setmax_l (CLINT n_l);

set n_l to the largest CLINT integer representable by the number Nmax

int
str2clint_l (CLINT n_l,
    char *N, USHORT b);

convert a character string to the base b to CLINT

void
u2clint_l (CLINT num_l, USHORT ul);

convert USHORT to CLINT

void
ul2clint_l (CLINT num_l, ULONG ul);

convert ULONG to CLINT

unsigned int
vcheck_l (CLINT n_l);

CLINT format check

char*
verstr_l ();

output the version of the FLINT/C library in a character string, with identifiers 'a' for assembler support and 's' for FLINT/C security mode

char*
xclint2str_l (CLINT n_l,
    USHORT base, int showbase);

convert from CLINT into a character string to the base base, with or without prefix

Basic Calculations

int
add_l (CLINT a_l, CLINT b_l,
    CLINT s_l)

addition: sum of a_l and b_l, output in s_l

int
dec_l (CLINT a_l)

decrement a_l

int
div_l (CLINT a_l, CLINT b_l,
     CLINT q_l, CLINT r_l)

division with remainder: division of a_l by b_l, quotient in q_l, remainder in r_l

int
inc_l (CLINT a_l)

increment a_l

int
mul_l (CLINT a_l, CLINT b_l,
     CLINT p_l)

multiplication: product of a_l and b_l, output in p_l

int
sqr_l (CLINT a_l, CLINT p_l)

square a_l, output in p_l

int
sub_l (CLINT a_l, CLINT b_l,
     CLINT s_l)

subtraction: difference of a_l and b_l, output in s_l

int
uadd_l (CLINT a_l, USHORT b,
     CLINT s_l)

mixed addition: sum of a_l and b, output in s_l

int
udiv_l (CLINT a_l, USHORT b,
     CLINT q_l, CLINT r_l)

mixed division with remainder: division of a_l by b, quotient in q_l, remainder in r_l

int
umul_l (CLINT a_l, USHORT b,
     CLINT p_l)

mixed multiplication: product of a_l and b, output in p_l

int
usub_l (CLINT a_l, USHORT b,
     CLINT c_l)

mixed subtraction: difference of a_l and b, output in s_l

Modular Arithmetic

int
madd_l (CLINT a_l, CLINT b_l,
     CLINT c_l, CLINT m_l);

modular addition: addition of a_l and b_l modulo m_l, output in c_l

int
mequ_l (CLINT a_l, CLINT b_l,
     CLINT m_l);

test for equality of a_l and b_l modulo m_l

int
mexp_l (CLINT bas_l, CLINT e_l,
     CLINT p_l,CLINT m_l);

modular exponentiation, automatic use of mexpkm_l() if modulus odd, otherwise mexpk_l()

int
mexp2_l (CLINT bas_l, USHORT e,
     CLINT p_l, CLINT m_l);

modular exponentiation, exponent e a power of 2

int
mexp5_l (CLINT bas_l, CLINT exp_l,
     CLINT p_l,CLINT m_l);

modular exponentiation, 25-ary method

int
mexp5m_l (CLINT bas_l, CLINT exp_l,
     CLINT p_l, CLINT m_l);

Montgomery exponentiation, 25-ary method, oddmodulus

int
mexpk_l (CLINT bas_l, CLINT exp_l,
     CLINT p_l, CLINT m_l);

modular exponentiation, 2k-ary method, dynamic memory with malloc()

int
mexpkm_l (CLINT bas_l, CLINT exp_l,
     CLINT p_l, CLINT m_l);

Montgomery exponentiation, 2k -ary method with odd modulus

int
mmul_l (CLINT a_l, CLINT b_l,
     CLINT c_l, CLINT m_l);

modular multiplication: multiplication of a_l and b_l mod m_l, output in c_l

int
mod_l (CLINT d_l, CLINT n_l,
    CLINT r_l);

residue of d_l mod n_l, output in r_l

int
mod2_l (CLINT d_l, ULONG k,
     CLINT r_l);

residue of d_l mod 2k

int
msqr_l (CLINT a_l, CLINT c_l,
     CLINT m_l);

modular squaring of a_l mod n_l, square in p_l

int
msub_l (CLINT a_l, CLINT b_l,
     CLINT c_l, CLINT m_l);

modular subtraction: subtraction of a_l and b_l mod m_l, output in c_l

void
mulmon_l (CLINT a_l, CLINT b_l,
      CLINT n_l, USHORT nprime,
     USHORT log B_r, CLINT p_l);

modular multiplication of a_l and b_l mod n_l, product in p_l (Montgomery method, Blog B_r-1 ≤ n_l < B log B_r)

void
sqrmon_l (CLINT a_l, CLINT n_l,
     USHORT nprime, USHORT logB_r,
     CLINT p_l);

modular squaring of a_l mod n_l, square in p_l (Montgomery method, Blog B_r-1 ≤ n_l <B log B_r)

int
umadd_l (CLINT a_l, USHORT b,
     CLINT c_l, CLINT m_l);

mixed modular addition: addition of a_l and b mod m_l, output in c_l

int
umexp_l (CLINT bas_l, USHORT e,
      CLINT p_l, CLINT m_l);

modular exponentiation, USHORT exponent

int
umexpm_l (CLINT bas_l, USHORT e,
      CLINT p_l, CLINT m_l);

modular exponentiation, odd modulus, USHORT exponent

int
ummul_l (CLINT a_l, USHORT b,
     CLINT p_l, CLINT m_l);

mixed modular multiplication of a_l and b_l mod n_l, product in p_l

USHORT
umod_l (CLINT d_l, USHORT n);

residue of d_l mod n

int
umsub_l (CLINT a_l, USHORT b,
     CLINT c_l, CLINT m_l);

mixed modular subtraction: subtraction of a_l and b mod m_l, output in c_l

int
wmexp_l (USHORT bas, CLINT e_l,
     CLINT p_l, CLINT m_l);

modular exponentiation, USHORT base

int
wmexpm_l (USHORT bas, CLINT e_l,
     CLINT p_l, CLINT m_l);

Montgomery exponentiation, oddmodulus, USHORT base

Bitwise Operations

void
and_l (CLINT a_l, CLINT b_l,
     CLINT c_l)

bitwise AND of a_l and b_l, output in c_l

int
clearbit_l (CLINT a_l,
     unsigned int pos)

test and clear the bit of a_l in position pos

void
or_l (CLINT a_l, CLINT b_l,
     CLINT c_l)

bitwise OR of a_l and b_l, output in c_l

int
setbit_l (CLINT a_l,
     unsigned int pos)

test and set the bit of a_l in position pos

int
shift_l (CLINT a_l,
     long int noofbits)

left/right shift of a_l by noofbits bits

int
shl_l (CLINT a_l)

right shift of a_l by 1 bit

int
shr_l (CLINT a_l)

left shift of a_l by 1 bit

int
testbit_l (CLINT a_l,
     unsigned int pos)

test the bit of a_l in position pos

void
xor_l (CLINT a_l, CLINT b_l,
     CLINT c_l)

bitwise exclusive OR (XOR) of a_l and b_l, output in c_l

Number-Theoretic Functions

int
chinrem_l (unsigned noofeq,
     clint** coeff_l, CLINT x_l)

solution of simultaneous linear congruences, output in x_l

void
gcd_l (CLINT a_l, CLINT b_l,
     CLINT g_l)

greatest common divisor of a_l and b_l, output in g_l

int
introot_l (CLINT a_l, USHORT
b, CLINT r_l)

integer part of bth root of a_l, output in r_l

void
inv_l (CLINT a_l, CLINT n_l,
     CLINT g_l, CLINT i_l)

gcd of a_l and n_l and inverse of a_l mod n_l

unsigned
iroot_l (CLINT a_l, CLINT r_l)

integer part of square root of a_l, output in r_l

int
jacobi_l (CLINT a_l, CLINT b_l)

Legendre/Jacobi symbol, a_l over b_l

void
lcm_l (CLINT a_l, CLINT b_l,
     CLINT v_l)

least common multiple of a_l and b_l, output in v_1

int prime_l (CLINT n_l,
unsigned noofsmallprimes,
     unsigned iterations)

Miller-Rabin primality test of n_l with division sieve

int
primroot_l (CLINT x_l,
     unsigned noofprimes,
     clint** primes_l)

determine a primitive root modulo n, output in x_l

int
proot_l (CLINT a_l, CLINT p_l,
     CLINT x_l)

square root of a_l mod p_l, output in x_l

int
root_l (CLINT a_l, CLINT p_l,
     CLINT q_l, CLINT x_l)

square root of a_l mod p_l*q_l, output in x_l

USHORT
sieve_l (CLINT a_l,
     unsigned noofsmallprimes)

division sieve, division of a_l by small primes

void
xgcd_l (CLINT a_l, CLINT b_l,
     CLINT g_l,
     CLINT u_l, int *sign_u,
     CLINT v_l, int *sign_v)

greatest common divisor of a_l and b_l and representation of gcd in u_l and v_l with sign in sign_u and sign_v

Generation of Pseudorandom Numbers

UCHAR
bRand_l (STATEPRNG *xrstate)

generation of a pseudorandom number of type UCHAR

UCHAR
bRandBBS_l (STATEBBS *xrstate)

generation of a pseudorandom number of type UCHAR with the BBS generator

int
FindPrime_l (CLINT p_l,
     STATEPRNG *xrstate, USHORT l)

deterimine a pseudorandom prime p_l of type CLINT with 2l−1 ≤ p_l < 2l

int
FindPrimeGcd_l (CLINT p_l,
     STATEPRNG *xrstate,
     USHORT l, CLINT f_l)

deterimine a pseudorandom prime p_l of type CLINT with 2l−1 ≤ p_l < 2l and gcd(p_l - 1, f_l) = 1

int
FindPrimeMinMaxGcd_l (CLINT p_l,
     STATEPRNG *xrstate,
     CLINT rmin_l,
     CLINT rmax_l, CLINT f_l)

deterimine a pseudorandom prime p_l of type CLINT with rmin_l ≤ p_l ≤ rmax_l and gcd(p_l - 1, f_l) = 1

int
GetEntropy_l (CLINT Seed_l,
     char *Hashres,int AddEntropy,
     char *RndStr, int LenRndStr)

generate entropy for initializing pseudorandom number generator

int
InitRand_l (STATEPRNG *xrstate,
     char *UsrStr, int LenUsrStr,
     int AddEntropy, int Generator)

initialize a yet to be specified random number generator with generation of entropy

int
InitRandAES_l (STATEAES *rstate,
     char *UsrStr, int LenUsrStr,
     int AddEntropy)

initialize the AES random number generator with generation of entropy

int
InitRandBBS_l (STATEBBS *rstate,
     char *UsrStr, int LenUsrStr,
     int AddEntropy)

initialize the Blum-Blum-Shub random number generator with generation of entropy

int
InitRandRMDSHA1_l (
     STATERMDSHA1 *rstate,
     char * UsrStr, int LenUsrStr,
     int AddEntropy)

initialize the RandRMDSHA-1 random number generator with generation of entropy

ULONG lRand_l (STATEPRNG *xrstate)

generator for random numbers of type ULONG

void PurgeRand_l (STATEPRNG *xrstate)

delete internal state of a pseudorandom generator

void PurgeRandAES_l (STATEAES *rstate)

delete internal state of pseudorandom generator RandAES

void PurgeRandBBS_l (STATEBBS *rstate)

delete internal state of pseudorandom generator RandBBS

void
PurgeRandRMDSHA1_l (STATERMDSHA1
     *rstate)

delete internal state of pseudorandom generator RandRMDSHA1

int
Rand_l (CLINT r_l,
     STATEPRNG *xrstate, int l)

generation of a pseudorandom number r_l of type CLINT with 2l-1 ≤ r_l < 2l using the FLINT/C pseudorandom number generators

void rand_l (CLINT r_l, int l)

CLINT random number with l binary digits, linear congruences

clint* rand64_l (void)

64-bit random number generator

int
RandAES_l (CLINT r_l,
     STATEAES *rstate, int l)

CLINT random numbers with l binary digits via AES random number generator using an individual state buffer

int
RandBBS_l (CLINT r_l,
     STATEBBS *rstate, int l)

CLINT random numbers with l binary digits via BBS random number generator using an individual state buffer

clint* randBBS_l (CLINT r_l, int l)

CLINT random numbers with l binary digits using BBS bit generator

int
RandlMinMax_l (CLINT r_l,
STATEPRNG *xrstate, CLINT rmin_l,
CLINT rmax_l)

determine a CLINT random number r_l with rmin_l ≤ r_l ≤ rmax_l

int
RandRMDSHA1_l (CLINT r_l,
     STATERMDSHA1 *rstate, int l)

CLINT random number with l binary digits via the RMDSHA1 random number generator using an individual state buffer

int randbit_l (void)

BBS bit generator

clint* seed64_l (CLINT seed_l)

initialization of rand64_l() with CLINT value

void seedBBS_l (CLINT seed_l)

initialization of randbit_l() with CLINT value

USHORT sRand_l (STATEPRNG *xrstate)

generate a pseudorandom number of type USHORT

int SwitchRandAES_l (STATEAES *rstate)

deterministic random number generator based on AES

int SwitchRandBBS_l (STATEBBS *rstate)

deterministic random number generator based on BBS

int
SwitchRandRMDSHA1_l
    (STATERMDSHA1 *rstate)

deterministic random number generator based on hash functions SHA-1 and RIPEMD-160

UCHAR ucrand64_l (void)

generator for random numbers of type UCHAR

UCHAR ucrandBBS_l (void)

BBS generator for random number of type UCHAR

ULONG ulrand64_l (void)

generator for random numbers of type ULONG

ULONG ulrandBBS_l (void)

BBS generator for random number of type ULONG

clint* ulseed64_l (ULONG seed)

initialization of rand64_l() with ULONG value

void ulseedBBS_l (ULONG seed)

initialization of randbit_l() with ULONG value

USHORT usrand64_l (void)

generator for random numbers of type USHORT

USHORT usrandBBS_l (void)

BBS generator for random number of type USHORT

Register Management

clint* create_l (void)

generate a CLINT register

int create_reg_l (void)

generate the CLINT register bank

void free_l (CLINT n_l);

clear a register by overwriting and release memory

void free_reg_l (void)

clear all registers of the register bank by overwriting, then release memory

clint* get_reg_l (unsigned int reg)

generate reference to register reg of the register bank

void purge_l (CLINT n_l)

clear a CLINT object by overwriting

int purge_reg_l (unsigned int reg)

clear a register of the register bank by overwriting

int purgeall_reg_l (void)

clear all registers of the register bank by overwriting

void
set_noofregs_l (unsigned int nregs)

set number of registers

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.154.252