Cryptography Reference
In-Depth Information
as arguments and
a_l
is overwritten with the return value at the end of the
computation, are always possible, since the return variable is written to with the
return value only after the complete execution of the operation. From assembler
programming one says in this case that the variable
a_l
is used as an
accumulator
.
This modus operandi is supported by all FLINT/C functions.
A
CLINT
object
n_l
possesses
leading zeros
if for a value
l
one has
(DIGITS_L (n_l) == l) && (l > 0) && (n_l[l] == 0);
Leading zeros are redundant, since although they lengthen the representation of a
number, they have no effect on its value. However, leading zeros are allowed in the
notation of a number, for which reason we should not simply ignore this option.
The acceptance of leading zeros is, to be sure, a burdensome implementation
detail, but it leads to increased tolerance of input from external sources and thus
contributes to the stability of all the functions.
CLINT
numbers with leading zeros
are thus accepted by all FLINT/C functions, but they are not generated by them.
A further setting is related to the behavior of arithmetic functions in the
case of
overflow
, which occurs when the result of an arithmetic operation is
too large to be represented in the result type. Although in some publications
on C the behavior of a program in the case of arithmetic overflow is said to be
implementation-dependent, the C standard nonetheless governs precisely the
case of overflow in arithmetic operations with unsigned integer types: There
it is stated that arithmetic modulo
2
n
should be executed when the data type
can represent integers of
n
-bit length (see [Harb], Section 5.1.2). Accordingly,
in the case of overflow the basic arithmetic functions described below reduce
their results modulo
(
N
max
+1)
, which means that the remainder after whole-
number division by
N
max
+1
is output as the result (see Section 4.3 and Chapter
5). In the case of
underflow
, which occurs when the result of an operation is
negative, a positive residue modulo
(
N
max
+1)
is output. The FLINT/C functions
thus behave in conformity with arithmetic according to the C standard.
If an overflow or underflow is detected, the arithmetic functions return the
appropriate error code. This and all other error codes in Table 3-1 are defined in
the header file
flint.h
.