Polynomial arithmetic in finite field . More...
#include "c4e_mod2n.h"
Go to the source code of this file.
Defines | |
#define | C4E_GF2N_INV_SPACE(msize) |
Temp. space calculation (in units of C4eArchDigit) for function c4e_gf2n_inv(). | |
Functions | |
void | c4e_gf2n_inv (C4E_CONST C4eElement *C4E_RESTRICT a, C4E_CONST C4eElement *C4E_RESTRICT b, C4E_CONST C4eElement *C4E_RESTRICT m, C4eArchDigit tmp[], C4eElement *C4E_RESTRICT c) |
Inversion of a field element in , with multiplication by another element (so performing a division). | |
C4eSysStatus | c4e_gf2n_qsolve (C4E_CONST C4eElement *C4E_RESTRICT m, C4E_CONST C4eElement *C4E_RESTRICT beta, C4eArchDigit tmp[C4E_RESTRICT], C4eElement *C4E_RESTRICT z) |
Solves the quadratic equation in . |
Polynomial arithmetic in finite field .
Definition in file c4e_gf2n.h.
#define C4E_GF2N_INV_SPACE | ( | msize | ) |
Temp. space calculation (in units of C4eArchDigit) for function c4e_gf2n_inv().
[in] | msize | Size of binary polynomial m(x) in C4eArchDigit units. |
Definition at line 49 of file c4e_gf2n.h.
void c4e_gf2n_inv | ( | C4E_CONST C4eElement *C4E_RESTRICT | a, | |
C4E_CONST C4eElement *C4E_RESTRICT | b, | |||
C4E_CONST C4eElement *C4E_RESTRICT | m, | |||
C4eArchDigit | tmp[], | |||
C4eElement *C4E_RESTRICT | c | |||
) |
Inversion of a field element in , with multiplication by another element (so performing a division).
a
and m
must be normalized (e.g. by using function c4e_elem_norm()) and must be unequal to zero. a
and b
must be reduced to m
(e.g. by using c4e_poly_mod(), so having a size which is less/equal than the size of m
). tmp
must point to pre-allocated memory space for at least (3U * C4E_GF2N_INV_SPACE(m->size
)) digits. a
or b
with c
or aliasing a->digits
or b->digits
with c->digits
is not allowed.[in] | a | Binary polynomial to be inverted modulo the polynomial m . |
[in] | b | Binary polynomial to be multiplied with or NULL if only the element inversion is of interest (assumes b = 1). |
[in] | m | Binary polynomial forming the modulus of the associated field . |
tmp | Array of temporary space elements (see preconditions for details on size). | |
[out] | c | Binary polynomial which is , normalized. If the result is zero then a 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_GF2N_INV_SPACE(m->size ). |
C4eSysStatus c4e_gf2n_qsolve | ( | C4E_CONST C4eElement *C4E_RESTRICT | m, | |
C4E_CONST C4eElement *C4E_RESTRICT | beta, | |||
C4eArchDigit | tmp[C4E_RESTRICT], | |||
C4eElement *C4E_RESTRICT | z | |||
) |
Solves the quadratic equation in .
tmp
must point to pre-allocated memory space for at least (4U * m->size
) digits. m
must be normalized (e.g. by using function c4e_elem_norm()) and it must be unequal to zero. If m
is not irreducible (which normally is a precondition for the existence of field then this function may return error C4E_STATUS_EDOM. beta
must be less/equal m->size
(in best-case it is also reduced to m
). z
is not allowed.[in] | m | Binary polynomial forming the modulus of the associated field . |
[in] | beta | Right hand side of quadratic equation (value zero is allowed, then z becomes zero). |
tmp | Temporary used memory space of (4U * m->size ) digits. | |
[out] | z | Result in equation , not normalized. The other solution then is . The required C4eArchDigit digits space for z is m->size . |
z
. C4E_STATUS_OK | if the result is valid | |
C4E_STATUS_ERNG | random generator failure | |
C4E_STATUS_EDOM | no solution in |