Cryptography Reference
In-Depth Information
Z n
Function:
calculation of the multiplicative inverse in
void inv_l (CLINT a_l, CLINT n_l, CLINT g_l, CLINT i_l);
Syntax:
a_l, n_l (operands)
Input:
g_l (gcd of a_l and n_l)
i_l (inverse of a_l mod n_l , if defined)
Output:
void
inv_l (CLINT a_l, CLINT n_l, CLINT g_l, CLINT i_l)
{
CLINT v1_l, v3_l, t1_l, t3_l, q_l;
Test of the operands for 0. If one of the operands is zero, then there does not exist
an inverse, but there does exist a greatest common divisor (cf. page 168). The result
variable i_l is then undefined, which is indicated by being set to zero.
if (EQZ_L (a_l))
{
if (EQZ_L (n_l))
{
SETZERO_L (g_l);
SETZERO_L (i_l);
return;
}
else
{
cpy_l (g_l, n_l);
SETZERO_L (i_l);
return;
}
}
else
{
if (EQZ_L (n_l))
{
cpy_l (g_l, a_l);
SETZERO_L (i_l);
return;
}
}
 
Search WWH ::




Custom Search