Cryptography Reference
In-Depth Information
Check for the null pointer: the ugliest error of them all.
if (n_l == NULL)
{
error = E_VCHECK_MEM;
}
else
{
Check for overflow: Does the number have too many digits?
if (((unsigned int) DIGITS_L (n_l)) > CLINTMAXDIGIT)
{
error = E_VCHECK_OFL;
}
else
{
Check for leading zeros: These we can live with ;-)
if ((DIGITS_L (n_l) > 0) && (n_l[DIGITS_L (n_l)] == 0))
{
error = E_VCHECK_LDZ;
}
}
}
return error;
}
The return values of the function are defined as macros in the file flint.h .An
explanation of these values is provided in Table 8-1.
The numeric values of the error codes are smaller than zero, so that a simple
comparison with zero suffices to distinguish between errors on the one hand and
warnings or the valid case on the other.
Search WWH ::




Custom Search