Cryptography Reference
In-Depth Information
if (k > 1)
{
if ((ptr_l = (clint *) malloc (sizeof(CLINT) * ((pow2k >> 1) - 1))) == NULL)
{
return E_CLINT_MAL;
}
aptr_l[2] = a2_l;
for (aptr_l[3] = ptr_l,i=5;i<(int)pow2k; i+=2)
{
aptr_l[i] = aptr_l[i - 2] + CLINTMAXSHORT;
}
Now comes the precomputation of the powers of the value
a
stored in
a_l
.The
values
a
3
,a
5
,a
7
,...,a
k
−
1
are computed (
a
2
is needed only in an auxiliary role).
msqr_l (a_l, aptr_l[2], m_l);
for (i = 3; i < (int)pow2k; i += 2)
{
mmul_l (aptr_l[2], aptr_l[i - 2], aptr_l[i], m_l);
}
}
This ends the case distinction for
k>
1
. The exponent is lengthened by the
leading zero.
*(MSDPTR_L (e_l) + 1) = 0;
The determination of the value
f
(represented by the variable
noofdigits
).
noofdigits = (lge - 1)/k;
fk = noofdigits * k;
Word position
s
i
and bit position
d
i
of the digit
e
i
in the variables
word
and
bit
.
word = fk >> LDBITPERDGT;
/* fk div 16 */
bit = fk & (BITPERDGT-1U);
/* fk mod 16 */
Calculation of the digit
e
n
−
1
with the above-derived formula;
e
n
−
1
is represented
by the variable
digit
.