Cryptography Reference
In-Depth Information
mixed modular exponentiation with USHORT exponent
Function:
int umexp_l (CLINT bas_l, USHORT e, CLINT p_l,
CLINT m_l);
Syntax:
bas_l (base)
e (exponent)
m_l (modulus)
Input:
p_l (power residue)
Output:
Return:
E_CLINT_OK if all ok
E_CLINT_DBZ if division by 0
int
umexp_l (CLINT bas_l, USHORT e, CLINT p_l, CLINT m_l)
{
CLINT tmp_l, tmpbas_l;
USHORT k = BASEDIV2;
int err = E_CLINT_OK;
if (EQZ_L (m_l))
{
return E_CLINT_DBZ;
/* division by zero */
}
if (EQONE_L (m_l))
{
SETZERO_L (p_l);
/* modulus = 1 ==> remainder = 0 */
return E_CLINT_OK;
}
if (e == 0)
/* exponent = 0 ==> remainder = 1 */
{
SETONE_L (p_l);
return E_CLINT_OK;
}
if (EQZ_L (bas_l))
{
SETZERO_L (p_l);
return E_CLINT_OK;
}
mod_l (bas_l, m_l, tmp_l);
cpy_l (tmpbas_l, tmp_l);
 
Search WWH ::




Custom Search