Prime field arithmetic in . More...
#include "c4e_modn.h"
Go to the source code of this file.
Defines | |
#define | C4E_GFP_INV_SPACE(msize) |
Temp. space calculation (in units of C4eArchDigit) for function c4e_gfp_inv(). | |
Functions | |
void | c4e_gfp_inv (C4E_CONST C4eElement *C4E_RESTRICT x, C4E_CONST C4eElement *C4E_RESTRICT m, C4eArchDigit tmp[C4E_RESTRICT], C4eElement *C4E_RESTRICT y) |
Inversion of a field element in . |
Prime field arithmetic in .
Definition in file c4e_gfp.h.
#define C4E_GFP_INV_SPACE | ( | msize | ) |
Temp. space calculation (in units of C4eArchDigit) for function c4e_gfp_inv().
[in] | msize | Size of modulus in units of C4eArchDigit. |
void c4e_gfp_inv | ( | C4E_CONST C4eElement *C4E_RESTRICT | x, | |
C4E_CONST C4eElement *C4E_RESTRICT | m, | |||
C4eArchDigit | tmp[C4E_RESTRICT], | |||
C4eElement *C4E_RESTRICT | y | |||
) |
Inversion of a field element in .
x
and m
must be normalized (e.g. by using function c4e_elem_norm()) and must be unequal to zero. tmp
must point to pre-allocated memory space for at least (4U * C4E_GFP_INV_SPACE(m->size
)) digits. x
with y
or aliasing x->digits
with y->digits
is not allowed.x
can be declared as C4E_CONST because the structure it points to isn't modified. Instead only the digits in x->digits
[] will change (and the double indirection prevents any const inheritance, at least when using "C").[in] | x | Big number to be inverted modulo the prime number m . Notice that x is destroyed. The digits space which must be available at x->digits is C4E_GFP_INV_SPACE(m->size ). |
[in] | m | Prime number forming the modulus p of the associated field . |
tmp | Array of temporary space elements (see preconditions for details on size). | |
[out] | y | Big number which is , normalized. If the result is zero then x seems not to be a valid field element ( does not hold true) and so does not have an inverse (error condition). The required C4eArchDigit digits space is C4E_GFP_INV_SPACE(m->size ). |