Cryptography Reference
In-Depth Information
int
mmul_l (CLINT aa_l, CLINT bb_l, CLINT c_l, CLINT m_l)
{
CLINT a_l, b_l;
CLINTD tmp_l;
if (EQZ_L (m_l))
{
return E_CLINT_DBZ;
}
cpy_l (a_l, aa_l);
cpy_l (b_l, bb_l);
mult (a_l, b_l, tmp_l);
mod_l (tmp_l, m_l, c_l);
return E_CLINT_OK;
}
The functions for modular multiplication and squaring are so similar that for
modular multiplication we give only the interface of the function.
Function:
modular squaring
int msqr_l (CLINT aa_l, CLINT c_l, CLINT m_l);
Syntax:
aa_l
(factor),
m_l
(modulus)
Input:
c_l
(remainder)
Output:
E_CLINT_OK
if all is ok
E_CLINT_DBZ
if division by 0
Return:
To each of these functions (of course, with the exception of squaring) there
is a corresponding mixed function, which as its second argument takes a
USHORT
argument. As an example, we demonstrate the function
umadd_l()
. The functions
umsub_l()
and
ummul_l()
follow exactly the same pattern, and so we shall not go
into them in detail.