Functions | |
uint32_t * | INVERT (ECC_State *state, uint32_t *in1) |
Perform a modular inversion of the element at address in in1. More... | |
uint32_t | IMPORTMODULUS (uint32_t *out, const uint32_t *in1) |
Imports the integer in LV format found at address in1 into address out in modulus format [0, 0, LSW, ..., MSW]. Returns the wordsize of the imported modulus. More... | |
uint32_t | IMPORTOPERAND (ECC_State *state, uint32_t *out, const uint32_t *in1) |
Imports the integer in LV format found at address in1 into address out in operand format [LSW, ..., MSW, 0, ..., 0], making sure that the obtained array has LEN+1 words, thus truncating or right-padding with zeroes as needed. Returns the wordsize of the imported integer. More... | |
uint32_t | EXPORTOPERAND (ECC_State *state, uint32_t *out, const uint32_t *in1) |
Exports the integer found at address in1 to address out in LV format [LEN, LSW, ..., MSW]. Returns LEN. More... | |
void | SETOPERAND (ECC_State *state, uint32_t *out, uint32_t inValue) |
Writes the 32-bit integer in aux at address out in operand format. More... | |
void | mSET (ECC_State *state, uint32_t *in1, uint32_t size) |
Initializes the modulus at address in1 for later modular operations. Completes the modulus with the modulus-specific constant alpha = -1/m mod 2^64. More... | |
void | mMULT (uint32_t *out, const uint32_t *in1, const uint32_t *in2, uint32_t *mod, uint32_t len) |
Montgomery modular multiplication out = in1 * in2 * K mod MOD where K is the Montgomery factor K = 2^-(32*LEN) mod MOD. More... | |
void | mSUB (uint32_t *out, const uint32_t *in1, const uint32_t *in2, uint32_t *mod, uint32_t len) |
Computes out = in1 - in2 mod MOD. More... | |
void | mADD (uint32_t *out, const uint32_t *in1, const uint32_t *in2, uint32_t *mod, uint32_t len) |
Computes out = in1 + in2 mod MOD. More... | |
void | mOUT (uint32_t *out, const uint32_t *in1, uint32_t *mod, uint32_t len) |
Computes the scrict modular remainder out = in1 mod MOD < MOD. More... | |
void | COPY (uint32_t *out, uint32_t *in1, uint32_t size) |
Copies aux words from address in1 to address out. More... | |
uint8_t | GETBIT (uint32_t *in1, uint32_t *in2) |
Extract the bit of given index. More... | |
uint8_t | SCALARMUL_init (ECC_State *state) |
Initialization for scalar multiplication. More... | |
void COPY | ( | uint32_t * | out, |
uint32_t * | in1, | ||
uint32_t | size | ||
) |
uint32_t EXPORTOPERAND | ( | ECC_State * | state, |
uint32_t * | out, | ||
const uint32_t * | in1 | ||
) |
Exports the integer found at address in1 to address out in LV format [LEN, LSW, ..., MSW]. Returns LEN.
state | pointer to ECC state object |
in1 | pointer to integer |
out | points where the LV format integer is to be written |
uint8_t GETBIT | ( | uint32_t * | in1, |
uint32_t * | in2 | ||
) |
uint32_t IMPORTMODULUS | ( | uint32_t * | out, |
const uint32_t * | in1 | ||
) |
Imports the integer in LV format found at address in1 into address out in modulus format [0, 0, LSW, ..., MSW]. Returns the wordsize of the imported modulus.
out | points where the modulus is to be written |
in1 | pointer to integer in LV format [L, LSW, ..., MSW] |
uint32_t IMPORTOPERAND | ( | ECC_State * | state, |
uint32_t * | out, | ||
const uint32_t * | in1 | ||
) |
Imports the integer in LV format found at address in1 into address out in operand format [LSW, ..., MSW, 0, ..., 0], making sure that the obtained array has LEN+1 words, thus truncating or right-padding with zeroes as needed. Returns the wordsize of the imported integer.
state | pointer to ECC state object |
out | points where the operand is to be written |
in1 | pointer to integer in LV format [L, LSW, ..., MSW] |
uint32_t* INVERT | ( | ECC_State * | state, |
uint32_t * | in1 | ||
) |
void mADD | ( | uint32_t * | out, |
const uint32_t * | in1, | ||
const uint32_t * | in2, | ||
uint32_t * | mod, | ||
uint32_t | len | ||
) |
Computes out = in1 + in2 mod MOD.
out | pointer to result to be written in operand format |
in1 | pointer to first operand in operand format |
in2 | pointer to second operand in operand format |
mod | pointer to modulus |
len | word length of operands |
void mMULT | ( | uint32_t * | out, |
const uint32_t * | in1, | ||
const uint32_t * | in2, | ||
uint32_t * | mod, | ||
uint32_t | len | ||
) |
Montgomery modular multiplication out = in1 * in2 * K mod MOD where K is the Montgomery factor K = 2^-(32*LEN) mod MOD.
out | points anywhere in memory except in1 or in2 |
in1 | pointer to multiplicator in operand format |
in2 | pointer to multiplicand in operand format |
mod | pointer to modulus |
len | word length of operands |
void mOUT | ( | uint32_t * | out, |
const uint32_t * | in1, | ||
uint32_t * | mod, | ||
uint32_t | len | ||
) |
Computes the scrict modular remainder out = in1 mod MOD < MOD.
out | pointer to result to be written in operand format |
in1 | pointer to integer in operand format |
mod | pointer to modulus |
len | word length of operands |
void mSET | ( | ECC_State * | state, |
uint32_t * | in1, | ||
uint32_t | size | ||
) |
Initializes the modulus at address in1 for later modular operations. Completes the modulus with the modulus-specific constant alpha = -1/m mod 2^64.
state | pointer to ECC state object |
in1 | pointer to modulus in format [0, 0, LSW(m), ..., MSW(m)] |
size | indicates the wordsize of the modulus |
void mSUB | ( | uint32_t * | out, |
const uint32_t * | in1, | ||
const uint32_t * | in2, | ||
uint32_t * | mod, | ||
uint32_t | len | ||
) |
Computes out = in1 - in2 mod MOD.
out | pointer to result to be written in operand format |
in1 | pointer to first operand in operand format |
in2 | pointer to second operand in operand format |
mod | pointer to modulus |
len | word length of operands |
uint8_t SCALARMUL_init | ( | ECC_State * | state | ) |
Initialization for scalar multiplication.
state | pointer to ECC state object |
STATUS_SCALAR_MUL_OK | |
STATUS_MODULUS_EVEN | |
STATUS_MODULUS_MSW_IS_ZERO | |
STATUS_MODULUS_LENGTH_ZERO | |
STATUS_MODULUS_LARGER_THAN_255_WORDS |
void SETOPERAND | ( | ECC_State * | state, |
uint32_t * | out, | ||
uint32_t | inValue | ||
) |
Writes the 32-bit integer in aux at address out in operand format.
state | pointer to ECC state object |
out | points where the integer is to be written |
inValue | word to copy |