Cryptography Reference
In-Depth Information
Function:
squaring
int sqr_l (CLINT f_l, CLINT pp_l);
Syntax:
f_l (factor)
Input:
pp_l (square)
Output:
E_CLINT_OK if all is ok
E_CLINT_OFL if overflow
Return:
int
sqr_l (CLINT f_l, CLINT pp_l)
{
register clint *pptr_l, *bptr_l;
CLINT a_l;
CLINTD p_l;
clint *aptr_l, *csptr_l, *msdptra_l, *msdptrb_l, *msdptrc_l;
USHORT av;
ULONG carry;
int OFL = E_CLINT_OK;
cpy_l (a_l, f_l);
if (EQZ_L (a_l))
{
SETZERO_L (pp_l);
return E_CLINT_OK;
}
msdptrb_l = MSDPTR_L (a_l);
msdptra_l = msdptrb_l - 1;
The initialization of the result vector addressed by pptr_l is carried out by means
of the partial product a 0 ( a n 1 a n 2 ...a 1 ) B , in analogy with multiplication. The
digit p 0 is here not assigned; it must be set to zero.
*LSDPTR_L (p_l) = 0;
carry = 0;
av = *LSDPTR_L (a_l);
for (bptr_l = LSDPTR_L (a_l) + 1, pptr_l = LSDPTR_L (p_l) + 1;
bptr_l <= msdptrb_l; bptr_l++, pptr_l++)
 
Search WWH ::




Custom Search