c4e_gfp.h File Reference

(Version 551)

Prime field arithmetic in $ \mathbb{F}_p $. More...

#include "c4e_modn.h"
Include dependency graph for c4e_gfp.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 $ \mathbb{F}_p $.

Detailed Description

Prime field arithmetic in $ \mathbb{F}_p $.

Author:
Copyright (C) 2015 Ralf Hoppe <ralf.hoppe@ieee.org>
Version:
Id
c4e_gfp.h 551 2015-03-01 12:37:45Z ralf

Definition in file c4e_gfp.h.


Define Documentation

#define C4E_GFP_INV_SPACE ( msize   ) 

Temp. space calculation (in units of C4eArchDigit) for function c4e_gfp_inv().

Parameters:
[in] msize Size of modulus in units of C4eArchDigit.
Returns:
Required digit space (in units of C4eArchDigit) when using c4e_gfp_inv() or functions based on it.
See also:
c4e_gfp_inv()

Definition at line 48 of file c4e_gfp.h.


Function Documentation

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 $ \mathbb{F}_p $.

Precondition:
The numbers 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.
Use of restrict qualifier indicates that aliasing x with y or aliasing x->digits with y->digits is not allowed.
Note:
Parameter 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").
Parameters:
[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 $ \mathbb{F}_p $.
tmp Array of temporary space elements (see preconditions for details on size).
[out] y Big number which is $x^{-1} \pmod m $, normalized. If the result is zero then x seems not to be a valid field element ($ \gcd(x,m)=1 $ 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).
See also:
c4e_elem_norm(), C4E_ELEM_IS_ZERO(), C4E_GFP_INV_SPACE(), C4eElement, C4E_ELEM_ASGN_MEM()