Cryptography Reference
In-Depth Information
modular addition of a CLINT type and a USHORT type
Function:
int umadd_l (CLINT a_l, USHORT b, CLINT c_l,
CLINT m_l);
Syntax:
a_l, b (summands), m_l (modulus)
Input:
c_l (remainder)
Output:
E_CLINT_OK if all is ok
E_CLINT_DBZ if division by 0
Return:
int
umadd_l (CLINT a_l, USHORT b, CLINT c_l, CLINT m_l)
{
int err;
CLINT tmp_l;
u2clint_l (tmp_l, b);
err = madd_l (a_l, tmp_l, c_l, m_l);
return err;
}
Our collection of mixed functions with a USHORT argument will be extended in
the following chapter to include two further functions. To end this chapter we
would like, with the help of modular subtraction, to construct an additional
useful auxiliary function that determines whether two CLINT values are equal as
representatives of a residue class modulo m . The following function mequ_l()
accomplishes this by using the definition of the congruence relationship
a ≡ b mod m ⇐⇒ m | ( a − b ) .
To determine whether two CLINT objects a_l and b_l are equivalent modulo
m_l , we need do nothing further than apply msub_l(a_l, b_l, r_l, m_l) and
check whether the remainder r_l of this operation is equal to zero.
test for equivalence modulo m
Function:
int mequ_l (CLINT a_l, CLINT b_l, CLINT m_l);
Syntax:
Input:
a_l, b_l (operands), m_l (modulus)
1if (a_l == b_l) modulo m_l
0 otherwise
Return:
 
Search WWH ::




Custom Search