Cryptography Reference
In-Depth Information
Function:
subtraction
int sub_l (CLINT aa_l, CLINT bb_l, CLINT d_l);
Syntax:
aa_l (minuend), bb_l (subtrahend)
Input:
d_l (difference)
Output:
E_CLINT_OK if all is ok.
E_CLINT_UFL in the case of underflow
Return:
int
sub_l (CLINT aa_l, CLINT bb_l, CLINT d_l)
{
CLINT b_l;
clint a_l[CLINTMAXSHORT + 1]; /* allow 1 additional digit in a_l */
clint *msdptra_l, *msdptrb_l;
clint *aptr_l = LSDPTR_L (a_l);
clint *bptr_l = LSDPTR_L (b_l);
clint *dptr_l = LSDPTR_L (d_l);
ULONG carry = 0L;
int UFL = E_CLINT_OK;
cpy_l (a_l, aa_l);
cpy_l (b_l, bb_l);
msdptra_l = MSDPTR_L (a_l);
msdptrb_l = MSDPTR_L (b_l);
In the following the case a_l < b_l is considered, in which b_l is subtracted not
from a_l , but from the largest possible value, N max . Later, the value ( minuend +1)
is added to this difference, so that altogether the calculation is carried out mod-
ulo ( N max +1) . To generate the value N max the auxiliary function setmax_l()
is used.
 
Search WWH ::




Custom Search